Register tools that the model can call, with automatic dispatch and result injection.
Not yet available. The Agent SDK is tracked to be built — today, use the Client SDKs against the live chat completions API. The docs below describe the intended design.
Tools let the model take actions — fetching data, running calculations, calling external APIs — during an agent turn. You define the schema; the model decides when and how to call the tool; the SDK dispatches the call, captures the result, and injects it into the next model request automatically.
A tool has:
name — snake_case identifier the model uses to call the tool.description — plain language explanation of what the tool does and when to use it.parameters — JSON Schema object describing the arguments. The model uses this to construct valid calls.execute — async function that runs the tool and returns a string result.callModel()#The loop continues until the stop condition is met. If the model calls get_weather, the SDK executes execute(), appends the result to the item list, and calls the model again with the result in context.
Pass an array of tools. The model can call any of them in any order, and multiple times.
If execute throws, the SDK catches the error, appends it as a tool_result with an error field, and lets the model decide how to respond. The agent loop does not halt on tool errors by default.
To halt on tool error, use a custom stop condition:
Some models issue multiple tool calls in a single turn. The SDK dispatches them concurrently using Promise.all and injects all results before calling the model again.
Track tool calls across the loop via the item list:
Use dynamicParams to change which tools are available mid-loop — for example, remove tools once the model has gathered enough information and should focus on producing a final answer. See Dynamic Parameters.
For sensitive tools that should pause for human review before executing, add an approval function. See Tool Approval & State Persistence.
no_tool_calls and others.Tool type definition.