Playground · In-browser tool

Agent tool loop

Before a function runs, the trace only has the name the model picked. The temperature comes from a local table.

Tool loop

The model only names a tool and its arguments. The host validates JSON, runs a local function, and feeds the result back. The model here is a script and makes no request.

Scenario

The weather script only knows Dalian (10°C), Shanghai (36°C) and Shenzhen (37°C), matching the course script.

  1. 1. Expose tools

    get_current_weather

1/4

Structured output

Only one JSON object is accepted. Prose around it, an unknown label, or a missing reason is rejected.

Rejected: 模型输出不是纯 JSON

Read the guide (Chinese): The agent tool loop: the model names, the host runs →