|
1 | 1 | # Examples |
2 | 2 |
|
3 | | -Check out a variety of sample implementations of the SDK in the examples section of the [repo](https://github.com/openai/openai-agents-python/tree/main/examples). The examples are organized into several categories that demonstrate different patterns and capabilities. |
| 3 | +Explore a variety of sample implementations of the SDK in the [examples](https://github.com/openai/openai-agents-python/tree/main/examples) section of the repository. These examples are organized into several categories, each demonstrating different patterns and capabilities. |
4 | 4 |
|
| 5 | +## Table of Contents |
| 6 | +- [Agent Patterns](#agent-patterns) |
| 7 | +- [Basic](#basic) |
| 8 | +- [Tools](#tools) |
| 9 | +- [Model Providers](#model-providers) |
| 10 | +- [Handoffs](#handoffs) |
| 11 | +- [Customer Service](#customer-service) |
| 12 | +- [Research Bot](#research-bot) |
| 13 | +- [Voice](#voice) |
| 14 | +- [Financial Research Agent](#financial-research-agent) |
5 | 15 |
|
6 | 16 | ## Categories |
7 | 17 |
|
8 | | -- **agent_patterns** |
9 | | - Examples in this category illustrate common agent design patterns, such as: |
10 | | - - Deterministic workflows |
11 | | - - Agents as tools |
12 | | - - Parallel agent execution |
| 18 | +### Agent Patterns |
| 19 | +Examples in this category illustrate common agent design patterns: |
| 20 | +- **[Agents as Tools](https://github.com/openai/openai-agents-python/blob/main/examples/agent_patterns/agents_as_tools.py)** – Using agents to accomplish complex tasks via other agents. |
| 21 | +- **[Deterministic Workflows](https://github.com/openai/openai-agents-python/blob/main/examples/agent_patterns/deterministic.py)** – Creating predictable and repeatable agent behaviors. |
| 22 | +- **[Forcing Tool Use](https://github.com/openai/openai-agents-python/blob/main/examples/agent_patterns/forcing_tool_use.py)** – Ensuring agents utilize specific tools. |
| 23 | +- **[Input Guardrails](https://github.com/openai/openai-agents-python/blob/main/examples/agent_patterns/input_guardrails.py)** – Validating and constraining agent inputs. |
| 24 | +- **[LLM as a Judge](https://github.com/openai/openai-agents-python/blob/main/examples/agent_patterns/llm_as_a_judge.py)** – Using language models to evaluate agent outputs. |
| 25 | +- **[Output Guardrails](https://github.com/openai/openai-agents-python/blob/main/examples/agent_patterns/output_guardrails.py)** – Ensuring agent outputs conform to desired behaviors. |
| 26 | +- **[Parallel Agent Execution](https://github.com/openai/openai-agents-python/blob/main/examples/agent_patterns/parallelization.py)** – Running multiple agents concurrently. |
| 27 | +- **[Routing](https://github.com/openai/openai-agents-python/blob/main/examples/agent_patterns/routing.py)** – Directing tasks to appropriate agents. |
13 | 28 |
|
14 | | -- **basic** |
15 | | - These examples showcase foundational capabilities of the SDK, such as: |
16 | | - - Dynamic system prompts |
17 | | - - Streaming outputs |
18 | | - - Lifecycle events |
| 29 | +### Basic |
| 30 | +Foundational SDK capabilities: |
| 31 | +- **[Agent Lifecycle Events](https://github.com/openai/openai-agents-python/blob/main/examples/basic/agent_lifecycle_example.py)** – Handling different stages of an agent’s lifecycle. |
| 32 | +- **[Dynamic System Prompts](https://github.com/openai/openai-agents-python/blob/main/examples/basic/dynamic_system_prompt.py)** – Modifying system prompts dynamically. |
| 33 | +- **[Hello World Examples](https://github.com/openai/openai-agents-python/blob/main/examples/basic/hello_world.py)** – Simple implementations to get started. |
| 34 | +- **[Streaming Outputs](https://github.com/openai/openai-agents-python/blob/main/examples/basic/stream_text.py)** – Handling streaming responses. |
| 35 | +- **[Tool Integration](https://github.com/openai/openai-agents-python/blob/main/examples/basic/tools.py)** – Extending agent functionality via tools. |
19 | 36 |
|
20 | | -- **tool examples** |
21 | | - Learn how to implement OAI hosted tools such as web search and file search, |
22 | | - and integrate them into your agents. |
| 37 | +### Tools |
| 38 | +Implementing and integrating tools: |
| 39 | +- **[Web Search Tool](https://github.com/openai/openai-agents-python/blob/main/examples/tools/web_search.py)** – Performing live web searches. |
| 40 | +- **[File Search Tool](https://github.com/openai/openai-agents-python/blob/main/examples/tools/file_search.py)** – Searching within specified files. |
| 41 | +- **[Computer Use Tool](https://github.com/openai/openai-agents-python/blob/main/examples/tools/computer_use.py)** – Simulating user interactions with a computer. |
23 | 42 |
|
24 | | -- **model providers** |
25 | | - Explore how to use non-OpenAI models with the SDK. |
| 43 | +### Model Providers |
| 44 | +Using non-OpenAI models with the SDK: |
| 45 | +- **[Custom Example Agent](https://github.com/openai/openai-agents-python/blob/main/examples/model_providers/custom_example_agent.py)** – Setting up an agent with a custom model provider. |
| 46 | +- **[Custom Example Global](https://github.com/openai/openai-agents-python/blob/main/examples/model_providers/custom_example_global.py)** – Configuring a global model provider. |
| 47 | +- **[Custom Example Provider](https://github.com/openai/openai-agents-python/blob/main/examples/model_providers/custom_example_provider.py)** – Implementing a provider for specific use cases. |
26 | 48 |
|
27 | | -- **handoffs** |
28 | | - See practical examples of agent handoffs. |
| 49 | +### Handoffs |
| 50 | +Practical agent handoff scenarios: |
| 51 | +- **[Message Filter](https://github.com/openai/openai-agents-python/blob/main/examples/handoffs/message_filter.py)** – Transferring tasks based on message content. |
| 52 | +- **[Message Filter with Streaming](https://github.com/openai/openai-agents-python/blob/main/examples/handoffs/message_filter_streaming.py)** – Handling message filtering with streaming responses. |
| 53 | + |
| 54 | +### Customer Service |
| 55 | +A real-world example: |
| 56 | +- **[Customer Service System](https://github.com/openai/openai-agents-python/blob/main/examples/customer_service/main.py)** – An airline customer service system handling FAQs and bookings. |
| 57 | + |
| 58 | +### Research Bot |
| 59 | +A simple multi-agent research bot: |
| 60 | +- **[Research Bot](https://github.com/openai/openai-agents-python/tree/main/examples/research_bot)** – Assists in gathering and summarizing information. |
| 61 | + |
| 62 | +### Voice |
| 63 | +Explore voice-related agent implementations: |
| 64 | +- **[Voice](https://github.com/openai/openai-agents-python/tree/main/examples/voice)** – General voice processing examples. |
| 65 | +- **[Static Voice](https://github.com/openai/openai-agents-python/tree/main/examples/voice/static)** – Handling pre-recorded voice data. |
| 66 | +- **[Streamed Voice](https://github.com/openai/openai-agents-python/tree/main/examples/voice/streamed)** – Processing real-time voice input. |
| 67 | + |
| 68 | +### Financial Research Agent |
| 69 | +A specialized example focusing on financial research: |
| 70 | +- **[Financial Research Agent](https://github.com/openai/openai-agents-python/tree/main/examples/financial_research_agent)** – Assists in financial data analysis and research. |
| 71 | + |
| 72 | +For a comprehensive understanding and to see these examples in action, visit the [examples directory](https://github.com/openai/openai-agents-python/tree/main/examples) in the repository. |
29 | 73 |
|
30 | | -- **customer_service & research_bot** |
31 | | - Two more built-out examples that illustrate real-world applications: |
32 | | - - **customer_service**: Example customer service system for an airline. |
33 | | - - **research_bot**: Simple deep research clone. |
|
0 commit comments