agents/apiTHE ENCYCLOPEDIA
Tools & integrations

Function calling & application tools

Connect your own APIs with schemas, required actions, durable results, and explicit authorization.

Define JSON Schema
Receive required action
Validate & execute
Return tool result
Harness continues

Your code executes the function

A function definition describes a name, purpose, and JSON Schema for arguments. The model requests a call; your handler validates and executes it. Attaching a sandbox does not automatically execute application functions there. Handlers can live in your server or worker.

Handle the required action

Listen for agent.session.requires_action and read session.required_actions. Each pending call includes identifiers such as turn_id and call_id. A historical function_call item alone is not proof that a result is still pending.

Return a result to the right call

Send agent.session.input.tool_result through the session events endpoint with the matching turn and call IDs. Supply success: true with a string or supported content output, or success: false with an error. Serialize JSON objects before sending them as string output.

Make retries safe

Authorize each operation for the application user. Store side-effect results by session, turn, and call ID. After a disconnect, return the saved result instead of executing the action again. If execution may have succeeded without a saved result, reconcile the downstream outcome first.

Read the official reference

Check the source for current API fields, account requirements, and service limits.

OpenAI: functions

23 matching topics

What is the OpenAI Agents API?FoundationsAgents API vs Agents SDK vs Responses APIComparisonsAgents API quickstartGetting startedSessions, turns & durable stateCore conceptsHosted vs self-hosted sandboxesInfrastructureConnect MCP servers to Agents APITools & integrationsFunction calling & application toolsTools & integrationsMulti-agent orchestrationCore conceptsStreaming, webhooks & event handlingIntegration guidesFiles, outputs & published artifactsCore conceptsVaults & MCP authenticationTools & integrationsAgent security & credential boundariesProductionTracing, usage & debuggingProductionAgents API pricing & cost planningProductionOpenAI Agents API with PythonGetting startedAgents API with TypeScript & Next.jsIntegration guidesWhat is the OpenAI Agents SDK?FoundationsResponses API in the agent stackFoundationsAgent Skills & SKILL.mdTools & integrationsProgrammatic Tool CallingTools & integrationsRAG, file search & vector storesTools & integrationsWeb search & source citationsTools & integrationsChatKit & Agent BuilderIntegration guides
K to open Esc to close