You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+52-22Lines changed: 52 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,14 +10,15 @@ The OpenAI Agents SDK is a lightweight yet powerful framework for building multi
10
10
### Core concepts:
11
11
12
12
1.[**Agents**](https://openai.github.io/openai-agents-python/agents): LLMs configured with instructions, tools, guardrails, and handoffs
13
-
1.[**Sandbox Agents**](https://openai.github.io/openai-agents-python/sandbox_agents): Agents preconfigured to work with a container to perform work over long time horizons.
13
+
1.[**Sandbox agents**](https://openai.github.io/openai-agents-python/sandbox_agents): Agents preconfigured to work with a container to perform work over long time horizons.
14
+
1.[**Realtime agents**](https://openai.github.io/openai-agents-python/realtime/quickstart/): Build powerful voice agents with `gpt-realtime-2.1` and full agent features
15
+
1.[**Voice agents**](https://openai.github.io/openai-agents-python/voice/quickstart/): Build voice pipelines that combine speech-to-text, an agent workflow, and text-to-speech
14
16
1.**[Agents as tools](https://openai.github.io/openai-agents-python/tools/#agents-as-tools) / [Handoffs](https://openai.github.io/openai-agents-python/handoffs/)**: Delegating to other agents for specific tasks
15
17
1.[**Tools**](https://openai.github.io/openai-agents-python/tools/): Various Tools let agents take actions (functions, MCP, hosted tools)
16
18
1.[**Guardrails**](https://openai.github.io/openai-agents-python/guardrails/): Configurable safety checks for input and output validation
17
19
1.[**Human in the loop**](https://openai.github.io/openai-agents-python/human_in_the_loop/): Built-in mechanisms for involving humans across agent runs
18
20
1.[**Sessions**](https://openai.github.io/openai-agents-python/sessions/): Automatic conversation history management across agent runs
19
21
1.[**Tracing**](https://openai.github.io/openai-agents-python/tracing/): Built-in tracking of agent runs, allowing you to view, debug and optimize your workflows
20
-
1.[**Realtime Agents**](https://openai.github.io/openai-agents-python/realtime/quickstart/): Build powerful voice agents with `gpt-realtime-2.1` and full agent features
21
22
22
23
Explore the [examples](https://github.com/openai/openai-agents-python/tree/main/examples) directory to see the SDK in action, and read our [documentation](https://openai.github.io/openai-agents-python/) for more details.
23
24
@@ -48,7 +49,26 @@ For voice support, install with the optional `voice` group: `uv add 'openai-agen
48
49
49
50
## Run your first agents
50
51
51
-
The SDK supports three primary ways to run agents. Set the `OPENAI_API_KEY` environment variable before running any of these examples.
52
+
The SDK supports four primary ways to run agents. Set the `OPENAI_API_KEY` environment variable before running any of these examples.
53
+
54
+
### Run a text agent
55
+
56
+
Use a text `Agent` for workflows that do not need a persistent realtime connection or a sandbox workspace.
57
+
58
+
```python
59
+
from agents import Agent, Runner
60
+
61
+
agent = Agent(name="Assistant", instructions="You are a helpful assistant")
62
+
63
+
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")
64
+
print(result.final_output)
65
+
66
+
# Code within the code,
67
+
# Functions calling themselves,
68
+
# Infinite loop's dance.
69
+
```
70
+
71
+
(_For Jupyter notebook users, see [hello_world_jupyter.ipynb](https://github.com/openai/openai-agents-python/blob/main/examples/basic/hello_world_jupyter.ipynb)_)
52
72
53
73
### Run a sandbox agent
54
74
@@ -77,25 +97,6 @@ result = Runner.run_sync(
77
97
print(result.final_output)
78
98
```
79
99
80
-
### Run a text agent
81
-
82
-
Use a text `Agent` for workflows that do not need a persistent realtime connection or a sandbox workspace.
83
-
84
-
```python
85
-
from agents import Agent, Runner
86
-
87
-
agent = Agent(name="Assistant", instructions="You are a helpful assistant")
88
-
89
-
result = Runner.run_sync(agent, "Write a haiku about recursion in programming.")
90
-
print(result.final_output)
91
-
92
-
# Code within the code,
93
-
# Functions calling themselves,
94
-
# Infinite loop's dance.
95
-
```
96
-
97
-
(_For Jupyter notebook users, see [hello_world_jupyter.ipynb](https://github.com/openai/openai-agents-python/blob/main/examples/basic/hello_world_jupyter.ipynb)_)
98
-
99
100
### Run a realtime agent
100
101
101
102
Use a [`RealtimeAgent`](https://openai.github.io/openai-agents-python/realtime/quickstart/) for low-latency, server-side voice and multimodal experiences over WebSocket.
@@ -124,6 +125,35 @@ if __name__ == "__main__":
124
125
asyncio.run(main())
125
126
```
126
127
128
+
### Run a voice agent
129
+
130
+
Use a [`VoicePipeline`](https://openai.github.io/openai-agents-python/voice/quickstart/) to turn audio into text, run an agent workflow, and stream generated speech.
131
+
132
+
```python
133
+
import asyncio
134
+
135
+
import numpy as np
136
+
137
+
from agents import Agent
138
+
from agents.voice import AudioInput, SingleAgentVoiceWorkflow, VoicePipeline
139
+
140
+
141
+
asyncdefmain() -> None:
142
+
agent = Agent(name="Assistant", instructions="You are a helpful voice assistant.")
Explore the [examples](https://github.com/openai/openai-agents-python/tree/main/examples) directory to see the SDK in action, and read our [documentation](https://openai.github.io/openai-agents-python/) for more details.
Copy file name to clipboardExpand all lines: docs/index.md
+4-3Lines changed: 4 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,17 +17,18 @@ The SDK has two driving design principles:
17
17
18
18
Here are the main features of the SDK:
19
19
20
-
-**Agent loop**: A built-in agent loop that handles tool invocation, sends results back to the LLM, and continues until the task is complete.
20
+
-**Agents**: Build agents with instructions, tools, guardrails, handoffs, and a built-in loop that continues until the task is complete.
21
+
-**Sandbox agents**: Run specialists inside real isolated workspaces with manifest-defined files, sandbox client choice, and resumable sandbox sessions.
22
+
-**Realtime agents**: Build powerful voice agents with `gpt-realtime-2.1`, automatic interruption detection, context management, guardrails, and more.
23
+
-**Voice agents**: Build voice pipelines that combine speech-to-text, an agent workflow, and text-to-speech.
21
24
-**Python-first**: Use built-in language features to orchestrate and chain agents, rather than needing to learn new abstractions.
22
25
-**Agents as tools / Handoffs**: A powerful mechanism for coordinating and delegating work across multiple agents.
23
-
-**Sandbox agents**: Run specialists inside real isolated workspaces with manifest-defined files, sandbox client choice, and resumable sandbox sessions.
24
26
-**Guardrails**: Run input validation and safety checks in parallel with agent execution, and fail fast when checks do not pass.
25
27
-**Function tools**: Turn any Python function into a tool with automatic schema generation and Pydantic-powered validation.
26
28
-**MCP server tool calling**: Built-in MCP server tool integration that works the same way as function tools.
27
29
-**Sessions**: A persistent memory layer for maintaining working context within an agent loop.
28
30
-**Human in the loop**: Built-in mechanisms for involving humans across agent runs.
29
31
-**Tracing**: Built-in tracing for visualizing, debugging, and monitoring workflows, with support for the OpenAI suite of evaluation, fine-tuning, and distillation tools.
30
-
-**Realtime Agents**: Build powerful voice agents with `gpt-realtime-2.1`, automatic interruption detection, context management, guardrails, and more.
0 commit comments