Skip to main content
  • 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 ConsiderationsFeatures & Limitations
Model supportFirst 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 outputsFirst-class support with OpenAI LLMs. LLMs that do not support json_schema as a parameter are not supported.
ToolsVery 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 handoffVery easy using handoffs variable
Multimodal supportVoice support, no support for images or video
GuardrailsEnables 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.

phoenix/tutorials/agents/openai/openai_agents_basic.ipynb at main · Arize-ai/phoenix

Prompt chaining

This agent builds a portfolio of stocks and ETFs using multiple agents linked together:
  1. Search Agent: Searches the web for information on particular stock tickers.
  2. Report Agent: Creates a portfolio of stocks and ETFs that supports the user’s investment strategy.

phoenix/tutorials/agents/openai/openai_agents_prompt_chaining.ipynb at main · Arize-ai/phoenix

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.

phoenix/tutorials/agents/openai/openai_agents_parallelization.ipynb at main · Arize-ai/phoenix

Router agent

This agent answers questions about investing using multiple agents. A central router agent chooses which worker to use.
  1. Research Agent: Searches the web for information about stocks and ETFs.
  2. Question Answering Agent: Answers questions about investing like Warren Buffett.

phoenix/tutorials/agents/openai/openai_agents_routing.ipynb at main · Arize-ai/phoenix

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.
  1. Report Agent (Generation): Creates a report on a particular stock ticker.
  2. Evaluator Agent (Feedback): Evaluates the report and provides feedback on what to improve.

phoenix/tutorials/agents/openai/openai_agents_evaluator_optimizer.ipynb at main · Arize-ai/phoenix

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.
  1. Orchestrator: Chooses which worker to use based on the user’s investment strategy.
  2. Research Agent: Searches the web for information about stocks and ETFs that could support the user’s investment strategy.
  3. Evaluation Agent: Evaluates the research report and provides feedback on what data is missing.
  4. Portfolio Agent: Creates a portfolio of stocks and ETFs based on the research report.

phoenix/tutorials/agents/openai/openai_agents_orchestrator.ipynb at main · Arize-ai/phoenix

This uses the following structured outputs.