(../../../../favicon.png) (https://cdn.openai.com) (../../../../../cdn.openai.com/common/fonts/openai-sans/v2/OpenAISans-Regular.woff2) (overview.html) Agents API | OpenAI API (https://developers.openai.com/sitemap-index.xml) (Agents API | OpenAI API) (https://developers.openai.com/rss.xml) (../../../../_astro/PageLayout.BfxM3FQy.css) (../../../../_astro/QuickstartSegmentedControl.DTPGatnq.css) (../../../../_astro/AgentDocsDirective.CUMME-gW.css) (../../../../_astro/Alert.Dl332ZUE.css) (../../../../_astro/Select.ZFNnOywo.css) (../../../../_astro/Button.Cu9_vjWu.css) For the complete documentation index, see (https://developers.openai.com/llms.txt) llms.txt . Markdown versions of documentation pages are available by appending .md to the page URL. (https://developers.openai.com/) (OpenAI Developers) ChatGPT (https://developers.openai.com/) Home (https://developers.openai.com/api/docs) API (https://learn.chatgpt.com/docs) Codex (https://learn.chatgpt.com/docs) Docs Guides, concepts, and product docs for Codex (https://learn.chatgpt.com/use-cases) Use cases Example workflows and tasks teams can take on with ChatGPT or Codex (https://developers.openai.com/codex) Docs (https://developers.openai.com/codex/use-cases) Use cases (https://developers.openai.com/training) Training (https://developers.openai.com/codex/resources) Resources (https://developers.openai.com/chatgpt) ChatGPT (https://developers.openai.com/plugins) Plugins Extend ChatGPT and Codex (https://developers.openai.com/workspace-agents) Workspace Agents Trigger published ChatGPT workspace agents (https://developers.openai.com/commerce) Commerce Build commerce flows in ChatGPT (https://developers.openai.com/ads) Ads Publish and measure ads in ChatGPT (https://developers.openai.com/learn) Resources (https://developers.openai.com/showcase) Showcase Demo apps to get inspired (https://developers.openai.com/blog) Blog Learnings and experiences from developers (https://developers.openai.com/cookbook) Cookbook Notebook examples for building with OpenAI models (https://developers.openai.com/learn) Learn Docs, videos, and demo apps for building with OpenAI (https://developers.openai.com/community) Community Programs, meetups, and support for builders Start searching (https://platform.openai.com/login) API Dashboard (https://chatgpt.com/) Try ChatGPT (https://developers.openai.com/api/docs) Overview (https://developers.openai.com/api/docs/models) Models (https://developers.openai.com/api/docs/guides/agents) Agents (https://developers.openai.com/api/docs/guides/tools) Tools (https://developers.openai.com/api/docs/guides/audio) Audio & voice (https://developers.openai.com/api/docs/guides/production-best-practices) Production (https://developers.openai.com/api/reference/overview) API reference Search the API docs Search docs (Start searching) () Suggested responses create reasoning_effort realtime prompt caching Primary navigation API Codex ChatGPT Docs Use cases Training Resources Resources Search docs (Start searching) () Suggested responses create reasoning_effort realtime prompt caching Overview Models Agents Tools Audio & voice Production API reference (mobile-nav-tab-1-variant-0) Overview (mobile-nav-tab-1-variant-1) Models (mobile-nav-tab-1-variant-2) Agents (mobile-nav-tab-1-variant-3) Tools (mobile-nav-tab-1-variant-4) Audio & voice (mobile-nav-tab-1-variant-5) Production (mobile-nav-tab-1-variant-6) API reference Docs Agents (https://developers.openai.com/api/docs) Home Get started (https://developers.openai.com/api/docs/quickstart) Quickstart (https://developers.openai.com/api/docs/guides/latest-model) Using GPT-6 Astra (https://developers.openai.com/api/docs/concepts) Key concepts Core concepts (https://developers.openai.com/api/docs/guides/migrate-to-responses) Responses API (https://developers.openai.com/api/docs/guides/conversation-state) Conversation state (https://developers.openai.com/api/docs/guides/background) Background mode (https://developers.openai.com/api/docs/guides/streaming-responses) Streaming (https://developers.openai.com/api/docs/guides/websocket-mode) WebSocket mode (https://developers.openai.com/api/docs/guides/steering) Mid-turn steering (https://developers.openai.com/api/docs/guides/responses-multi-agent) Multi-agent (https://developers.openai.com/api/docs/guides/webhooks) Webhooks (https://developers.openai.com/api/docs/guides/file-inputs) File inputs (https://developers.openai.com/api/docs/guides/compaction) Compaction (https://developers.openai.com/api/docs/guides/token-counting) Counting tokens SDKs and CLI (https://developers.openai.com/api/docs/libraries) OpenAI SDK (https://developers.openai.com/api/docs/libraries/openai-cli) OpenAI CLI Resources (https://developers.openai.com/api/docs/changelog) Changelog (https://developers.openai.com/api/docs/deprecations) Deprecations (https://developers.openai.com/api/docs/supported-countries) Supported countries (https://developers.openai.com/api/docs/bots) OpenAI Crawlers (https://openai.com/policies) Terms and policies Legacy APIs Agent Builder (https://developers.openai.com/api/docs/guides/agent-builder) Overview (https://developers.openai.com/api/docs/guides/agent-builder/migrate-from-agent-builder) Migration guide (https://developers.openai.com/api/docs/guides/node-reference) Node reference (https://developers.openai.com/api/docs/guides/agent-builder-safety) Safety in building agents Evals (https://developers.openai.com/api/docs/guides/evaluation-getting-started) Getting started (https://developers.openai.com/api/docs/guides/evals) Working with evals (https://developers.openai.com/api/docs/guides/prompt-optimizer) Prompt optimizer (https://developers.openai.com/api/docs/guides/external-models) External models (https://developers.openai.com/api/docs/guides/evaluation-best-practices) Best practices (https://developers.openai.com/api/docs/guides/graders) Graders Fine-tuning (https://developers.openai.com/api/docs/guides/model-optimization) Optimization cycle (https://developers.openai.com/api/docs/guides/supervised-fine-tuning) Supervised fine-tuning (https://developers.openai.com/api/docs/guides/vision-fine-tuning) Vision fine-tuning (https://developers.openai.com/api/docs/guides/direct-preference-optimization) Direct preference optimization (https://developers.openai.com/api/docs/guides/reinforcement-fine-tuning) Reinforcement fine-tuning (https://developers.openai.com/api/docs/guides/rft-use-cases) RFT use cases (https://developers.openai.com/api/docs/guides/fine-tuning-best-practices) Best practices Assistants API (https://developers.openai.com/api/docs/assistants/migration) Migration guide (https://developers.openai.com/api/docs/models) Model catalog Choose a model (https://developers.openai.com/api/docs/pricing) Pricing (https://developers.openai.com/api/docs/guides/model-selection) Model selection Text and code (https://developers.openai.com/api/docs/guides/text) Text generation (https://developers.openai.com/api/docs/guides/code-generation) Code generation (https://developers.openai.com/api/docs/guides/structured-outputs) Structured output Prompting (https://developers.openai.com/api/docs/guides/prompting) Overview (https://developers.openai.com/api/docs/guides/prompt-engineering) Prompt engineering (https://developers.openai.com/api/docs/guides/citation-formatting) Citation formatting (https://developers.openai.com/api/docs/guides/prompting/migrate-from-prompt-object) Migration guide (https://developers.openai.com/api/docs/guides/prompt-generation) Prompt generation (https://developers.openai.com/api/docs/guides/frontend-prompt) Frontend prompting Reasoning (https://developers.openai.com/api/docs/guides/reasoning) Reasoning models (https://developers.openai.com/api/docs/guides/reasoning-best-practices) Reasoning best practices Images and video (https://developers.openai.com/api/docs/guides/images-vision) Images and vision (https://developers.openai.com/api/docs/guides/image-cost-calculator) Image input cost calculator (https://developers.openai.com/api/docs/guides/image-generation) Image generation (https://developers.openai.com/api/docs/guides/image-generation) Overview (https://developers.openai.com/api/docs/guides/image-prompting) Image prompting (https://developers.openai.com/api/docs/guides/video-generation) Video generation Realtime and audio (https://developers.openai.com/api/docs/guides/audio) Audio and speech (https://developers.openai.com/api/docs/guides/realtime) Getting started (https://developers.openai.com/api/docs/guides/voice-agents) Voice agents Specialized models (https://developers.openai.com/api/docs/guides/deep-research) Deep research (https://developers.openai.com/api/docs/guides/embeddings) Embeddings (https://developers.openai.com/api/docs/guides/moderation) Moderation (https://developers.openai.com/api/docs/guides/agents) Overview Agents API (overview.html) Overview (https://developers.openai.com/api/docs/guides/agents-api/quickstart) Quickstart (https://developers.openai.com/api/docs/guides/agents-api/architecture) Architecture (https://developers.openai.com/api/docs/guides/agents-api/configuration) Configuring Agents Sessions (https://developers.openai.com/api/docs/guides/agents-api/sessions) Run and continue sessions (https://developers.openai.com/api/docs/guides/agents-api/sessions/events) Events and items (https://developers.openai.com/api/docs/guides/agents-api/sessions/manage) Manage sessions (https://developers.openai.com/api/docs/guides/agents-api/sessions/webhooks) Webhooks Environments and sandboxes (https://developers.openai.com/api/docs/guides/agents-api/environments/openai-hosted) OpenAI-hosted sandboxes (https://developers.openai.com/api/docs/guides/agents-api/environments/self-hosted) Self-hosted sandboxes (https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle) Sandbox lifecycle (https://developers.openai.com/api/docs/guides/agents-api/environments/security) Sandbox security (https://developers.openai.com/api/docs/guides/agents-api/environments/files) Files and artifacts Tools and integrations (https://developers.openai.com/api/docs/guides/agents-api/tools/web-search) Web search (https://developers.openai.com/api/docs/guides/agents-api/tools/functions) Functions (https://developers.openai.com/api/docs/guides/agents-api/tools/mcp) MCP connections (https://developers.openai.com/api/docs/guides/agents-api/tools/plugins) Plugins (https://developers.openai.com/api/docs/guides/agents-api/tools/vaults) Vaults (https://developers.openai.com/api/docs/guides/agents-api/multi-agent) Multi-agent (https://developers.openai.com/api/docs/guides/agents-api/observability) Observability and usage (https://developers.openai.com/api/docs/guides/agents-api/tracing) Tracing Agents SDK (https://developers.openai.com/api/docs/guides/agents/sdk) Overview (https://developers.openai.com/api/docs/guides/agents/quickstart) Quickstart (https://developers.openai.com/api/docs/guides/agents/define-agents) Agent definitions (https://developers.openai.com/api/docs/guides/agents/models) Models and providers (https://developers.openai.com/api/docs/guides/agents/running-agents) Running agents (https://developers.openai.com/api/docs/guides/agents/sandboxes) Sandbox agents (https://developers.openai.com/api/docs/guides/agents/orchestration) Orchestration (https://developers.openai.com/api/docs/guides/agents/guardrails-approvals) Guardrails (https://developers.openai.com/api/docs/guides/agents/results) Results and state (https://developers.openai.com/api/docs/guides/agents/integrations-observability) Integrations and observability (https://developers.openai.com/api/docs/guides/agent-evals) Evaluate agent workflows ChatKit (https://developers.openai.com/api/docs/guides/chatkit) Overview (https://developers.openai.com/api/docs/guides/chatkit-themes) Customize (https://developers.openai.com/api/docs/guides/chatkit-widgets) Widgets (https://developers.openai.com/api/docs/guides/chatkit-actions) Actions (https://developers.openai.com/api/docs/guides/custom-chatkit) Advanced integrations (https://developers.openai.com/api/docs/guides/tools) Overview (https://developers.openai.com/api/docs/guides/function-calling) Function calling Search and retrieval (https://developers.openai.com/api/docs/guides/tools-web-search) Web search (https://developers.openai.com/api/docs/guides/tools-file-search) File search (https://developers.openai.com/api/docs/guides/retrieval) Retrieval Connect tools and data (https://developers.openai.com/api/docs/guides/tools-connectors-mcp) MCP and Connectors (https://developers.openai.com/api/docs/guides/secure-mcp-tunnels) Secure MCP Tunnel Build tool workflows (https://developers.openai.com/api/docs/guides/tools-skills) Skills (https://developers.openai.com/api/docs/guides/tools-tool-search) Tool search (https://developers.openai.com/api/docs/guides/tools-programmatic-tool-calling) Programmatic tool calling (https://developers.openai.com/api/docs/guides/async-tool-calling) Async tool calling Computer and code (https://developers.openai.com/api/docs/guides/tools-shell) Shell (https://developers.openai.com/api/docs/guides/tools-computer-use) Computer use (https://developers.openai.com/api/docs/guides/tools-apply-patch) Apply Patch (https://developers.openai.com/api/docs/guides/tools-local-shell) Local shell (https://developers.openai.com/api/docs/guides/tools-code-interpreter) Code interpreter Media (https://developers.openai.com/api/docs/guides/tools-image-generation) Image generation (https://developers.openai.com/api/docs/guides/audio) Overview GPT-Live (https://developers.openai.com/api/docs/guides/live) Getting started (https://developers.openai.com/api/docs/guides/live-prompting) Prompting (https://developers.openai.com/api/docs/guides/live-conversations) Managing sessions (https://developers.openai.com/api/docs/guides/live-delegation) Delegation and tools (https://developers.openai.com/api/docs/guides/live-migration) Migrate to GPT-Live (https://developers.openai.com/api/docs/guides/live-partner-integrations) Partner integrations Realtime API (https://developers.openai.com/api/docs/guides/realtime) Getting started (https://developers.openai.com/api/docs/guides/voice-prompting) Prompting (https://developers.openai.com/api/docs/guides/realtime-conversations) Managing conversations (https://developers.openai.com/api/docs/guides/realtime-vad) Voice activity detection (https://developers.openai.com/api/docs/guides/realtime-mcp) Tools and MCP Build with voice (https://developers.openai.com/api/docs/guides/voice-agents) Voice agents (https://developers.openai.com/api/docs/guides/custom-voices) Custom voices (https://developers.openai.com/api/docs/guides/voice-latency-cost) Cost optimization Connections (https://developers.openai.com/api/docs/guides/voice-webrtc) WebRTC (https://developers.openai.com/api/docs/guides/voice-websockets) WebSockets (https://developers.openai.com/api/docs/guides/voice-sip) Telephony and SIP (https://developers.openai.com/api/docs/guides/voice-server-controls) Server-side controls Audio processing (https://developers.openai.com/api/docs/guides/speech-to-text) File transcription (https://developers.openai.com/api/docs/guides/realtime-transcription) Live transcription (https://developers.openai.com/api/docs/guides/realtime-translation) Live translation (https://developers.openai.com/api/docs/guides/text-to-speech) Text to speech (https://developers.openai.com/api/docs/guides/audio-chat-completions) Audio in Chat Completions Go live (https://developers.openai.com/api/docs/guides/production-best-practices) Production best practices (https://developers.openai.com/api/docs/guides/deployment-checklist) Deployment checklist Performance and quality (https://developers.openai.com/api/docs/guides/latency-optimization) Latency optimization (https://developers.openai.com/api/docs/guides/predicted-outputs) Predicted Outputs (https://developers.openai.com/api/docs/guides/fast-mode) Fast mode (https://developers.openai.com/api/docs/guides/optimizing-llm-accuracy) Accuracy optimization Cost and throughput (https://developers.openai.com/api/docs/guides/cost-optimization) Cost optimization (https://developers.openai.com/api/docs/guides/prompt-caching) Prompt caching (https://developers.openai.com/api/docs/guides/prompt-caching/diagnostics) Prompt cache diagnostics (https://developers.openai.com/api/docs/guides/batch) Batch (https://developers.openai.com/api/docs/guides/flex-processing) Flex processing Safety and governance (https://developers.openai.com/api/docs/guides/safety-best-practices) Safety best practices (https://developers.openai.com/api/docs/guides/red-teaming) Red teaming Safety checks (https://developers.openai.com/api/docs/guides/safety-checks) Safety classifiers (https://developers.openai.com/api/docs/guides/safety-checks/cybersecurity) Cybersecurity checks (https://developers.openai.com/api/docs/guides/safety-checks/misalignment-monitoring) Misalignment monitoring (https://developers.openai.com/api/docs/guides/safety-checks/under-18-api-guidance) Under-18 guidance (https://developers.openai.com/api/docs/guides/csam-guidance) CSAM guidance (https://developers.openai.com/api/docs/guides/content-provenance) Content provenance (https://developers.openai.com/api/docs/guides/your-data) Your data (https://developers.openai.com/api/docs/guides/rbac) Permissions Infrastructure and access (https://developers.openai.com/api/docs/guides/terraform) Terraform provider (https://developers.openai.com/api/docs/guides/terraform) Overview (https://developers.openai.com/api/docs/guides/terraform/projects-and-access) Projects and access (https://developers.openai.com/api/docs/guides/terraform/service-accounts) Service accounts (https://developers.openai.com/api/docs/guides/terraform/rate-limits-and-spend) Rate limits and spend (https://developers.openai.com/api/docs/guides/terraform/project-controls) Model, tool, and data controls (https://developers.openai.com/api/docs/guides/terraform/import-and-reconcile) Import and reconciliation (https://developers.openai.com/api/docs/guides/private-link) Private Link (https://developers.openai.com/api/docs/guides/ip-allowlist) IP allowlist (https://developers.openai.com/api/docs/guides/mutual-tls) Mutual TLS (https://developers.openai.com/api/docs/guides/workload-identity-federation) Workload identity federation (https://developers.openai.com/codex/enterprise/workload-identity) Codex setup (https://developers.openai.com/api/docs/guides/workload-identity-federation/federation-rules) Federation rules (https://developers.openai.com/api/docs/guides/workload-identity-federation/admin-api) Admin API (https://developers.openai.com/api/docs/guides/workload-identity-federation/x509) X.509 certificates (https://developers.openai.com/api/docs/guides/workload-identity-federation/kubernetes) Kubernetes (https://developers.openai.com/api/docs/guides/workload-identity-federation/aws) AWS (https://developers.openai.com/api/docs/guides/workload-identity-federation/microsoft-azure) Microsoft Azure (https://developers.openai.com/api/docs/guides/workload-identity-federation/google-cloud) Google Cloud (https://developers.openai.com/api/docs/guides/workload-identity-federation/oracle-cloud) Oracle Cloud Infrastructure (https://developers.openai.com/api/docs/guides/workload-identity-federation/github-actions) GitHub Actions (https://developers.openai.com/api/docs/guides/workload-identity-federation/spiffe) SPIFFE (https://developers.openai.com/api/docs/guides/ip-addresses) IP egress ranges (https://developers.openai.com/api/docs/guides/amazon-bedrock) Amazon Bedrock Operations (https://developers.openai.com/api/docs/guides/rate-limits) Rate limits (https://developers.openai.com/api/docs/guides/spend-limits) Spend limits (https://developers.openai.com/api/docs/guides/admin-apis) Admin APIs (https://developers.openai.com/api/docs/guides/error-codes) Error codes (https://learn.chatgpt.com/docs) Docs (https://learn.chatgpt.com/use-cases) Use cases (mobile-nav-tab-2-variant-0) Docs (mobile-nav-tab-2-variant-1) Use cases Docs Docs Plugins Workspace Agents Commerce Ads (mobile-nav-tab-7-variant-1) Plugins (mobile-nav-tab-7-variant-2) Workspace Agents (mobile-nav-tab-7-variant-3) Commerce (mobile-nav-tab-7-variant-4) Ads Docs Select... (https://developers.openai.com/plugins) Home (https://developers.openai.com/plugins/quickstart) Quickstart Core concepts (https://developers.openai.com/plugins/concepts/plugins) Plugin architecture (https://developers.openai.com/plugins/concepts/skills) Skills (https://developers.openai.com/plugins/concepts/mcp-server) MCP server Plan (https://developers.openai.com/plugins/plan/use-case) Brainstorm use cases (https://developers.openai.com/plugins/plan/tools) Define tools Build (https://developers.openai.com/plugins/build/mcp-server) Build an MCP server (https://developers.openai.com/plugins/build/chatgpt-ui) Add UI to your MCP server (optional) (https://developers.openai.com/plugins/build/auth) Authenticate users (https://developers.openai.com/plugins/build/skills) Build skills (https://developers.openai.com/plugins/build/plugins) Package your plugin (https://developers.openai.com/plugins/build/examples) Examples Test and publish (https://developers.openai.com/plugins/deploy/connect-chatgpt) Connect and test your plugin (https://developers.openai.com/plugins/deploy/submission) Submit and publish (https://developers.openai.com/plugins/deploy/submission-errors) Submission error reference Conversion specs (https://developers.openai.com/plugins/guides/restaurant-reservation-conversion-spec) Restaurant reservation spec (https://developers.openai.com/plugins/guides/local-services-request-quote-conversion-spec) Get Quote spec (https://developers.openai.com/plugins/guides/product-checkout-conversion-spec) Product checkout spec Guides (https://developers.openai.com/plugins/concepts/ui-guidelines) UI guidelines (https://developers.openai.com/plugins/guides/optimize-metadata) Optimize Metadata (https://developers.openai.com/plugins/guides/submit-claude-plugin) Submit a Claude Code plugin (https://developers.openai.com/plugins/guides/security-privacy) Security & Privacy (https://developers.openai.com/plugins/deploy/troubleshooting) Troubleshooting Resources (https://developers.openai.com/plugins/changelog) Changelog (https://developers.openai.com/plugins/app-guidelines) Plugin guidelines (https://developers.openai.com/plugins/deploy/app-review) MCP server review requirements (https://developers.openai.com/plugins/reference) Plugin UI reference (https://developers.openai.com/plugins/build/monetization) Checkout API reference (https://developers.openai.com/workspace-agents) Home Get started (https://developers.openai.com/workspace-agents/trigger-runs) Trigger workspace agent runs (https://developers.openai.com/workspace-agents/authentication) Authenticate with Workspace Agent access tokens (https://developers.openai.com/commerce) Home Guides (https://developers.openai.com/commerce/guides/get-started) Get started (https://developers.openai.com/commerce/guides/best-practices) Best practices File Upload (https://developers.openai.com/commerce/specs/file-upload/overview) Overview (https://developers.openai.com/commerce/specs/file-upload/products) Products API (https://developers.openai.com/commerce/specs/api/overview) Overview (https://developers.openai.com/commerce/specs/api/feeds) Feeds (https://developers.openai.com/commerce/specs/api/products) Products (https://developers.openai.com/commerce/specs/api/promotions) Promotions (https://developers.openai.com/ads) Ads Overview Measurement (https://developers.openai.com/ads/measurement-pixel) Measurement Pixel (https://developers.openai.com/ads/multiple-pixels) Multiple Pixels (Advanced) (https://developers.openai.com/ads/image-tag) Image Tag (https://developers.openai.com/ads/conversions-api) Conversions API (https://developers.openai.com/ads/supported-events) Supported Events Advertiser API (https://developers.openai.com/ads/api-overview) Overview (https://developers.openai.com/ads/api-partner-setup) API Partner Setup (https://developers.openai.com/ads/api-quickstart) Quickstart (https://developers.openai.com/ads/bulk-api) Bulk API (https://developers.openai.com/ads/product-feeds) Product Feeds (https://developers.openai.com/ads/delta-feeds) Delta Feeds API (https://developers.openai.com/ads/campaign-targeting) Campaign Targeting (https://developers.openai.com/ads/location-targeting) Location Targeting (https://developers.openai.com/ads/platform-targeting) Platform Targeting (https://developers.openai.com/ads/custom-audiences) Custom Audiences (https://developers.openai.com/ads/conversion-optimized-campaigns) Conversion-Optimized Campaigns API Reference (https://developers.openai.com/ads/api-reference/authentication) Authentication (https://developers.openai.com/ads/api-reference/ad-account) Ad Account (https://developers.openai.com/ads/api-reference/campaigns) Campaigns (https://developers.openai.com/ads/api-reference/ad-groups) Ad Groups (https://developers.openai.com/ads/api-reference/ads) Ads (https://developers.openai.com/ads/api-reference/insights) Insights (https://developers.openai.com/ads/api-reference/files) Files (https://developers.openai.com/ads/api-reference/conversion-setup) Conversion Setup Overview Features Configuration Developers Security Administration Use Cases Resources (mobile-nav-tab-3-variant-0) Overview (mobile-nav-tab-3-variant-1) Features (mobile-nav-tab-3-variant-2) Configuration (mobile-nav-tab-3-variant-3) Developers (mobile-nav-tab-3-variant-4) Security (mobile-nav-tab-3-variant-5) Administration (mobile-nav-tab-3-variant-6) Use Cases (mobile-nav-tab-3-variant-7) Resources Docs Overview (https://developers.openai.com/codex) Home Get started (https://developers.openai.com/codex/quickstart) Quickstart (https://developers.openai.com/codex/use-chatgpt) Use ChatGPT (https://developers.openai.com/codex/get-started-with-work) Get started with Work (https://developers.openai.com/codex/import) Import from another agent Foundations (https://developers.openai.com/codex/prompting) Prompting (https://developers.openai.com/codex/personalize) Personalize ChatGPT (https://developers.openai.com/codex/skills-and-plugins) Skills & Plugins (https://developers.openai.com/codex/permission-modes) Permissions Explore (https://developers.openai.com/codex/whats-new) What's new (https://developers.openai.com/codex/models) Models (https://developers.openai.com/codex/pricing) Pricing (https://developers.openai.com/codex/glossary) Glossary Available on (https://developers.openai.com/codex/app) ChatGPT desktop app (https://developers.openai.com/codex/remote) Remote (https://developers.openai.com/codex/web) ChatGPT on the web (https://developers.openai.com/codex/cli) Codex CLI (https://developers.openai.com/codex/ide) Codex IDE extension (https://developers.openai.com/codex/cloud) Codex cloud Releases (https://developers.openai.com/codex/changelog) Changelog (https://developers.openai.com/codex/feature-maturity) Feature Maturity (https://developers.openai.com/codex/open-source) Open Source (https://developers.openai.com/codex/features) Overview Workflows (https://developers.openai.com/codex/projects) Projects and chats (https://developers.openai.com/codex/sites) Sites (https://developers.openai.com/codex/visualizations) Visualizations (https://developers.openai.com/codex/automations) Scheduled tasks (https://developers.openai.com/codex/long-running-work) Long-running work (https://developers.openai.com/codex/notifications) Notifications (https://developers.openai.com/codex/pets) Pets (https://developers.openai.com/codex/features/codex-micro) Codex Micro Capabilities (https://developers.openai.com/codex/browser) Browser (https://developers.openai.com/codex/computer-use) Computer use (https://developers.openai.com/codex/features/voice) Voice (https://developers.openai.com/codex/plugins) Plugins (https://developers.openai.com/codex/web-search) Web search (https://developers.openai.com/codex/image-generation) Image generation (https://developers.openai.com/codex/image-inputs) Image inputs (https://developers.openai.com/codex/appshots) Appshots (https://developers.openai.com/codex/chrome-extension) Browser extension (https://developers.openai.com/codex/artifacts-viewer) Work with files Reference (https://developers.openai.com/codex/reference/commands) Commands (https://developers.openai.com/codex/reference/slash-commands) Slash commands (https://developers.openai.com/codex/reference/settings) Settings (https://developers.openai.com/codex/reference/troubleshooting) Troubleshooting (https://developers.openai.com/codex/configuration) Overview Customization (https://developers.openai.com/codex/customization/overview) Overview (https://developers.openai.com/codex/customization/memories) Memories (https://developers.openai.com/codex/customization/computer-history) Computer History Config file (https://developers.openai.com/codex/config-file/config-basic) Config Basics (https://developers.openai.com/codex/config-file/config-advanced) Advanced Config (https://developers.openai.com/codex/config-file/config-reference) Config Reference (https://developers.openai.com/codex/config-file/environment-variables) Environment Variables (https://developers.openai.com/codex/config-file/config-sample) Sample Config Agent configuration (https://developers.openai.com/codex/agent-configuration/agents-md) AGENTS.md (https://developers.openai.com/codex/agent-configuration/subagents) Subagents (https://developers.openai.com/codex/agent-configuration/speed) Speed (https://developers.openai.com/codex/agent-configuration/rules) Rules Extend ChatGPT and Codex (https://developers.openai.com/codex/extend/record-and-replay) Record & Replay (https://developers.openai.com/codex/extend/mcp) MCP Linux (https://developers.openai.com/codex/linux/linux-app) Desktop app Windows (https://developers.openai.com/codex/windows/windows-app) Desktop app (https://developers.openai.com/codex/windows/windows-sandbox) Windows sandbox (https://developers.openai.com/codex/windows/wsl) WSL (https://developers.openai.com/codex/developers) Overview Development workflows (https://developers.openai.com/codex/code-review) Code review (https://developers.openai.com/codex/integrated-terminal) Integrated terminal Extend and automate (https://developers.openai.com/codex/build-skills) Build skills (https://developers.openai.com/codex/build-plugins) Build plugins (https://developers.openai.com/codex/webmcp) Site tools (WebMCP) (https://developers.openai.com/codex/hooks) Hooks Environments (https://developers.openai.com/codex/environments/modes) Modes (https://developers.openai.com/codex/environments/local-environment) Local environments (https://developers.openai.com/codex/environments/cloud-environment) Cloud environment (https://developers.openai.com/codex/environments/git-worktrees) Git worktrees Build with Codex (https://developers.openai.com/codex/codex-sdk) Codex SDK (https://developers.openai.com/codex/app-server) App Server (https://developers.openai.com/codex/mcp-server) MCP Server (https://developers.openai.com/codex/github-action) GitHub Action (https://developers.openai.com/codex/non-interactive-mode) Non-interactive mode Third-party integrations (https://developers.openai.com/codex/third-party/github) GitHub (https://developers.openai.com/codex/third-party/gitlab) GitLab (Beta) (https://developers.openai.com/codex/third-party/slack) Slack (https://developers.openai.com/codex/third-party/linear) Linear Reference (https://developers.openai.com/codex/cli-customization) CLI customization (https://developers.openai.com/codex/developer-commands) Developer commands (https://developers.openai.com/codex/developer-settings) Developer settings (https://developers.openai.com/codex/security-administration) Overview Permissions (https://developers.openai.com/codex/permissions) Profiles (https://developers.openai.com/codex/sandboxing) Sandboxing (https://developers.openai.com/codex/sandboxing/auto-review) Auto-review (https://developers.openai.com/codex/agent-approvals-security) Agent approvals & security (https://developers.openai.com/codex/cloud/internet-access) Internet access Codex Security (https://developers.openai.com/codex/security) Overview Codex Security plugin (https://developers.openai.com/codex/security/plugin) Quickstart (https://developers.openai.com/codex/security/plugin/scans) Run a security scan (https://developers.openai.com/codex/security/plugin/deep-scans) Run a deep scan (https://developers.openai.com/codex/security/plugin/code-changes) Review code changes (https://developers.openai.com/codex/security/plugin/workbench) Use the Security workbench (https://developers.openai.com/codex/security/plugin/triage-backlog) Triage a backlog (https://developers.openai.com/codex/security/plugin/fix-findings) Fix findings (https://developers.openai.com/codex/security/plugin/security-hardening) Propose security hardening (https://developers.openai.com/codex/security/plugin/vulnerability-reports) Write vulnerability reports (https://developers.openai.com/codex/security/plugin/export-findings) Export and track findings (https://developers.openai.com/codex/security/plugin/changelog) Changelog Codex Security CLI (https://developers.openai.com/codex/security/cli) Quickstart (https://developers.openai.com/codex/security/cli/bulk-scans) Run bulk scans (https://developers.openai.com/codex/security/cli/ci) Run scans in CI (https://developers.openai.com/codex/security/cli/ci/gitlab) GitLab CI/CD (https://developers.openai.com/codex/security/cli/reference) Reference (https://developers.openai.com/codex/security/cli/faq) FAQ (https://developers.openai.com/codex/security/sdk) TypeScript SDK Codex Security cloud (https://developers.openai.com/codex/security/setup) Setup (https://developers.openai.com/codex/security/security-review) Security Review (https://developers.openai.com/codex/security/threat-model) Improving the threat model (https://developers.openai.com/codex/security/faq) FAQ Cyber safety (https://developers.openai.com/codex/cyber-safety) Models & Trusted Access (https://developers.openai.com/codex/cyber-safety/recommended-configuration) Recommended configuration (https://developers.openai.com/codex/administration) Overview Getting started (https://developers.openai.com/codex/enterprise/admin-setup) Admin rollout guide ChatGPT Work (https://developers.openai.com/codex/enterprise/chatgpt-work-overview) ChatGPT Work Overview (https://developers.openai.com/codex/enterprise/chatgpt-work-cloud-security) ChatGPT Work cloud security (https://developers.openai.com/codex/enterprise/chatgpt-work-local-security) ChatGPT Work local security (https://developers.openai.com/codex/enterprise/work-admin-faq) ChatGPT Work admin FAQ (https://developers.openai.com/codex/enterprise/chatgpt-work-usage-and-cost) ChatGPT Work: usage and cost Identity and authentication (https://developers.openai.com/codex/auth) Authentication overview (https://developers.openai.com/codex/enterprise/workload-identity) Workload identity (https://developers.openai.com/codex/enterprise/access-tokens) Personal Access Tokens (https://developers.openai.com/codex/enterprise/service-accounts) Service accounts Workspace access, policy, and models (https://developers.openai.com/codex/enterprise/groups-and-provisioning) Groups and provisioning (https://developers.openai.com/codex/enterprise/user-lifecycle) User lifecycle management (https://developers.openai.com/codex/enterprise/roles-and-workspace-permissions) Roles and workspace permissions (https://developers.openai.com/codex/enterprise/gpts-and-sharing) GPTs and Sharing (https://developers.openai.com/codex/enterprise/managed-configuration) Managed configuration (https://developers.openai.com/codex/enterprise/prisma-airs) Prisma AIRS (https://developers.openai.com/codex/hipaa-configuration) HIPAA configuration (https://developers.openai.com/codex/enterprise/workspace-model-availability) Workspace model availability Plugin and connector controls (https://developers.openai.com/codex/enterprise/apps-and-connectors) Plugin controls (https://developers.openai.com/codex/enterprise/plugin-management) Plugin management (https://developers.openai.com/codex/enterprise/skills) Skill controls Usage, governance, and compliance (https://developers.openai.com/codex/enterprise/governance) Governance (https://developers.openai.com/codex/enterprise/admin-plugin) Admin plugin (https://developers.openai.com/codex/enterprise/workspace-analytics) Workspace analytics (https://developers.openai.com/codex/enterprise/analytics-api) Analytics API (https://developers.openai.com/codex/enterprise/compliance-api) Compliance API and audit events Deployment and model providers (https://developers.openai.com/codex/enterprise/manage-app-updates) Manage app updates (https://developers.openai.com/codex/enterprise/windows-deployment) Windows app deployment (https://developers.openai.com/codex/remote-connections) Remote connections (https://developers.openai.com/codex/amazon-bedrock) Amazon Bedrock (https://developers.openai.com/codex/use-cases) Explore use cases (https://developers.openai.com/codex/use-cases/collections) Collections (https://developers.openai.com/codex/resources) Home (https://developers.openai.com/codex/videos) Videos (https://developers.openai.com/showcase) Showcase (https://openai.com/academy/) OpenAI Academy (https://academy.openai.com/home/events) Online trainings Community (https://developers.openai.com/community/codex-ambassadors) Codex Ambassadors (https://developers.openai.com/community/students) Codex for Students (https://developers.openai.com/community/codex-for-oss) Codex for Open Source (https://developers.openai.com/community/meetups) Meetups Blog (https://openai.com/news/) Company blog (https://developers.openai.com/blog) Developer blog (https://developers.openai.com/codex/use-cases) Explore use cases (https://developers.openai.com/codex/use-cases/collections) Collections (https://developers.openai.com/codex/resources) Home (https://developers.openai.com/codex/videos) Videos (https://developers.openai.com/showcase) Showcase (https://openai.com/academy/) OpenAI Academy (https://academy.openai.com/home/events) Online trainings Community (https://developers.openai.com/community/codex-ambassadors) Codex Ambassadors (https://developers.openai.com/community/students) Codex for Students (https://developers.openai.com/community/codex-for-oss) Codex for Open Source (https://developers.openai.com/community/meetups) Meetups Blog (https://openai.com/news/) Company blog (https://developers.openai.com/blog) Developer blog (https://developers.openai.com/showcase) Showcase Blog Cookbook Learn Community (mobile-nav-tab-8-variant-1) Showcase (mobile-nav-tab-8-variant-2) Blog (mobile-nav-tab-8-variant-3) Cookbook (mobile-nav-tab-8-variant-4) Learn (mobile-nav-tab-8-variant-5) Community Docs Select... (https://developers.openai.com/blog) All posts Recent (https://developers.openai.com/blog/architectural-visualization-with-astra) Architectural visualization with Astra (https://developers.openai.com/blog/how-to-build-games-with-astra) Building games with Astra (https://developers.openai.com/blog/rosalind-workbench) Meet Rosalind Workbench: Empowering every scientist to be their own research team (https://developers.openai.com/blog/automating-repetitive-work-at-openai-with-codex) Automating repetitive work at OpenAI with Codex (https://developers.openai.com/blog/build-week-winners) Meet the winners of OpenAI Build Week Topics (https://developers.openai.com/blog/topic/general) General (https://developers.openai.com/blog/topic/api) API (https://developers.openai.com/blog/topic/apps-sdk) Apps SDK (https://developers.openai.com/blog/topic/audio) Audio (https://developers.openai.com/blog/topic/codex) Codex (https://developers.openai.com/blog/topic/life-sciences) Life sciences (https://developers.openai.com/cookbook) Home Topics (https://developers.openai.com/cookbook/topic/agents) Agents (https://developers.openai.com/cookbook/topic/evals) Evals (https://developers.openai.com/cookbook/topic/multimodal) Multimodal (https://developers.openai.com/cookbook/topic/text) Text (https://developers.openai.com/cookbook/topic/guardrails) Guardrails (https://developers.openai.com/cookbook/topic/optimization) Optimization (https://developers.openai.com/cookbook/topic/chatgpt) ChatGPT (https://developers.openai.com/cookbook/topic/codex) Codex (https://developers.openai.com/cookbook/topic/gpt-oss) gpt-oss Contribute (https://github.com/openai/openai-cookbook) Cookbook on GitHub (https://developers.openai.com/learn) Home (https://developers.openai.com/learn/developers-codex-plugin) OpenAI Developers plugin (https://developers.openai.com/learn/docs-mcp) Docs MCP Categories (https://developers.openai.com/learn/code) Demo apps (https://developers.openai.com/learn/videos) Videos Topics (https://developers.openai.com/learn/agents) Agents (https://developers.openai.com/learn/audio) Audio & Voice (https://developers.openai.com/learn/cua) Computer Use (https://developers.openai.com/learn/codex) Codex (https://developers.openai.com/learn/evals) Evals (https://developers.openai.com/learn/gpt-oss) gpt-oss (https://developers.openai.com/learn/fine-tuning) Fine-tuning (https://developers.openai.com/learn/imagegen) Image generation (https://developers.openai.com/learn/scaling) Scaling (https://developers.openai.com/learn/tools) Tools (https://developers.openai.com/learn/videogen) Video generation (https://developers.openai.com/community) Community Programs (https://developers.openai.com/community/codex-ambassadors) Codex Ambassadors (https://developers.openai.com/community/students) Codex for Students (https://developers.openai.com/community/codex-for-oss) Codex for Open Source (https://openai.com/business/why-openai/startups/) OpenAI for Startups Events (https://developers.openai.com/community/meetups) Meetups Spaces (https://community.openai.com/) Developer Forum (https://discord.com/invite/openai) Discord (https://www.reddit.com/r/OpenAI/) Reddit (https://x.com/OpenAIDevs) X (https://platform.openai.com/login) API Dashboard (https://chatgpt.com/) Try ChatGPT (https://developers.openai.com/api/docs/guides/agents) Overview Agents API (overview.html) Overview (https://developers.openai.com/api/docs/guides/agents-api/quickstart) Quickstart (https://developers.openai.com/api/docs/guides/agents-api/architecture) Architecture (https://developers.openai.com/api/docs/guides/agents-api/configuration) Configuring Agents Sessions (https://developers.openai.com/api/docs/guides/agents-api/sessions) Run and continue sessions (https://developers.openai.com/api/docs/guides/agents-api/sessions/events) Events and items (https://developers.openai.com/api/docs/guides/agents-api/sessions/manage) Manage sessions (https://developers.openai.com/api/docs/guides/agents-api/sessions/webhooks) Webhooks Environments and sandboxes (https://developers.openai.com/api/docs/guides/agents-api/environments/openai-hosted) OpenAI-hosted sandboxes (https://developers.openai.com/api/docs/guides/agents-api/environments/self-hosted) Self-hosted sandboxes (https://developers.openai.com/api/docs/guides/agents-api/environments/lifecycle) Sandbox lifecycle (https://developers.openai.com/api/docs/guides/agents-api/environments/security) Sandbox security (https://developers.openai.com/api/docs/guides/agents-api/environments/files) Files and artifacts Tools and integrations (https://developers.openai.com/api/docs/guides/agents-api/tools/web-search) Web search (https://developers.openai.com/api/docs/guides/agents-api/tools/functions) Functions (https://developers.openai.com/api/docs/guides/agents-api/tools/mcp) MCP connections (https://developers.openai.com/api/docs/guides/agents-api/tools/plugins) Plugins (https://developers.openai.com/api/docs/guides/agents-api/tools/vaults) Vaults (https://developers.openai.com/api/docs/guides/agents-api/multi-agent) Multi-agent (https://developers.openai.com/api/docs/guides/agents-api/observability) Observability and usage (https://developers.openai.com/api/docs/guides/agents-api/tracing) Tracing Agents SDK (https://developers.openai.com/api/docs/guides/agents/sdk) Overview (https://developers.openai.com/api/docs/guides/agents/quickstart) Quickstart (https://developers.openai.com/api/docs/guides/agents/define-agents) Agent definitions (https://developers.openai.com/api/docs/guides/agents/models) Models and providers (https://developers.openai.com/api/docs/guides/agents/running-agents) Running agents (https://developers.openai.com/api/docs/guides/agents/sandboxes) Sandbox agents (https://developers.openai.com/api/docs/guides/agents/orchestration) Orchestration (https://developers.openai.com/api/docs/guides/agents/guardrails-approvals) Guardrails (https://developers.openai.com/api/docs/guides/agents/results) Results and state (https://developers.openai.com/api/docs/guides/agents/integrations-observability) Integrations and observability (https://developers.openai.com/api/docs/guides/agent-evals) Evaluate agent workflows ChatKit (https://developers.openai.com/api/docs/guides/chatkit) Overview (https://developers.openai.com/api/docs/guides/chatkit-themes) Customize (https://developers.openai.com/api/docs/guides/chatkit-widgets) Widgets (https://developers.openai.com/api/docs/guides/chatkit-actions) Actions (https://developers.openai.com/api/docs/guides/custom-chatkit) Advanced integrations Copy Page Agents API Build durable cloud agents with a managed Codex harness. Copy Page The Agents API gives your application access to the Codex harness through an OpenAI-managed API. OpenAI manages sessions, orchestration, context compaction, and recovery while your application provides tools and chooses its execution environment. Agents can operate in a sandbox where they can execute code, edit files, connect to MCP servers, and produce artifacts. Pricing (Copy link to pricing) Model usage is billed at the selected model’s (https://developers.openai.com/api/docs/pricing) API rates . OpenAI tools use their (https://developers.openai.com/api/docs/pricing#built-in-tools) standard rates , and OpenAI-hosted sandboxes use standard (https://developers.openai.com/api/docs/pricing#built-in-tools) container rates . Try an example (Copy link to try an example) Try these complete examples: (https://developers.openai.com/api/docs/guides/agents-api/quickstart#1-run-a-task) Create and run a directory-tree script in an OpenAI-hosted sandbox. (https://developers.openai.com/api/docs/guides/agents-api/multi-agent#example-compare-release-notes) Compare release notes with subagents and combine their findings into one answer. Explore complete applications: (https://developers.openai.com/showcase/agents-api-sev-bot) Incident response agent : investigate alerts and request approval for recovery actions. (https://developers.openai.com/showcase/agents-api-slack-bot) Slack bot : investigate requests using connected workplace tools. (https://developers.openai.com/showcase/agents-api-data-analyst) Data analyst : answer warehouse questions with read-only SQL. (https://developers.openai.com/showcase/agents-api-github-issues) GitHub issue investigator : reproduce reported bugs and share findings on GitHub. (https://developers.openai.com/showcase/agents-api-document-review) Document reviewer : review documents with policy skills and specialist agents. Core concepts (Copy link to core concepts) The Agents API is built around four main concepts: Agent: The model, instructions, tools, and MCP servers available to the agent. Environment: An optional sandbox or computer where the agent accesses files, loads skills, and runs commands. Session: A durable instance of an agent that works on tasks and responds to input. Events and items: The inputs sent to an agent and the output produced during a session. A session from start to finish (Copy link to a session from start to finish) Start with an OpenAI-hosted sandbox in the (https://developers.openai.com/api/docs/guides/agents-api/quickstart) quickstart : Create a session. Configure the agent; OpenAI provisions its environment. Give it a task. User input starts a turn of work once the environment is ready. Follow progress. Stream output or use webhooks to learn when the agent finishes or needs input. Continue or steer. Send another task to the same session, or guide the agent during its current turn. With an OpenAI-hosted session, your application sends input and receives events, while OpenAI runs the agent and provisions and manages its sandbox. See (https://developers.openai.com/api/docs/guides/agents-api/configuration#environment-settings) environment options for setup and limitations. (Your application starts sessions and receives events and output from the Agents API. OpenAI runs the managed Codex harness and provisions and manages its sandbox.) What the managed harness provides (Copy link to what the managed harness provides) The managed Codex harness supports: Running commands and code in a sandbox. Applying relevant skills and instructions. Connecting to external data through tools or MCP. Steering the agent while it works. Summarizing previous work to manage its context window. Breaking work into subtasks and delegating to subagents. Resuming a session where it left off. Check the (https://developers.openai.com/api/docs/guides/agents-api/quickstart#prerequisites) quickstart prerequisites for API-key permissions and SDK setup. Configure these capabilities when you create a session: Configure managed-harness capabilities Python 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 import OpenAI from "openai"; const client = new OpenAI(); const session = await client.beta.agents.sessions.create({ agent: { model: "gpt-6-astra", instructions: "Use the OpenAI documentation MCP and web search to answer technical questions accurately. Delegate independent research tasks to subagents when useful.", tools: [ { type: "programmatic_tool_calling" }, { type: "mcp", server_label: "openai_docs", transport: { type: "http", server_url: "https://developers.openai.com/mcp", }, }, { type: "web_search" }, ], multi_agent: { enabled: true, max_concurrent_subagents: 4 }, }, environment: { type: "self_hosted", workspace_directory: "/workspace", capability_directories: ["/workspace/capabilities/skills"], }, input: [ { role: "user", content: [ { type: "input_text", text: "Research how to connect an MCP server to an OpenAI agent, check for recent updates, and summarize the recommended setup.", }, ], }, ], }); console.log(session.id); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 from openai import OpenAI client = OpenAI() session = client.beta.agents.sessions.create( agent = { "model" : "gpt-6-astra" , "instructions" : "Use the OpenAI documentation MCP and web search to answer technical questions accurately. Delegate independent research tasks to subagents when useful." , "tools" : [ { "type" : "programmatic_tool_calling" }, { "type" : "mcp" , "server_label" : "openai_docs" , "transport" : { "type" : "http" , "server_url" : "https://developers.openai.com/mcp" , }, }, { "type" : "web_search" }, ], "multi_agent" : { "enabled" : True , "max_concurrent_subagents" : 4 }, }, environment = { "type" : "self_hosted" , "workspace_directory" : "/workspace" , "capability_directories" : [ "/workspace/capabilities/skills" ], }, input = [ { "role" : "user" , "content" : [ { "type" : "input_text" , "text" : "Research how to connect an MCP server to an OpenAI agent, check for recent updates, and summarize the recommended setup." , } ], } ], ) print (session.id) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import ( "context" "fmt" "github.com/openai/openai-go/v3" ) ctx := context.Background() client := openai.NewClient() session, err := client.Beta.Agents.Sessions.New(ctx, openai.BetaAgentSessionNewParams{Agent: openai.BetaAgentSessionNewParamsAgent{Model: openai.String("gpt-6-astra"), Instructions: openai.String("Use the OpenAI documentation MCP and web search to answer technical questions accurately. Delegate independent research tasks to subagents when useful."), Tools: []openai.AgentToolParamUnion{openai.AgentToolParamUnion{OfParamProgrammaticToolCalling: &openai.AgentToolParamProgrammaticToolCalling{}}, openai.AgentToolParamUnion{OfParamMcp: &openai.AgentToolParamMcp{ServerLabel: "openai_docs", Transport: openai.McpTransportParamUnion{OfParamHTTP: &openai.McpTransportParamHTTP{ServerURL: "https://developers.openai.com/mcp"}}}}, openai.AgentToolParamUnion{OfParamWebSearch: &openai.AgentToolParamWebSearch{}}}, MultiAgent: openai.MultiAgentConfigParam{Enabled: true, MaxConcurrentSubagents: openai.Int(4)}}, Environment: openai.EnvironmentParamUnion{OfParamSelfHosted: &openai.EnvironmentParamSelfHosted{WorkspaceDirectory: "/workspace", CapabilityDirectories: []string{"/workspace/capabilities/skills"}}}, Input: openai.BetaAgentSessionNewParamsInputUnion{OfArrayOfInputMessages: []openai.AgentSessionInputMessageParam{openai.AgentSessionInputMessageParam{Content: []openai.InputContentParamUnion{openai.InputContentParamUnion{OfParamInputText: &openai.InputContentParamInputText{Text: "Research how to connect an MCP server to an OpenAI agent, check for recent updates, and summarize the recommended setup."}}}}}}}) if err != nil { panic(err) } fmt.Println(session.ID) 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 import com.openai.client.OpenAIClient; import com.openai.client.okhttp.OpenAIOkHttpClient; import com.openai.models.beta.agents.AgentToolParam; import com.openai.models.beta.agents.EnvironmentParam; import com.openai.models.beta.agents.McpTransportParam; import com.openai.models.beta.agents.MultiAgentConfigParam; import com.openai.models.beta.agents.sessions.SessionCreateParams; import java.util.List; OpenAIClient client = OpenAIOkHttpClient.fromEnv(); var session = client .beta() .agents() .sessions() .create( SessionCreateParams.builder() .agent( SessionCreateParams.Agent.builder() .model("gpt-6-astra") .instructions( "Use the OpenAI documentation MCP and web search to answer" + " technical questions accurately. Delegate independent" + " research tasks to subagents when useful.") .addTool(AgentToolParam.ProgrammaticToolCalling.builder().build()) .addTool( AgentToolParam.Mcp.builder() .serverLabel("openai_docs") .transport( McpTransportParam.Http.builder() .serverUrl("https://developers.openai.com/mcp") .build()) .build()) .addTool(AgentToolParam.WebSearch.builder().build()) .multiAgent( MultiAgentConfigParam.builder() .enabled(true) .maxConcurrentSubagents(4L) .build()) .build()) .environment( EnvironmentParam.SelfHosted.builder() .workspaceDirectory("/workspace") .capabilityDirectories(List.of("/workspace/capabilities/skills")) .build()) .input( "Research how to connect an MCP server to an OpenAI agent, check for recent" + " updates, and summarize the recommended setup.") .build()); System.out.println(session.id()); 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 require "openai" client = OpenAI::Client.new session = client.beta.agents.sessions.create(agent: {model: "gpt-6-astra", instructions: "Use the OpenAI documentation MCP and web search to answer technical questions accurately. Delegate independent research tasks to subagents when useful.", tools: [{type: "programmatic_tool_calling"}, {type: "mcp", server_label: "openai_docs", transport: {type: "http", server_url: "https://developers.openai.com/mcp"}}, {type: "web_search"}], multi_agent: {enabled: true, max_concurrent_subagents: 4}}, environment: {type: "self_hosted", workspace_directory: "/workspace", capability_directories: ["/workspace/capabilities/skills"]}, input: [{role: "user", content: [{type: "input_text", text: "Research how to connect an MCP server to an OpenAI agent, check for recent updates, and summarize the recommended setup."}]}]) puts session.id 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 curl -sS -X POST "https://api.openai.com/v1/agents/sessions" \ -H "OpenAI-Beta: agents=v1" \ -H "Authorization: Bearer $OPENAI_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "agent": { "model": "gpt-6-astra", "instructions": "Use the OpenAI documentation MCP and web search to answer technical questions accurately. Delegate independent research tasks to subagents when useful.", "tools": [ { "type": "programmatic_tool_calling" }, { "type": "mcp", "server_label": "openai_docs", "transport": { "type": "http", "server_url": "https://developers.openai.com/mcp" } }, { "type": "web_search" } ], "multi_agent": { "enabled": true, "max_concurrent_subagents": 4 } }, "environment": { "type": "self_hosted", "workspace_directory": "/workspace", "capability_directories": ["/workspace/capabilities/skills"] }, "input": [ { "role": "user", "content": [ { "type": "input_text", "text": "Research how to connect an MCP server to an OpenAI agent, check for recent updates, and summarize the recommended setup." } ] } ] }' For a runtime comparison, see the (https://developers.openai.com/api/docs/guides/agents#compare-agent-runtimes) Agents overview . The Agents API retains session state so you can continue work across turns without rebuilding the conversation context. You can delete sessions and published artifacts when you no longer need them. The Agents API currently supports data residency only in the United States and does not support Zero Data Retention (ZDR). Choosing a self-hosted sandbox does not make the Agents API ZDR-eligible. See (https://developers.openai.com/api/docs/guides/your-data#storage-requirements-and-retention-controls-per-endpoint) Data controls in the OpenAI platform for details on data residency and retention. (https://developers.openai.com/api/docs/guides/agents-api/quickstart) Next Quickstart Ask AI Docs agent (Start a new chat) Loading docs agent...