Pause agent execution for human review before sensitive tool calls, and persist state across approval gaps.
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.
Some tool calls should not fire automatically — sending an email, writing to a database, making a payment. Tool approval lets you intercept a tool call before it executes, inspect it, and approve or reject it. State persistence lets you serialise the agent's item list so the loop can pause and resume across process restarts.
Add an approval function to any tool definition. The SDK calls it with the ToolCallItem before dispatching execute. Return true to approve, false to reject.
When approval returns false, the SDK injects a tool_result with an error: "rejected" field and continues the loop — the model can then decide to try a different approach or give up.
For simpler cases, approval accepts a string:
When approval requires human input that may not arrive synchronously — for example, via a web form, a Slack message, or a mobile notification — the agent loop cannot block. Persist the item list to a database, pause, and resume when the human responds.
Rejected tool calls appear in the item list as tool_result items with error: "rejected". The model can see these and adjust its behaviour — it might try an alternative tool, ask the user for clarification, or give a graceful response.
Because the item list is append-only and contains every tool call and result, it doubles as a complete audit trail. Persist it alongside your application data to meet compliance requirements (Algeria Law 18-07 for PII-touching operations).