Official Resources
Key Features
- Core Primitives: Agent, Runner, Session, Guardrail, and function_tool primitives for workflow orchestration and execution.
- Structured Output: Auto-schema generation via Pydantic (Python) and Zod (JavaScript/TypeScript) for type-safe agent responses.
- Streaming Support: Token-level streaming with stream=True (Python) or stream: true (JavaScript) for real-time interactions.
- Voice & WebRTC: FastAPI sample (Python) and RealtimeAgent (JS/TS) for browser and Node.js voice applications.
- Hosted Tools: WebSearch, FileSearch, CodeInterpreter tools available without OAuth setup.
- Tracing & Observability: Built-in tracing exporters for Logfire, AgentOps, Braintrust, Keywords AI with plug-in architecture.
- Session Management: SQLite, Redis, and custom session backends for conversation memory and state persistence.
Code Examples
Python Installation
bash
pip install openai-agents==0.1.4
# Requires: openai>=1.35, pydantic>=2.7, typing_extensions>=4.10
JavaScript Installation
bash
npm install @openai/agents@0.1.4 'zod@<=3.25.67'
# Requires: Node 22+, Deno 1.42+, Bun 1.1+
Simple Agent with Tracing (Python)
python
import os, asyncio
from agents import Agent, Runner, SQLiteSession, trace
os.environ["OPENAI_API_KEY"] = "sk-..."
@trace
async def main():
agent = Agent(
name="Coder",
instructions="Return concise Python.",
tools=[lambda n: list(range(0, n, 2))]
)
session = SQLiteSession("demo")
result = await Runner.run(agent, "Even numbers 0-10", session=session)
print(result.final_output) # [0, 2, 4, 6, 8, 10]
asyncio.run(main())
Agent Architecture (Python)
python
# Core Primitives
Agent(name: str, instructions: str, tools: list[Tool]=[],
handoffs: list[Agent]=[], guardrails: list[Guardrail]=[],
output_type: Type=None)
Runner.run(agent, input, session=None, max_turns=10, stream=False)
SQLiteSession(session_id: str, db_path: str=":memory:")
@function_tool # Auto-schema via Pydantic
@input_guardrail(func) / @output_guardrail(func)
Use Cases
- Multi-agent workflows with tool support and memory
- Customer service agents with handoff capabilities
- Voice-enabled applications with WebRTC integration
- Production agents with tracing and observability
- Structured output applications with type safety
Pros & Cons
Advantages
- Flexible model integration - OpenAI Responses API, Chat Completions, LiteLLM support
- Rich tool & memory support - Built-in and custom tools with conversational memory
- Production-ready features - Streaming, voice, tracing, guardrails
- Multi-language support - Python and JavaScript/TypeScript SDKs
- Active ecosystem - Coinbase AgentKit, AgentOps, DataCamp integrations
Disadvantages
- API volatility - Breaking changes possible in 0.1.x versions
- JavaScript/TypeScript maturity - TypeScript definitions still in preview
- No visual designer - CLI-only, no drag-and-drop interface
- Long-context limitations - Manual management via custom context required
Future Outlook & Integrations
- API Stabilization [Q3 2025]: v0.2.0 release targeting stable APIs with breaking change protection
- TypeScript Maturity [Q3 2025]: Full TypeScript definitions and improved JavaScript/TypeScript experience
- Visual Designer [Not Public]: Drag-and-drop interface for agent workflow design
- Long-Context Extensions [Future Extension]: Enhanced context management and memory handling capabilities