{"id":3033,"date":"2026-09-11T05:43:59","date_gmt":"2026-09-11T05:43:59","guid":{"rendered":"https:\/\/dmarketertayeeb.com\/blog\/openai-agents-api-public-beta\/"},"modified":"2026-09-11T05:43:59","modified_gmt":"2026-09-11T05:43:59","slug":"openai-agents-api-public-beta","status":"publish","type":"post","link":"https:\/\/dmarketertayeeb.com\/blog\/openai-agents-api-public-beta\/","title":{"rendered":"OpenAI Agents API Public Beta: Session Code, Environments and Tool Controls"},"content":{"rendered":"\n<p><strong>OpenAI\u2019s Agents API is a public beta for running cloud agents with the Codex harness.<\/strong> The launch page shows a JavaScript session call that names an agent model, tools, vaults, an execution environment and input. It also describes OpenAI-hosted sandboxes, customer infrastructure and partner environments, with automatic compaction, tool search, programmatic tool calls and multi-agent support.<\/p>\n\n\n            \n\n<h2 class=\"wp-block-heading\">The published JavaScript shape<\/h2>\n\n\n            \n\n<p>This is the request shape OpenAI shows in its announcement. It is source-checked but unexecuted here; replace the placeholder vault and MCP values with resources that your project is authorised to use.<\/p>\n\n\n            \n\n<pre class=\"wp-block-code\"><code>import OpenAI from \"openai\";\n\nconst client = new OpenAI();\n\nconst session = await client.beta.agents.sessions.create({\n  agent: {\n    model: \"gpt-6-astra\",\n    tools: [{\n      type: \"mcp\",\n      server_label: \"observability\",\n      transport: {\n        type: \"http\",\n        server_url: \"https:\/\/observability.example.com\/mcp\"\n      }\n    }],\n    multi_agent: { enabled: true, max_concurrent_subagents: 3 }\n  },\n  vault_ids: [\"vault_YOUR_VAULT_ID\"],\n  environment: {\n    type: \"openai_hosted\",\n    capability_directories: [\"\/workspace\/capabilities\/skills\"]\n  },\n  input: \"Investigate the weekly campaign anomaly and save evidence.\"\n});<\/code><\/pre>\n\n\n            \n\n<p><strong>Test status:<\/strong> this code mirrors the official launch example and was not executed. The article does not invent a returned session schema or claim that the placeholder MCP server exists.<\/p>\n\n\n            \n\n<h2 class=\"wp-block-heading\">Choose the environment before choosing tools<\/h2>\n\n\n            \n\n<p>OpenAI says the agent can run in an OpenAI-managed sandbox, on a team\u2019s own infrastructure or through partner environments. That decision controls files, secrets, network access, compute, cold starts, cost and who can inspect artifacts. Write the environment decision before adding a tool.<\/p>\n\n\n            \n\n<ul class=\"wp-block-list\">\n              <li><strong>OpenAI hosted:<\/strong> fast start, managed sandbox and configurable files\/packages\/skills\/plugins.<\/li>\n              <li><strong>Your infrastructure or VPC:<\/strong> more control over data and network boundaries, with your own operational burden.<\/li>\n              <li><strong>Partner sandbox:<\/strong> a provider-specific compute, storage and secret model that needs its own review.<\/li>\n            <\/ul>\n\n\n            \n\n<h2 class=\"wp-block-heading\">Tool controls that matter<\/h2>\n\n\n            \n\n<p>The announcement names MCP, custom functions, web search, tool search and programmatic tool calls. Tool search can load relevant definitions when needed; programmatic calls can run and filter work in code. These features reduce context overhead but increase the importance of an allowlist.<\/p>\n\n\n            \n\n<ol class=\"wp-block-list\">\n              <li>Begin with read-only tools and a disposable environment.<\/li>\n              <li>Pin the MCP server URL, authentication method, allowed functions and data classes.<\/li>\n              <li>Store tool inputs and outputs with the task trace.<\/li>\n              <li>Require approval for email, Slack, deployment, campaign, CRM or file-write actions.<\/li>\n              <li>Test what happens when a tool is unavailable, returns partial data or asks for a secret.<\/li>\n            <\/ol>\n\n\n            \n\n<h2 class=\"wp-block-heading\">Compaction and subagents are not quality guarantees<\/h2>\n\n\n            \n\n<p>OpenAI says the harness automatically compacts earlier context as a session approaches its limit and can delegate to up to three concurrent subagents. Make the acceptance criteria, source list and final output path explicit so a compacted session can be checked. A subagent result is evidence to review, not an approval to publish or change a production system.<\/p>\n\n\n            \n\n<h2 class=\"wp-block-heading\">Pricing and beta boundary<\/h2>\n\n\n            \n\n<p>OpenAI says there is no additional Agents API fee; developers pay for the tokens and tools their agents use. That is not a fixed cost per task. Estimate model tokens, tool calls, environment time and human review from a representative run. The product is public beta, so pin versions where possible and keep a fallback path.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Write the preflight contract before adding tools<\/h2>\n\n\n\n<figure class=\"wp-block-table\"><table>\n  <thead><tr><th>Decision<\/th><th>Record<\/th><th>Why it is a release gate<\/th><\/tr><\/thead>\n  <tbody>\n    <tr><td>Environment<\/td><td>Hosted sandbox, own infrastructure or partner environment; files, network, secrets and owner<\/td><td>The same tool can have a different data boundary in each environment<\/td><\/tr>\n    <tr><td>Tool allowlist<\/td><td>MCP URL, functions, web search, auth method, read\/write scope and timeout<\/td><td>Tool search and programmatic calls can expand what the agent can reach<\/td><\/tr>\n    <tr><td>Task output<\/td><td>Acceptance criteria, evidence location, source list and final reviewer<\/td><td>Compaction must not erase what counts as a complete result<\/td><\/tr>\n    <tr><td>Delegation<\/td><td>Subagent purpose, maximum concurrency, handoff format and failure path<\/td><td>A subagent result is not an approval or a production change<\/td><\/tr>\n  <\/tbody>\n<\/table><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Test the beta with a bounded task<\/h2>\n\n\n\n<ol class=\"wp-block-list\">\n  <li>Use a read-only repository or disposable workspace and a question with a known answer.<\/li>\n  <li>Start with one tool. Save the request, tool definition, inputs, outputs and environment type.<\/li>\n  <li>Enable compaction or delegation only after the single-agent trace is understandable. Compare the final result with the same acceptance criteria.<\/li>\n  <li>Remove secrets and customer data from the first run. Add a write-capable tool only after the reviewer can explain the tool trace.<\/li>\n  <li>Estimate tokens, tool calls, environment time and human review from a representative run; the announcement does not establish a fixed per-task price.<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Failure modes that change the decision<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n  <li><strong>Wrong environment:<\/strong> a hosted sandbox may not have the private network or secret boundary expected by the task. Stop before adding a credential.<\/li>\n  <li><strong>Unpinned MCP endpoint:<\/strong> a server or function can change outside the agent prompt. Pin the URL, auth method and allowed operations.<\/li>\n  <li><strong>Compaction loss:<\/strong> a compacted session may omit an early constraint. Repeat the acceptance criteria in the final task and inspect the trace.<\/li>\n  <li><strong>Subagent drift:<\/strong> three parallel subagents can return inconsistent evidence. Define the handoff schema and require a final reviewer to reconcile it.<\/li>\n  <li><strong>Beta dependency:<\/strong> the public-beta surface can change. Keep a fallback script or manual path and record the package\/model version used.<\/li>\n<\/ul>\n\n\n\n<p>DMT\u2019s <a href=\"https:\/\/dmarketertayeeb.com\/blog\/ai-agent-harness-context-compaction\">agent-harness guide<\/a> owns context, state and evaluation controls. Its <a href=\"https:\/\/dmarketertayeeb.com\/blog\/chatgpt-work-scheduled-tasks-marketers\">scheduled-work governance guide<\/a> covers permissions and monitoring for recurring work. Use those pages for adjacent controls; this article owns the public-beta session API and environment\/tool choice.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">FAQ: questions readers ask<\/h2>\n\n\n<dl>\n  <dt><strong>Does the Agents API run only in OpenAI\u2019s sandbox?<\/strong><\/dt>\n  <dd>No. OpenAI describes OpenAI-hosted, customer-infrastructure and partner environments. The environment choice changes the operational and data boundary.<\/dd>\n  <dt><strong>How many subagents can the example use?<\/strong><\/dt>\n  <dd>OpenAI\u2019s announcement shows multi-agent support with a maximum of three concurrent subagents in the documented example.<\/dd>\n  <dt><strong>Is there an extra Agents API fee?<\/strong><\/dt>\n  <dd>OpenAI says there is no additional Agents API fee, but model tokens, tools, environment usage and human review still contribute to the task cost.<\/dd>\n<\/dl>\n\n\n<p><strong>Source note:<\/strong> Endpoint shape, model\/tools\/environment fields, hosted options, compaction, tool search, MCP\/functions\/web search, three-subagent example and pricing statement come from OpenAI\u2019s September 10 announcement. Code is illustrative and unexecuted.<\/p>\n\n\n\n<p><strong>Sources:<\/strong> <a href=\"https:\/\/openai.com\/index\/introducing-the-agents-api\/\">OpenAI Agents API announcement<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Map the OpenAI Agents API beta to session code, execution environments, tool controls, compaction, subagents and a bounded production test.<\/p>\n","protected":false},"author":1,"featured_media":3032,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[386,183,180],"tags":[196,319,396,315,400,296],"class_list":["post-3033","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ai-for-marketers","category-ai-in-marketing","category-ai-news","tag-ai-agents","tag-ai-workflows","tag-coding-agents","tag-developer-tools","tag-mcp","tag-openai","has-featured-image"],"_links":{"self":[{"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/posts\/3033","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/comments?post=3033"}],"version-history":[{"count":0,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/posts\/3033\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/media\/3032"}],"wp:attachment":[{"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/media?parent=3033"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/categories?post=3033"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dmarketertayeeb.com\/blog\/wp-json\/wp\/v2\/tags?post=3033"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}