Discover / AI Agents

OpenAI Agents SDK

by openaiPython

Official framework for building advanced agentic workflows with OpenAI.

Repositoryexperimental

Maturity: experimental because latest release v0.19.2 is pre 1.0. Derived from release and commit history, not a rating.

Stars
28k
Forks
4.4k
Downloads / mo
Last commit
2026-08-03
License
MIT
Open issues
50

Market and trust evidence

Edition not yet matched

No exact skills.sh identity match is available for this repository. Repository adoption and freshness remain visible above; install momentum is not inferred.

Trust analysis is a screening signal, not a security warranty. Read the ranking and trust methodology.

In practice

Written by AI from this repository’s README · low confidence

Client for building OpenAI agents.

Use it when

Use to interact with OpenAI's agent capabilities.

Not the right pick when

Not for non-OpenAI models.

Cost: Needs a paid API or account

Video walkthroughs

Third-party YouTube uploads matched to this tool by title, channel and repository name on 2026-08-03. Not made, reviewed or endorsed by SkillPilot. View counts and publish months are as of the match date and the month is approximate. Nothing loads from YouTube until you press play.

What the repository ships

Ships CLAUDE.mdHas testsHas docsHas examplesSecurity policyCI configured

Detected from the actual files in the repository root.

Latest release v0.19.2

Published 2026-08-01

What's Changed

  • feat: expose original callable through wrapped by @seratch in https://github.com/openai/openai-agents-python/pull/4038
  • fix: report input guardrail results when a tripwire aborts the run by @hsusul in https://github.com/openai/openai-agents-python/pull/4071
  • fix: consolidate same-exception re-raises into bare raise across all modules by @AAliKKhan in https://github.com/openai/openai-agents-python/pull/4023
  • fix(sandbox): preserve tagged EnvValue subclasses by @seratch in https://github.com/openai/openai-agents-python/pull/4039
  • fix(modal): reject ephemeral paths during tar hydration by @LHMQ878 in https://github.com/openai/openai-agents-python/pull/4045
  • fix(mcp): redact MCP prompt and resource transport errors by @seratch in https://github.com/openai/openai-agents-python/pull/4067
  • fix(mcp): redact URL credentials from SDK errors by @seratch in https://github.com/openai/openai-agents-python/pull/4015
  • fix(mcp): redact URL credentials from tracing and tool metadata by @seratch in https://github.com/openai/openai-agents-python/pull/4020
  • fix(mcp): redact direct MCP cleanup transport errors by @seratch in https://github.com/openai/openai-agents-python/pull/4078
  • fix(mcp): clean failed servers before reconnecting by @jstar0 in https://github.com/openai/openai-agents-python/pull/3939
  • fix(mcp): nested MCP cleanup error redaction by @seratch in https://github.com/openai/openai-agents-python/pull/4049
  • fix(realtime): preserve raw server event payloads by @GautamSharma99 in https://github.com/openai/openai-agents-python/pull/4062
  • fix(memory): count valid SQLAlchemy and MongoDB session items for positive limits by @chinmayv095 in https://github.com/openai/openai-agents-python/pull/4032
  • fix(memory): count valid AdvancedSQLiteSession items for positive limits by @chinmayv095 in https://github.com/openai/openai-agents-python/pull/4031
  • fix(memory): count valid Redis and Dapr session items for positive limits by @chinmayv095 in https://github.com/openai/openai-agents-python/pull/4033
  • fix(memory): enforce closed state in Redis and Dapr sessions by @SawhneySatvik in https://github.com/openai/openai-agents-python/pull/4035
  • fix(extensions): keep tool parameters named like schema keywords by @Kaif10 in https://github.com/openai/openai-agents-python/pull/4036
  • fix(extensions): close the LiteLLM provider stream on exit by @SawhneySatvik in https://github.com/openai/openai-agents-python/pull/4066
  • fix(extensions): preserve completed LiteLLM streams on cleanup failure by @seratch in https://github.com/openai/openai-agents-python/pull/4077
  • fix(voice): propagate iterator cancellation by @hsusul in https://github.com/openai/openai-agents-python/pull/4040
  • fix(voice): break out of audio dispatch loop when a stream task signals session_ended by @AAliKKhan in https://github.com/openai/openai-agents-python/pull/4044
  • fix(voice): block audio dispatcher while idle by @GautamSharma99 in https://github.com/openai/openai-agents-python/pull/4061
  • fix(tracing): use monotonic export deadlines by @GautamSharma99 in https://github.com/openai/openai-agents-python/pull/4063

Documentation & Other Changes

  • docs: correct the documented Chat Completions store default by @dfedoryshchev in https://github.com/openai/openai-agents-python/pull/4074
  • Release 0.19.2 by @github-actions[bot] in https://github.com/openai/openai-agents-python/pull/4046

New Contributors

  • @chinmayv095 made their first contribution in https://github.com/openai/openai-agents-python/pull/4032
  • @jstar0 made their first contribution in https://github.com/openai/openai-agents-python/pull/3939
  • @Kaif10 made their first contribution in https://github.com/openai/openai-agents-python/pull/4036
  • @SawhneySatvik made their first contribution in https://github.com/openai/openai-agents-python/pull/4035
  • @GautamSharma99 made their first contribution in https://github.com/openai/openai-agents-python/pull/4061
  • @LHM

Tags

README

OpenAI Agents SDK PyPI

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.

<img src="https://cdn.openai.com/API/docs/images/orchestration.png" alt="Image of the Agents Tracing UI" style="max-height: 803px;">

[!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


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:


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.

Acknowledgements

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

This library has these optional dependencies:

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

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.

Related tools