Agents SDK Fundamentals — The Agents SDK
Agents SDK Fundamentals
OpenAI's Agent Framework & Agents API
In 2026, OpenAI offers complementary paradigms for building agentic systems: the open-source self-hosted Agents SDK for Python (pip install openai-agents) and TypeScript/JavaScript (npm install @openai/agents), the fully managed OpenAI Agents API (launched in public beta on September 10, 2026 at /v1/agents), and developer coding harnesses like Codex CLI (npm install -g @openai/codex) and Codex Cloud.
September 10, 2026 Update: The OpenAI Agents API
While the Agents SDK runs inside your own application server and requires you to manage execution loops and local memory, the newly released Agents API exposes the core execution harness behind Codex as a managed cloud service:
- Managed Sandboxing: Safely executes code, tools, MCP servers, and computer actions in ephemeral micro-containers without exposing host infrastructure.
- Persistent Session State: Automatically stores multi-turn thread history and checkpoint states on OpenAI's infrastructure.
- Native Context Compaction: Transparently summarizes long-horizon conversations when approaching token limits without breaking tool continuity.
- Parallel Subagent Coordination: Spawns and supervises multiple worker subagents in parallel cloud threads.
Core Primitives (Agents SDK & API)
| Primitive | Purpose | Example |
|---|---|---|
| Agent | An LLM with instructions, tools, and MCP servers | A customer support agent |
| Handoff | Delegate to another agent | Triage → Billing Agent |
| Guardrail | Safety validation on input/output | Block PII, reject jailbreaks |
| Tracing | Observability for debugging | Visualize agent execution flow |
from agents import Agent, Runner
# Define a simple agent
support_agent = Agent(
name="Support Agent",
instructions="You are a helpful support agent. Answer questions about our product.",
model="gpt-6.1-sol"
)
# Run it
result = await Runner.run(support_agent, "How do I reset my password?")
print(result.final_output)
SOE & AOE Operational Runbook for OpenAI Agents
When running enterprise agent fleets, implement top Standard Operating Environment (SOE) and AI Operations Engineering (AOE) controls:
- SOE Standard: Enforce strict organization-level API keys (
OPENAI_API_KEY,OPENAI_ORG_ID), pin SDK dependencies (openai-agents >= 0.4.0in Python or@openai/agentsin TypeScript), enforce default developer messages for reasoning models, and configure zero-retention (ZDR) endpoints for enterprise data compliance. - AOE Architecture: Choose Agents API when you need zero-maintenance infrastructure, auto-scaling subagents, and managed cloud sandboxes; choose Agents SDK when you need strict on-prem/VPC residency, custom vector database stores, or offline tool evaluation. Always route user inputs through the free
omni-moderation-latestAPI before passing to the agent loop.
Provision the OpenAI Agents SDK and launch your first agent script - the two commands every agent project starts with.