Skip to main content
Direct model requests advertise functions but do not execute them. Your application must inspect returned calls, validate and authorize arguments, perform the operation, append the result, and call the model again. For SDK-managed execution, use agent function tools. Add a schema to responses.Request.Tools:

Process the call

A returned OutputMessageUnion.OfFunctionCall carries Name, Arguments as a JSON string, and CallID. Dispatch only recognized functions. Check arguments against your application rules and the caller’s permissions before touching an external system. Append the model’s output items to the next input using AsInput, then append one matching OfFunctionCallOutput per call. Given call as the returned function call and output as the serialized application result:
Use the model’s call ID, not a newly generated value. Retain all output items required for continuation, including reasoning. Continue until the model returns a final answer or your application’s loop budget is exhausted.

Failure behavior

Decide which failures can be returned to the model as tool results and which must stop the run. Avoid returning credentials, stack traces, or privileged internal data in tool output. Bound tool concurrency, execution time, and the number of model/tool rounds yourself. A direct function schema does not provide approvals, persistent tool state, or retry-safe execution. Those are responsibilities of your loop or the higher-level agent APIs.