OpenAI Agents SDK
OpenAI Agents SDK is an open-source development framework released by OpenAI for building agent-based applications. It provides developers with core capabilities for creating, orchestrating, and managing AI agents, supporting multi-agent collaboration, tool calling, conversation context management, and execution tracing. The framework is designed to simplify the development of autonomous task-planning and execution systems built on large language models.
Core Facts
OpenAI open-sourced the experimental framework Swarm in 2024, proposing a lightweight Agent-to-Agent handoff mechanism.
Major AI companies such as OpenAI and Anthropic all provide official Python-based SDKs.
OpenAI's Agent SDK takes a more engineering-oriented approach, natively supporting agent-to-agent hand-off mechanisms and built-in safety guardrails.
Timeline (last 90 days)
The OpenAI Agents SDK replaces OpenAI's previous experimental project Swarm, its core metaphor is handoffs, and it supports Python and TypeScript.
In the OpenAI Agents SDK, after a run ends, result.last_agent points to the agent that actually handled the request last, making it easy to reuse the correct agent instance when continuing the conversation after a handoff.
In the OpenAI Agents SDK, an agent in the tools list is converted into an ordinary tool via the agent.as_tool() method; when called, it starts an independent sub-run and returns only the final output string to the parent agent, and the parent run's conversation state is not inherited.
A guardrail itself is usually a lightweight agent that uses structured output to make a binary judgment, so it adds the overhead of one extra LLM call.
The OpenAI Agents SDK supports marking ordinary Python functions as tools via the @function_tool decorator and placing them in an Agent's tools list.
The Guardrail mechanism of the Agents SDK throws an InputGuardrailTripwireTriggered or OutputGuardrailTripwireTriggered exception when it determines a policy violation, immediately halting the agent's run rather than merely returning a warning.
SQLiteSession is the approach in the OpenAI Agents SDK for locally persisting session memory, and it does not depend on OpenAI servers.
agent.as_tool(tool_name=..., tool_description=...) can wrap a sub-agent as a tool; the difference from handoff is that handoff transfers control, whereas toolification keeps control with the main agent, which calls the sub-agent.
In the OpenAI Agents SDK, structured output can be obtained by using a structured output model (such as a Pydantic BaseModel) and setting the Agent's output_type, and the returned final_output is an instance of that type.
The OpenAI Agents SDK supports human-in-the-loop approval of sensitive operations via needs_approval=True; after running, interruptions appear in the result object, and state.approve or state.reject must be called to continue execution.
40 more timeline events
All Facts (20)
OpenAI open-sourced the experimental framework Swarm in 2024, proposing a lightweight Agent-to-Agent handoff mechanism.
80%VerifiedMajor AI companies such as OpenAI and Anthropic all provide official Python-based SDKs.
70%VerifiedOpenAI's Agent SDK takes a more engineering-oriented approach, natively supporting agent-to-agent hand-off mechanisms and built-in safety guardrails.
65%VerifiedAgent failure modes can be understood across three architectural layers: planning-layer failure, execution-layer failure, and reflection-layer failure, each with entirely different mitigation strategies.
65%VerifiedIn the tool-calling mechanism, developers attach a tool description list in JSON Schema format when calling the LLM API, and the model outputs call parameters in structured JSON format
65%VerifiedOpen Agent Builder natively supports the MCP protocol and can connect to existing MCP tool servers in the community.
65%VerifiedThe OpenAI Agents SDK's trace function supports adding custom metadata, which can be used to filter and analyze trace records.
65%VerifiedThe Agents SDK provides a trace function as a context manager, supporting two key parameters — workflow_name and group_id — for customizing traces.
65%VerifiedThe OpenAI Agents SDK's Runner does not automatically save and maintain conversation history; each call to Runner.run() is independent.
65%VerifiedThe instructions parameter in the OpenAI Agents SDK is essentially a system prompt, used to define the behavioral guidelines of the Agent.
65%VerifiedThe official OpenAI Python SDK released version v3.23.0, with enhanced Agents capabilities as the main theme.
90%UnverifiedOpenAI Agents SDK内置了WebSearchTool,可用于Agent的Web搜索功能
90%UnverifiedOpenAI Agents SDK使用to_input_list()方法将上一次的运行结果转换为可重新输入的格式,以实现对话历史的手动管理
90%Unverified2024-2025年,Anthropic Claude Agent SDK、OpenAI Agents SDK、Google ADK等Agent框架集中涌现
85%UnverifiedOpenAI Agents SDK支持gpt-4.1-nano和gpt-4.1-mini等模型
85%Unverifiedgroup_id的设计借鉴了分布式追踪领域的Trace Context标准(如W3C TraceContext),用于将相关追踪记录归为一组
70%UnverifiedThe OpenAI Agents SDK provides a Guardrails mechanism for intercepting inputs that should not enter the model and outputs that should not be returned to the user.
60%UnverifiedScriptedModel is a test helper class provided by the OpenAI Agents SDK that allows pre-defining static response sequences to drive Agent execution in place of a real LLM.
60%UnverifiedThe stateless design of the OpenAI Agents SDK contrasts with stateful frameworks such as LangChain's Memory module.
60%UnverifiedThe OpenAI Agents SDK defines five message types: Developer Message, User Message, Assistant Message, Function Call, and Function Call Output.
60%