Skip to content

Commit 21c88f5

Browse files
committed
docs: improve the consistency of docs
1 parent c9b5d1b commit 21c88f5

3 files changed

Lines changed: 85 additions & 54 deletions

File tree

README.md

Lines changed: 52 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,15 @@ The OpenAI Agents SDK is a lightweight yet powerful framework for building multi
1010
### Core concepts:
1111

1212
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
1416
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
1517
1. [**Tools**](https://openai.github.io/openai-agents-python/tools/): Various Tools let agents take actions (functions, MCP, hosted tools)
1618
1. [**Guardrails**](https://openai.github.io/openai-agents-python/guardrails/): Configurable safety checks for input and output validation
1719
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
1820
1. [**Sessions**](https://openai.github.io/openai-agents-python/sessions/): Automatic conversation history management across agent runs
1921
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
2122

2223
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.
2324

@@ -48,7 +49,26 @@ For voice support, install with the optional `voice` group: `uv add 'openai-agen
4849

4950
## Run your first agents
5051

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)_)
5272

5373
### Run a sandbox agent
5474

@@ -77,25 +97,6 @@ result = Runner.run_sync(
7797
print(result.final_output)
7898
```
7999

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-
99100
### Run a realtime agent
100101

101102
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__":
124125
asyncio.run(main())
125126
```
126127

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+
async def main() -> None:
142+
agent = Agent(name="Assistant", instructions="You are a helpful voice assistant.")
143+
pipeline = VoicePipeline(workflow=SingleAgentVoiceWorkflow(agent))
144+
audio_input = AudioInput(buffer=np.zeros(24000 * 3, dtype=np.int16))
145+
146+
result = await pipeline.run(audio_input)
147+
async for event in result.stream():
148+
if event.type == "voice_stream_event_audio":
149+
# Forward or play event.data.
150+
pass
151+
152+
153+
if __name__ == "__main__":
154+
asyncio.run(main())
155+
```
156+
127157
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.
128158

129159
## Acknowledgements

docs/index.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,18 @@ The SDK has two driving design principles:
1717

1818
Here are the main features of the SDK:
1919

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.
2124
- **Python-first**: Use built-in language features to orchestrate and chain agents, rather than needing to learn new abstractions.
2225
- **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.
2426
- **Guardrails**: Run input validation and safety checks in parallel with agent execution, and fail fast when checks do not pass.
2527
- **Function tools**: Turn any Python function into a tool with automatic schema generation and Pydantic-powered validation.
2628
- **MCP server tool calling**: Built-in MCP server tool integration that works the same way as function tools.
2729
- **Sessions**: A persistent memory layer for maintaining working context within an agent loop.
2830
- **Human in the loop**: Built-in mechanisms for involving humans across agent runs.
2931
- **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.
3132

3233
## Agents SDK or Responses API?
3334

mkdocs.yml

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,14 @@ plugins:
5959
- Concepts: sandbox/guide.md
6060
- Sandbox clients: sandbox/clients.md
6161
- Agent memory: sandbox/memory.md
62+
- Realtime agents:
63+
- Quickstart: realtime/quickstart.md
64+
- Transport: realtime/transport.md
65+
- Guide: realtime/guide.md
66+
- Voice agents:
67+
- Quickstart: voice/quickstart.md
68+
- Pipeline: voice/pipeline.md
69+
- Tracing: voice/tracing.md
6270
- Models: models/index.md
6371
- Tools: tools.md
6472
- Guardrails: guardrails.md
@@ -77,14 +85,6 @@ plugins:
7785
- Usage: usage.md
7886
- Model context protocol (MCP): mcp.md
7987
- Tracing: tracing.md
80-
- Realtime agents:
81-
- Quickstart: realtime/quickstart.md
82-
- Transport: realtime/transport.md
83-
- Guide: realtime/guide.md
84-
- Voice agents:
85-
- Quickstart: voice/quickstart.md
86-
- Pipeline: voice/pipeline.md
87-
- Tracing: voice/tracing.md
8888
- Agent visualization: visualization.md
8989
- REPL utility: repl.md
9090
- Examples: examples.md
@@ -209,6 +209,13 @@ plugins:
209209
- 概念: sandbox/guide.md
210210
- Sandbox クライアント: sandbox/clients.md
211211
- エージェントメモリ: sandbox/memory.md
212+
- リアルタイムエージェント:
213+
- realtime/quickstart.md
214+
- realtime/guide.md
215+
- 音声エージェント:
216+
- voice/quickstart.md
217+
- voice/pipeline.md
218+
- voice/tracing.md
212219
- モデル: models/index.md
213220
- tools.md
214221
- guardrails.md
@@ -227,13 +234,6 @@ plugins:
227234
- usage.md
228235
- mcp.md
229236
- tracing.md
230-
- リアルタイムエージェント:
231-
- realtime/quickstart.md
232-
- realtime/guide.md
233-
- 音声エージェント:
234-
- voice/quickstart.md
235-
- voice/pipeline.md
236-
- voice/tracing.md
237237
- visualization.md
238238
- repl.md
239239
- コード例: examples.md
@@ -252,6 +252,13 @@ plugins:
252252
- 개념: sandbox/guide.md
253253
- 샌드박스 클라이언트: sandbox/clients.md
254254
- 에이전트 메모리: sandbox/memory.md
255+
- 실시간 에이전트:
256+
- realtime/quickstart.md
257+
- realtime/guide.md
258+
- 음성 에이전트:
259+
- voice/quickstart.md
260+
- voice/pipeline.md
261+
- voice/tracing.md
255262
- 모델: models/index.md
256263
- tools.md
257264
- guardrails.md
@@ -270,13 +277,6 @@ plugins:
270277
- usage.md
271278
- mcp.md
272279
- tracing.md
273-
- 실시간 에이전트:
274-
- realtime/quickstart.md
275-
- realtime/guide.md
276-
- 음성 에이전트:
277-
- voice/quickstart.md
278-
- voice/pipeline.md
279-
- voice/tracing.md
280280
- visualization.md
281281
- repl.md
282282
- 코드 예제: examples.md
@@ -295,6 +295,13 @@ plugins:
295295
- 概念: sandbox/guide.md
296296
- 沙箱客户端: sandbox/clients.md
297297
- 智能体记忆: sandbox/memory.md
298+
- 实时智能体:
299+
- realtime/quickstart.md
300+
- realtime/guide.md
301+
- 语音智能体:
302+
- voice/quickstart.md
303+
- voice/pipeline.md
304+
- voice/tracing.md
298305
- 模型: models/index.md
299306
- tools.md
300307
- guardrails.md
@@ -313,13 +320,6 @@ plugins:
313320
- usage.md
314321
- mcp.md
315322
- tracing.md
316-
- 实时智能体:
317-
- realtime/quickstart.md
318-
- realtime/guide.md
319-
- 语音智能体:
320-
- voice/quickstart.md
321-
- voice/pipeline.md
322-
- voice/tracing.md
323323
- visualization.md
324324
- repl.md
325325
- 示例: examples.md

0 commit comments

Comments
 (0)