- Agents, which are LLMs equipped with instructions and tools
- Handoffs, which allow agents to delegate to other agents for specific tasks
- Guardrails, which enable the inputs to agents to be validated
This guide outlines common agent workflows using this SDK. We will walk through building an investment agent across several use cases.
Design Considerations and Limitations#
| Design Considerations | Features & Limitations |
|---|---|
| Model support | First class support for OpenAI LLMs, and basic support for any LLM using a LiteLLM wrapper. Support for reasoning effort parameter to tradeoff on reducing latency or increasing accuracy. |
| Structured outputs | First-class support with OpenAI LLMs. LLMs that do not support json_schema as a parameter are not supported. |
| Tools | Very easy, using the @function_call decorator. Support for parallel tool calls to reduce latency. Built-in support for OpenAI SDK for WebSearchTool, ComputerTool, and FileSearchTool |
| Agent handoff | Very easy using handoffs variable |
| Multimodal support | Voice support, no support for images or video |
| Guardrails | Enables validation of both inputs and outputs |
| Retry logic | ⚠️ No retry logic, developers must manually handle failure cases |
| Memory | ⚠️ No built-in memory management. Developers must manage their own conversation and user memory. |
| Code execution | ⚠️ No built-in support for executing code |
Simple agent#
An LLM agent with access to tools to accomplish a task is the most basic flow. This agent answers questions about stocks and uses OpenAI web search to get real time information.
Prompt chaining#
This agent builds a portfolio of stocks and ETFs using multiple agents linked together:
- Search Agent: Searches the web for information on particular stock tickers.
- Report Agent: Creates a portfolio of stocks and ETFs that supports the user’s investment strategy.
Parallelization#
This agent researches stocks for you. If we want to research 5 stocks, we can force the agent to run multiple tool calls, instead of sequentially.
Router agent#
This agent answers questions about investing using multiple agents. A central router agent chooses which worker to use.
- Research Agent: Searches the web for information about stocks and ETFs.
- Question Answering Agent: Answers questions about investing like Warren Buffett.
Evaluator-Optimizer#
When creating LLM outputs, often times the first generation is unsatisfactory. You can use an agentic loop to iteratively improve the output by asking an LLM to give feedback, and then use the feedback to improve the output.
This agent pattern creates reports and evaluates itself to improve its output.
- Report Agent (Generation): Creates a report on a particular stock ticker.
- Evaluator Agent (Feedback): Evaluates the report and provides feedback on what to improve.
Orchestrator worker#
This is the most advanced pattern in the examples, using orchestrators and workers together. The orchestrator chooses which worker to use for a specific sub-task. The worker attempts to complete the sub-task and return a result. The orchestrator then uses the result to choose the next worker to use until a final result is returned.
In the following example, we’ll build an agent which creates a portfolio of stocks and ETFs based on a user’s investment strategy.
- Orchestrator: Chooses which worker to use based on the user’s investment strategy.
- Research Agent: Searches the web for information about stocks and ETFs that could support the user’s investment strategy.
- Evaluation Agent: Evaluates the research report and provides feedback on what data is missing.
- Portfolio Agent: Creates a portfolio of stocks and ETFs based on the research report.
This uses the following structured outputs.

