2 2
3> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.3> For the complete documentation index, see [llms.txt](/llms.txt). Markdown versions of documentation pages are available by appending `.md` to the page URL.
4 4
5For new agent applications, start with the **[Agents API](https://developers.openai.com/api/docs/guides/agents-api/overview)**. OpenAI runs the Codex harness and manages orchestration, context compaction, and durable sessions. You build the surrounding application, connect tools, and choose where execution happens.5Agents can plan and complete tasks using tools, work with other agents, and maintain context across steps. Choose a runtime based on where you want orchestration to run and who should manage the state between tasks.
6
7Follow the [Agents API quickstart](https://developers.openai.com/api/docs/guides/agents-api/quickstart) to run a task, stream progress, and continue a session.
8 6
9## Choose your starting point7## Choose your starting point
10 8
11| You want to | Start here |9| You want to | Start here |
12| --- | --- |10| ------------------------------------------------------------------------------------ | ------------------------------------------------------ |
13| Build a new agent application with a managed runtime | [Agents API quickstart](https://developers.openai.com/api/docs/guides/agents-api/quickstart) |11| Run an agent with the Codex harness managed by OpenAI | [Agents API](https://developers.openai.com/api/docs/guides/agents-api/quickstart) |
14| Run the Codex harness in infrastructure you operate | [Codex SDK](https://developers.openai.com/codex/codex-sdk) |12| Control the agent loop in your application with reusable agents, tools, and handoffs | [Agents SDK](https://developers.openai.com/api/docs/guides/agents/quickstart) |
15| Call models directly or own the agent loop | [Responses API](https://developers.openai.com/api/docs/guides/migrate-to-responses) |13| Work directly with model responses and control your integration | [Responses API](https://developers.openai.com/api/docs/guides/migrate-to-responses) |
14| Add an embedded chat experience | [ChatKit](https://developers.openai.com/api/docs/guides/chatkit) |
16 15
17<a id="agents-sdk-vs-responses-api"></a>16<a id="agents-sdk-vs-responses-api"></a>
18 17
20 19
21## Compare agent runtime options20## Compare agent runtime options
22 21
23Choose based on what OpenAI manages and what your application needs to control.22| | Agents API | Agents SDK | Responses API |
23| ------------------------ | ------------------------------------------------------------------------------- | ------------------------------------------------------------------- | --------------------------------------------------------- |
24| **Use for** | Long-running tasks where OpenAI manages the agent and saves its progress | Building agents with custom tools and workflows in your application | Calling models directly or building an agent from scratch |
25| Where the agent runs | OpenAI runs a managed Codex harness | The SDK runs inside your application | Your application, with optional hosted orchestration |
26| Agent integration effort | Low | Medium | High |
27| State between tasks | Saved session configuration, turns, and items | Your storage and SDK sessions, or Responses conversation state | Manual history, response chaining, or Conversations |
28| Tool execution | Service-connected tools, application function handlers, and an optional sandbox | Tools and integrations configured in your application | Hosted tools and tools your application runs |
29| Execution environment | OpenAI hosted sandbox, self-hosted sandbox, or no sandbox | Your runtime and sandbox provider integrations | Your own execution environment |
30| Start here | [Agents API overview](https://developers.openai.com/api/docs/guides/agents-api/overview) | [Agents SDK overview](https://developers.openai.com/api/docs/guides/agents/sdk) | [Responses guide](https://developers.openai.com/api/docs/guides/migrate-to-responses) |
24 31
25| Option | What it manages | What you operate |32The Agents API runs the Codex harness and manages the underlying agent infrastructure so you can focus on what your agents do. It includes automatic context compaction, multi-agent orchestration, programmatic tool calling, and support for MCP servers. See [Architecture](https://developers.openai.com/api/docs/guides/agents-api/architecture).
26| --- | --- | --- |
27| **Agents API** | Hosted Codex harness, orchestration, and durable session state | Your application, tool integrations, and choice of execution environment |
28| **Codex SDK** | Codex harness running in your environment | The harness process, hosting, and application lifecycle |
29| **Responses API** | Model responses and configured hosted capabilities | Application logic and any agent loop you build around the API |
30 33
31Use the [Agents API architecture guide](https://developers.openai.com/api/docs/guides/agents-api/architecture) to understand the boundary between the hosted harness and your execution environment. For direct model integrations, the Responses API also offers hosted tools and state through response chaining or Conversations; follow its guides for the capabilities you use.34The Agents SDK gives your application control over deployment, storage, approvals, and runtime integration. Its runner handles the agent loop and handoffs. See [Running agents](https://developers.openai.com/api/docs/guides/agents/running-agents).
32 35
33 36
34 37
43- Read [Prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching) for shared caching behavior, then [Agents API observability and usage](https://developers.openai.com/api/docs/guides/agents-api/observability) for session accounting.46- Read [Prompt caching](https://developers.openai.com/api/docs/guides/prompt-caching) for shared caching behavior, then [Agents API observability and usage](https://developers.openai.com/api/docs/guides/agents-api/observability) for session accounting.
44 47
45An Agents API session, an SDK session, a Responses conversation, and a sandbox are different resources. Follow the state and cleanup instructions for the runtime you choose.48An Agents API session, an SDK session, a Responses conversation, and a sandbox are different resources. Follow the state and cleanup instructions for the runtime you choose.
46
47## If you use the Agents SDK
48
49The [Agents SDK](https://developers.openai.com/api/docs/guides/agents/sdk) is **feature complete**: major new features are not planned, but maintenance, security fixes, critical bug fixes, and compatibility work continue. You can continue using it for existing applications. See also: [SDK support policy](https://developers.openai.com/api/docs/guides/agents/sdk#important-notice).
50
51For new agent applications, start with the [Agents API](https://developers.openai.com/api/docs/guides/agents-api/quickstart).