Skip to main content
POST
Send tool results
Sends results for pending custom tool calls. When the agent calls a custom tool, the session waits on awaiting_tool_results; posting a result for every pending call lets the run continue. The SDK run helpers call this endpoint for you. Results are relayed to the agent as-is: the API doesn’t check tool_req.id against the pending calls, so echo the request faithfully. Settling a call on a paused session leaves it paused; resume it separately. Returns 202 Accepted. The result is delivered asynchronously: the agent resumes once every pending call has one.

Path parameters

string
required
The session ID.

Request body

Send either a single settled call or a batch. A single call is a tool_result on success or an error_event on failure, discriminated by kind, and a batch wraps a list of them. Each call echoes back the full pending tool_req from pending_tool_calls ({ tool_name, args, id }) rather than only its id.

Tool result (success)

string
required
Must be "tool_result".
object
required
The pending tool call this answers, echoed back from pending_tool_calls: { tool_name, args, id }.
JSON-serializable tool output, shown to the model.

Tool error (failure)

string
required
Must be "error_event".
string
required
Error text shown to the model.
string
required
Component that produced the error, e.g. "custom_tools".
object
required
The pending tool call this answers, echoed back from pending_tool_calls.

Batch

string
required
Must be "batch".
array
required
Array of tool_result and/or error_event objects.

Examples

Send a single result

Send a batch of results


Errors