codex
Lightweight coding agent that runs in your terminal
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. Looking for the JavaScript/TypeScript version?
Repo: openai/openai-agents-python
What's inside
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.
gpt-realtime-2.1 and full agent featuresExplore the examples directory to see the SDK in action, and read our documentation for more details.
To get started, set up your Python environment (Python 3.10 or newer required), and then install OpenAI Agents SDK package.
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]'.
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]'.
The SDK supports four primary ways to run agents. Set the OPENAI_API_KEY environment variable before running any of these examples.
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)
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)
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())
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.
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.
.agents/
references/
agent-definition-and-run-context.md
conversation-state-ownership.md
function-and-output-schema.md
local-mcp-server-lifecycle.md
model-provider-boundaries.md
README.md
realtime-session-lifecycle.md
realtime-tracing.md
run-item-lifecycle.md
runner-lifecycle.md
runstate-schema.md
sandbox-runtime-boundary.md
session-persistence.md
tool-execution-lifecycle.md
tool-identity.md
tracing-lifecycle.md
voice-pipeline-lifecycle.md
skills/
code-change-verification/
agents/
openai.yaml
scripts/
run.ps1
run.sh
SKILL.md
docs-sync/
agents/
openai.yaml
references/
doc-coverage-checklist.md
SKILL.md
examples-auto-run/
agents/
openai.yaml
scripts/
run.sh
SKILL.md
final-release-review/
agents/
openai.yaml
references/
review-checklist.md
scripts/
find_latest_release_tag.sh
SKILL.md
implementation-final-review/
agents/
openai.yaml
references/
reviewer-brief.md
scripts/
review_protocol.py
review_state.py
test_review_protocol.py
test_review_state.py
test_skill_contract.py
SKILL.md
implementation-kickoff/
agents/
openai.yaml
scripts/
validate_handoff.py
SKILL.md
implementation-strategy/
agents/
openai.yaml
SKILL.md
integration-tests/
agents/
openai.yaml
SKILL.md
maintainer-review/
agents/
openai.yaml
references/
evaluation-framework.md
SKILL.md
openai-knowledge/
agents/
openai.yaml
SKILL.md
pr-draft-summary/
agents/
openai.yaml
SKILL.md
runtime-behavior-probe/
agents/
openai.yaml
references/
error-cases.md
openai-runtime-patterns.md
reporting-format.md
validation-matrix.md
SKILL.md
templates/
python_probe.py
sensitive-logging-audit/
agents/
openai.yaml
references/
redaction-validation.md
scripts/
inventory_logging.py
test_inventory.py
SKILL.md
test-coverage-improver/
agents/
openai.yaml
SKILL.md
.github/
dependabot.yml
ISSUE_TEMPLATE/
bug_report.md
feature_request.md
model_provider.md
question.md
PULL_REQUEST_TEMPLATE/
pull_request_template.md
scripts/
check_optional_truthiness.py
detect-changes.sh
run_integration_tests.py
run_serial_tests.py
run-asyncio-teardown-stability.sh
select-release-milestone.py
update_rclone_pin.py
workflows/
docs.yml
issues.yml
publish.yml
release-pr.yml
release-tag.yml
tests.yml
.gitignore
.prettierrc
.vscode/
launch.json
settings.json
AGENTS.md
CLAUDE.md
docs/
agents.md
assets/
images/
favicon-platform.svg
graph.png
harness_with_compute.png
mcp-tracing.jpg
orchestration.png
logo.svg
config.md
context.md
examples.md
guardrails.md
handoffs.md
human_in_the_loop.md
index.md
ja/
agents.md
config.md
context.md
examples.md
guardrails.md
handoffs.md
human_in_the_loop.md
index.md
mcp.md
models/
index.md
litellm.md
multi_agent.md
quickstart.md
realtime/
guide.md
quickstart.md
transport.md
release.md
repl.md
results.md
running_agents.md
sandbox/
sandbox_agents.md
clients.md
guide.md
memory.md
sessions/
sessions.md
advanced_sqlite_session.md
encrypted_session.md
index.md
sqlalchemy_session.md
streaming.md
tools.md
tracing.md
usage.md
visualization.md
voice/
pipeline.md
quickstart.md
tracing.md
ko/
agents.md
config.md
context.md
examples.md
guardrails.md
handoffs.md
human_in_the_loop.md
index.md
mcp.md
models/
index.md
litellm.md
multi_agent.md
quickstart.md
realtime/
guide.md
quickstart.md
transport.md
release.md
repl.md
results.md
running_agents.md
sandbox/
sandbox_agents.md
clients.md
guide.md
memory.md
sessions/
sessions.md
advanced_sqlite_session.md
encrypted_session.md
index.md
sqlalchemy_session.md
streaming.md
tools.md
tracing.md
usage.md
visualization.md
voice/
pipeline.md
quickstart.md
tracing.md
llms-full.txt
llms.txt
mcp.md
models/
index.md
litellm.md
multi_agent.md
quickstart.md
realtime/
guide.md
quickstart.md
transport.md
ref/
agent_output.md
agent_tool_input.md
agent_tool_state.md
agent.md
apply_diff.md
computer.md
decorators.md
editor.md
exceptions.md
extensions/
experimental/
codex/
codex_options.md
codex_tool.md
codex.md
events.md
exec.md
items.md
output_schema_file.md
payloads.md
thread_options.md
thread.md
turn_options.md
hosted_multi_agent/
model.md
handoff_filters.md
handoff_prompt.md
litellm.md
memory/
advanced_sqlite_session.md
async_sqlite_session.md
dapr_session.md
encrypt_session.md
mongodb_session.md
redis_session.md
sqlalchemy_session.md
models/
any_llm_model.md
any_llm_provider.md
litellm_model.md
litellm_provider.md
sandbox/
blaxel/
mounts.md
sandbox.md
cloudflare/
mounts.md
sandbox.md
daytona/
mounts.md
sandbox.md
e2b/
mounts.md
sandbox.md
modal/
mounts.md
sandbox.md
runloop/
mounts.md
sandbox.md
vercel/
mounts.md
sandbox.md
tool_output_trimmer.md
visualization.md
function_schema.md
guardrail.md
handoffs/
handoffs.md
history.md
index.md
items.md
lifecycle.md
logger.md
mcp/
manager.md
server.md
util.md
memory/
memory.md
openai_conversations_session.md
openai_responses_compaction_session.md
session_settings.md
session.md
sqlite_session.md
util.md
model_settings.md
models/
chatcmpl_converter.md
chatcmpl_helpers.md
chatcmpl_stream_handler.md
default_models.md
fake_id.md
interface.md
multi_provider.md
openai_agent_registration.md
openai_chatcompletions.md
openai_client_utils.md
openai_provider.md
openai_responses.md
reasoning_content_replay.md
prompts.md
realtime/
agent.md
audio_formats.md
config.md
events.md
handoffs.md
items.md
model_events.md
model_inputs.md
model.md
openai_realtime.md
runner.md
session.md
repl.md
responses_websocket_session.md
result.md
retry.md
run_config.md
run_context.md
run_error_handlers.md
run_internal/
agent_bindings.md
agent_runner_helpers.md
approvals.md
error_handlers.md
guardrails.md
items.md
model_retry.md
oai_conversation.md
prompt_cache_key.md
run_grouping.md
run_loop.md
run_steps.md
session_persistence.md
streaming.md
tool_actions.md
tool_caller.md
tool_execution.md
tool_planning.md
tool_use_tracker.md
... 1309 moreLightweight coding agent that runs in your terminal
Use Codex from inside Claude Code for code reviews or to delegate tasks to Codex. This plugin is for Claude Code users who want an easy way to start using Codex from the workflow they already have.
FAQ
openai-agents-python is a Claude Code plugin with hand-picked skills for development work, indexed on Flowy. Install it with the command on its page. Its skills do not fire on their own yet. Request auto-invocation to have Flowy route them as you prompt. Free and open source.