Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
O

openai-agents-python

> AI 编程
Open source

A lightweight, powerful framework for multi-agent workflows

28.3K stars0 likes1 views
WebsiteGitHub

About

A lightweight, powerful framework for multi-agent workflows

OpenAI Agents SDK

The OpenAI Agents SDK is a lightweight yet powerful framework for building multi-agent workflows. It is provider-agnostic, supporting the OpenAI Responses and Chat Completions APIs, as well as 100+ other LLMs.

[!NOTE] Looking for the JavaScript/TypeScript version? Check out Agents SDK JS/TS.

Core concepts:

  1. Agents: LLMs configured with instructions, tools, guardrails, and handoffs
  2. Sandbox agents: Agents preconfigured to work with a container to perform work over long time horizons.
  3. Realtime agents: Build powerful voice agents with gpt-realtime-2.1 and full agent features
  4. Voice agents: Build voice pipelines that combine speech-to-text, an agent workflow, and text-to-speech
  5. Agents as tools / Handoffs: Delegating to other agents for specific tasks
  6. Tools: Various Tools let agents take actions (functions, MCP, hosted tools)
  7. Guardrails: Configurable safety checks for input and output validation
  8. Human in the loop: Built-in mechanisms for involving humans across agent runs
  9. Sessions: Automatic conversation history management across agent runs
  10. Tracing: Built-in tracking of agent runs, allowing you to view, debug and optimize your workflows

Explore the examples directory to see the SDK in action, and read our documentation for more details.

Get started

To get started, set up your Python environment (Python 3.10 or newer required), and then install OpenAI Agents SDK package.

venv

bash
python -m venv .venv
source .venv/bin/activate  # On Windows: .venv\Scripts\activate
pip install openai-agents

For voice support, install with the optional voice group: pip install 'openai-agents[voice]'. For Redis session support, install with the optional redis group: pip install 'openai-agents[redis]'.

uv

If you're familiar with uv, installing the package would be even easier:

bash
uv init
uv add openai-agents

For voice support, install with the optional voice group: uv add 'openai-agents[voice]'. For Redis session support, install with the optional redis group: uv add 'openai-agents[redis]'.

Run your first agents

The SDK supports four primary ways to run agents. Set the OPENAI_API_KEY environment variable before running any of these examples.

Run a text agent

Use a text Agent for workflows that do not need a persistent realtime connection or a sandbox workspace.

python
from agents import Agent, Runner

agent = Agent(name="Assistant", instructions="You are a helpful assistant")

result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")
print(result.final_output)

# Code within the code,
# Functions calling themselves,
# Infinite loop's dance.

(For Jupyter notebook users, see hello_world_jupyter.ipynb)

Run a sandbox agent

Use a SandboxAgent when the agent needs to inspect files, run commands, apply patches, or preserve workspace state across longer tasks.

This example uses UnixLocalSandboxClient, which is supported on macOS and Linux. On Windows, use DockerSandboxClient with the openai-agents[docker] extra or a hosted sandbox client instead; see Sandbox clients for setup details.

…

Run a realtime agent

Use a RealtimeAgent for low-latency, server-side voice and multimodal experiences over WebSocket.

…

Run a voice agent

Use a VoicePipeline to turn audio into text, run an agent workflow, and stream generated speech.

…

Explore the examples directory to see the SDK in action, and read our documentation for more details.

Acknowledgements

We'd like to acknowledge the excellent work of the open-source community, especially:

  • Pydantic
  • Requests
  • MCP Python SDK
  • Griffe

This library has these optional dependencies:

  • websockets
  • SQLAlchemy
  • any-llm and LiteLLM

We also rely on the following tools to manage the project:

  • uv and ruff
  • mypy and Pyright
  • pytest and Coverage.py
  • MkDocs

We're committed to continuing to build the Agents SDK as an open source framework so others in the community can expand on our approach.

Issues· 18 open

View all issuesOpen on GitHub
  • #5257

    Nullable token counts still raise on three usage paths #5238 did not cover

    Updated Sep 30, 2026
  • #5254

    fix(schema): decode URI fragments before JSON Pointer traversal

    Updated Sep 30, 2026
  • #4827

    Deferred interrupted-turn session items are never persisted when an approval resume goes through next_step_run_again, leaving an orphaned function_call_output

    feature:sessionsUpdated Sep 28, 2026
  • #5180

    Sandbox: UnixLocal snapshots containing hardlinks fail to resume and leave the workspace empty

    Updated Sep 26, 2026
  • #5182

    A tool timeout that arrives after the task finished loses is_sdk_generated_error, so the SDK's own error message fails the output schema

    Updated Sep 26, 2026
  • #5183

    Feature request: calling x402-paywalled tools from an agent

    Updated Sep 26, 2026
  • #5181

    Responses streaming: the `error` event is not treated as terminal, so a teardown failure masks the provider's error

    Updated Sep 26, 2026
  • #5176

    SQLiteSession serves edited, replayed and re-owned rows as genuine history; get_items() never signals a changed store

    feature:sessionsUpdated Sep 25, 2026
  • #5162

    OpenAIResponsesCompactionSession: compacted items fail replay with "Unknown parameter: 'input[N].created_by'"

    Updated Sep 24, 2026
  • #5088

    Modal sandbox: evaluate native filesystem APIs and clarify overwrite compatibility

    enhancementfeature:extensionsfeature:sandboxesUpdated Sep 20, 2026

> Tags

Pythonagentsaiframeworkharness

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 30, 2026
CategoryAI 编程
PricingOpen source

> Related tools

G
GitHub Copilot
GitHub 官方 AI 编程助手,覆盖补全、Chat 与 Agent 模式。
C
Cursor
AI 原生代码编辑器,对话改代码、多文件 Agent 与规则体系是其核心。
S
skills
Skills for Real Engineers. Straight from my .agents directory.