openai/openai-agents-python — công cụ AI — đang có 30.1k sao GitHub trong nhóm AI Tools. A lightweight, powerful framework for multi-agent workflows
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
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:
Agents: LLMs configured with instructions, tools, guardrails, and handoffs
Sandbox agents: Agents preconfigured to work with a container to perform work over long time horizons.
Realtime agents: Build powerful voice agents with gpt-realtime-2.1 and full agent features
Voice agents: Build voice pipelines that combine speech-to-text, an agent workflow, and text-to-speech
Agents as tools / Handoffs: Delegating to other agents for specific tasks
Tools: Various Tools let agents take actions (functions, MCP, hosted tools)
Guardrails: Configurable safety checks for input and output validation
Human in the loop: Built-in mechanisms for involving humans across agent runs
Sessions: Automatic conversation history management across agent runs
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.
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:
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.
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.
from agents import Runner
from agents.run import RunConfig
from agents.sandbox import Manifest, SandboxAgent, SandboxRunConfig
from agents.sandbox.entries import GitRepo
from agents.sandbox.sandboxes import UnixLocalSandboxClient
agent = SandboxAgent(
name="Workspace Assistant",
instructions="Inspect the sandbox workspace before answering.",
default_manifest=Manifest(
entries={"repo": GitRepo(repo="openai/openai-agents-python", ref="main")}
),
)
result = Runner.run_sync(
agent,
"Inspect the repo README and summarize what this project does.",
run_config=RunConfig(sandbox=SandboxRunConfig(client=UnixLocalSandboxClient())),
)
print(result.final_output)
Run a realtime agent
Use a RealtimeAgent for low-latency, server-side voice and multimodal experiences over WebSocket.
import asyncio
from agents.realtime import RealtimeAgent, RealtimeRunner
async def main() -> None:
agent = RealtimeAgent(
name="Assistant", instructions="You are a helpful voice assistant. Keep responses short."
)
runner = RealtimeRunner(starting_agent=agent)
session = await runner.run()
async with session:
await session.send_message("Say hello in one short sentence.")
async for event in session:
if event.type == "audio":
# Forward or play event.audio.data.
pass
elif event.type == "history_added":
print(event.item)
elif event.type == "agent_end":
break
if __name__ == "__main__":
asyncio.run(main())
Run a voice agent
Use a VoicePipeline to turn audio into text, run an agent workflow, and stream generated speech.
import asyncio
import numpy as np
from agents import Agent
from agents.voice import AudioInput, SingleAgentVoiceWorkflow, VoicePipeline
async def main() -> None:
agent = Agent(name="Assistant", instructions="You are a helpful voice assistant.")
pipeline = VoicePipeline(workflow=SingleAgentVoiceWorkflow(agent))
audio_input = AudioInput(buffer=np.zeros(24000 * 3, dtype=np.int16))
result = await pipeline.run(audio_input)
async for event in result.stream():
if event.type == "voice_stream_event_audio":
# Forward or play event.data.
pass
if __name__ == "__main__":
asyncio.run(main())
Explore the examples directory to see the SDK in action, and read our documentation for more details.
Contributing
Please share bug reports and feature requests through GitHub issues.
Pull requests are limited to repository collaborators; we do not accept pull requests from non-collaborators.
See CONTRIBUTING.md for the contribution policy and development guide.
For security vulnerabilities, follow SECURITY.md.
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.
openai/openai-agents-python thuộc nhóm AI Tools trên TopGit, cùng 7 topic GitHub. Trang Trending và Topics liệt kê các repo cùng số sao và cùng ngôn ngữ để so sánh.
Đọc thêm về openai/openai-agents-python ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/openai/openai-agents-python là nguồn chính thức.
openai/openai-agents-python có bao nhiêu sao?
openai/openai-agents-python có 30.1k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/openai/openai-agents-python. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
openai/openai-agents-python có những chủ đề gì?
GitHub topics của openai/openai-agents-python: "agents", "ai", "framework", "harness", "llm", "openai", "python". TopGit xếp repo vào nhóm AI Tools.
openai/openai-agents-python còn đang phát triển không?
Commit gần nhất trên openai/openai-agents-python là 9 ngày trước (theo timestamp GitHub). Repo có 5.0k fork — một chỉ báo về mức độ quan tâm của cộng đồng.
openai/openai-agents-python viết bằng ngôn ngữ gì?
openai/openai-agents-python chủ yếu viết bằng Python. Trường "language" của GitHub dựa trên phần lớn byte ở nhánh mặc định.
Vì sao openai/openai-agents-python được xếp vào nhóm AI Tools?
TopGit xếp openai/openai-agents-python vào nhóm AI Tools dựa trên GitHub topics và mô tả của repo (gắn thẻ: "agents", "ai", "framework"). Việc phân loại dựa trên metadata thật của repo, không phải đoán theo cảm tính biên tập.
Đọc đầy đủ README ở tab phía trên.
openai-agents-python có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về openai-agents-python.