#OpenAI Agent sdk
1 messages · Page 1 of 1 (latest)
Hi @jaunty panther. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
The OpenAI Agents SDK supports two main types of orchestration for coordinating multiple agents in your application:
1. Orchestrating via LLM (Language Model)
- How it works: The LLM (agent) is given instructions, tools, and handoffs. It autonomously plans and decides which steps to take, which tools to use, and when to delegate tasks to sub-agents.
- When to use:
- When tasks are open-ended and require reasoning, planning, or dynamic decision-making.
- When you want the agent to leverage its intelligence to determine the best workflow.
- Useful for research agents, assistants that need to decide between multiple tools, or scenarios where flexibility is important.
- Best practices:
- Invest in clear prompts that specify available tools and constraints.
- Monitor and iterate on your prompts and workflows.
- Use specialized agents for specific tasks rather than a single generalist agent.
- Employ evaluation tools to improve agent performance over time.
2. Orchestrating via Code
- How it works: The orchestration logic is implemented directly in your code. You determine which agents run, in what order, and how their outputs are used.
- When to use:
- When you need deterministic, predictable, and efficient workflows.
- For structured tasks where the flow is well-defined (e.g., sequential steps, parallel execution, or conditional routing).
- When you want to chain agents, run them in parallel, or use structured outputs to control the workflow.
- Best practices:
- Use structured outputs to inspect and route data.
- Chain agents for multi-step processes.
- Run agents in loops for iterative improvement.
- Use Python primitives (like
asyncio.gather) for parallel execution.
You can also mix and match these patterns, combining the flexibility of LLM-driven orchestration with the predictability of code-based flows, depending on your application's needs. For practical examples, see the agent_patterns examples in the SDK documentation Orchestrating multiple agents.
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@jaunty panther Kapa.ai is still learning and improving, please let me know how I did by reacting below.
Explain this and the conceptual différence with what you explained before :
Multi-agent system design patterns
There are many ways to design multi‑agent systems, but we commonly see two broadly applicable patterns:
Manager (agents as tools): A central manager/orchestrator invokes specialized sub‑agents as tools and retains control of the conversation.
Handoffs: Peer agents hand off control to a specialized agent that takes over the conversation. This is decentralized.
See our practical guide to building agents for more details.
Explain this and the conceptual différence with what you explained before :
Multi-agent system design patterns
There are many ways to design multi‑agent systems, but we commonly see two broadly applicable patterns:
Manager (agents as tools): A central manager/orchestrator invokes specialized sub‑agents as tools and retains control of the conversation.
Handoffs: Peer agents hand off control to a specialized agent that takes over the conversation. This is decentralized.
See our practical guide to building agents for more details.
@tardy wraith Answer me
Let me check the knowledge base for you again. One moment! :books:
The OpenAI Agents SDK supports two primary types of orchestration for multi-agent systems:
1. Orchestrating via LLM (Language Model)
Description:
Here, the LLM (agent) is equipped with instructions, tools, and handoffs. The agent autonomously plans how to tackle a task, deciding which tools to use and when to delegate to sub-agents. This approach leverages the reasoning and planning capabilities of the LLM.
When to use:
- When tasks are open-ended and require dynamic decision-making or reasoning.
- When you want the agent to autonomously select tools or delegate tasks.
- Ideal for research agents, assistants, or any scenario where flexibility and adaptability are important.
Best practices:
- Invest in clear, high-quality prompts that specify available tools and constraints.
- Monitor and iterate on your prompts and workflows.
- Use specialized agents for specific tasks rather than a single generalist agent.
- Employ evaluation tools to improve agent performance over time.
2. Orchestrating via Code
Description:
In this pattern, you explicitly control the flow of agents in your code. You determine which agents run, in what order, and how their outputs are used. This makes the workflow more deterministic and predictable.
When to use:
- When you need predictable, efficient, and well-defined workflows.
- For structured tasks where the flow is known in advance (e.g., sequential steps, parallel execution, or conditional routing).
- When chaining agents, running them in parallel, or using structured outputs to control the workflow.
Best practices:
- Use structured outputs to inspect and route data.
- Chain agents for multi-step processes.
- Run agents in loops for iterative improvement.
- Use Python primitives (like
asyncio.gather) for parallel execution.
You can also combine these patterns—using LLM-driven orchestration for flexibility and code-based orchestration for predictability, depending on your application's needs. For more details and practical examples, see the OpenAI Agents SDK documentation.
Sources:
Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:
@jaunty panther Kapa.ai is still learning and improving, please let me know how I did by reacting below.
@tardy wraith
Explain this and the conceptual différence with what you explained before :
Multi-agent system design patterns
There are many ways to design multi‑agent systems, but we commonly see two broadly applicable patterns:
Manager (agents as tools): A central manager/orchestrator invokes specialized sub‑agents as tools and retains control of the conversation.
Handoffs: Peer agents hand off control to a specialized agent that takes over the conversation. This is decentralized.
See our practical guide to building agents for more details.
Let me check the knowledge base for you again. One moment! :books:
Certainly! Here’s an explanation of the two multi-agent system design patterns—Manager (agents as tools) and Handoffs—and how they conceptually differ from the orchestration types described earlier:
1. Manager (Agents as Tools)
- How it works:
A central manager or orchestrator agent retains control of the conversation and invokes specialized sub-agents as tools. The sub-agents do not take over the conversation; instead, the manager agent calls them for specific subtasks and incorporates their results. - Key characteristics:
- Centralized control: The main agent always interacts with the user and decides when to use sub-agents.
- Sub-agents are exposed as tools (using
.as_tool()), and their expertise is leveraged as needed. - The conversation thread remains with the manager agent.
- When to use:
- When you want a single point of coordination and a clear, auditable workflow.
- Useful for customer-facing applications where the user should always interact with the same agent, even if specialized expertise is required.
2. Handoffs
- How it works:
Peer agents can hand off control to a specialized agent, which then takes over the conversation. The delegated agent receives the conversation history and becomes the new point of contact. - Key characteristics:
- Decentralized control: Any agent can transfer control to another agent.
- The agent receiving the handoff takes over the conversation and user interaction.
- Enables modular, specialized agents that excel at a single task.
- When to use:
- When you want agents to specialize and take full ownership of specific tasks or domains.
- Useful for workflows where responsibility should shift between agents (e.g., triage, escalation, or domain-specific support).
Conceptual Difference from Orchestration Types
- The orchestration types (LLM-driven vs. code-driven) describe how you coordinate the flow of agents—whether the LLM decides the workflow or you control it explicitly in code.
- The design patterns (Manager vs. Handoffs) describe who holds the conversation and how agents interact:
- Manager (agents as tools): Centralized, with one agent always in control, calling others as needed.
- Handoffs: Decentralized, with control passing between agents as the workflow progresses.