Skip to main content

Agents SDK Fundamentals — The Agents SDK

[ ABORT TO HUD ]
SEQ. 1
SEQ. 2
SEQ. 3

Agents SDK Fundamentals

🤖 The Agents SDK 15 min 300 BASE XP⌨ HANDS-ON LAB

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)

PrimitivePurposeExample
AgentAn LLM with instructions, tools, and MCP serversA customer support agent
HandoffDelegate to another agentTriage → Billing Agent
GuardrailSafety validation on input/outputBlock PII, reject jailbreaks
TracingObservability for debuggingVisualize 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.0 in Python or @openai/agents in 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-latest API before passing to the agent loop.
⌨ HANDS-ON LABBootstrap the Agents SDK
⭐ +150 XP

Provision the OpenAI Agents SDK and launch your first agent script - the two commands every agent project starts with.

1Install the Agents SDK for Python with pip.
2Run your agent entry-point script with Python (file: hello_agent.py).
lab-sandbox — simulated environment
INFINITY LAB SANDBOX v2.6 — simulated shell
Type the command for the current objective. Helpers: "hint", "solution", "clear".
$
OBJECTIVE 1 / 2 — type "hint" if stuck
SYNAPSE VERIFICATION
QUERY 1 // 4
What framework did the Agents SDK replace?
LangChain
The experimental Swarm framework
AutoGPT
CrewAI