agents/apiTHE ENCYCLOPEDIA
Core concepts

Sessions, turns & durable state

Understand conversation continuity, steering, saved items, and recovery after a disconnected stream.

Create session
Start turn
Receive events
Inspect saved items
Continue session

Session versus turn

A session holds configuration, conversation, and saved work over time. A turn is one cycle of work. Input to an idle session starts a new turn; input while a turn is active steers ongoing work. Store the session ID against the correct application user and conversation.

Keep continuity explicit

Reuse the same session for follow-up requests. Opening a new session starts separate work. Open the event stream before sending follow-up input so early events are not missed. Persist identifiers in application storage rather than relying on one browser tab.

Recover before retrying

A broken network connection does not tell you whether agent work stopped. Retrieve session state and saved items. Check pending required actions and completed turns, then decide whether to reconnect, return a stored tool result, or send new input.

Separate resource lifetimes

Session history and environment files have different lifetimes. A durable conversation is not a guarantee that sandbox files remain available. Publish or copy outputs and follow environment lifecycle rules before stopping compute or deleting sessions.

Read the official reference

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

OpenAI: sessions

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