# Orchestration

An orchestrator coordinates multiple sub-agents to manage complex multi-step workflows.

After you configure an agent as an orchestrator, it becomes a coordination layer that plans tasks, delegates work to sub-agents, and integrates their outputs. The orchestrator does not execute tools directly. Instead, it focuses on strategy, task routing, and combining results.

## Architecture

The orchestrator works as a supervisory layer that coordinates multiple agents. It does not call tools directly. Instead, it manages the workflow by doing the following:

1. Interpreting the end user's goal
2. Identifying which agents are required
3. Delegating tasks to those agents
4. Collecting and integrating their results

## Example workflow

**End user request**: *Create a Q2 sales performance report with charts and an executive summary.*

Steps:
- **Break down the request**: Identify subtasks such as data extraction, analysis, visualization, summarization
- **Delegate**: Assign each subtask to the most suitable agent
   - *Data Agent* → Extracts data
   - *Analytics Agent* → Performs analysis and generates charts
   - *Summary Agent* → Produces the executive summary
- **Integrate**: Validate outputs, merge them, and compile the final report

## Benefits

- **Modular architecture**: Agents are specialized and can be maintained independently
- **Scalable execution**: Tasks can run in parallel
- **Robustness**: Failures are isolated with retry/fallback mechanisms
- **Clear division of responsibilities**: Orchestrator manages planning, agents manage execution
- **Extensibility**: New agents or tools can be added easily

## Example orchestrator prompt

```javascript showLineNumbers copy
Workflow Example: Quarterly Sales Report

  1. Understand end user intent.
     - Identify that the request involves data extraction, analysis, visualization, and summary generation.
  2. Break down into subtasks:
     - Data Extraction → retrieve and prepare sales data
     - Analysis → compute key metrics (totals, growth rates, etc.)
     - Visualization → generate charts and graphs
     - Summary Generation → write a textual executive summary
  3. Delegate each subtask:
     - Assign to the most suitable AI agent based on its capabilities
     - Provide each agent with clear, structured instructions and required inputs
  4. Monitor and validate responses:
     - Check if each agent's output meets the required format and quality
     - Retry or reassign if an agent fails or produces incomplete output
  5. Integrate results:
     - Combine data, charts, and summary text into a unified final report
  6. Deliver the final output to the end user in a clear and formatted structure

  Behavioral Guidelines:
  - Always focus on planning and coordination, not execution
  - Use consistent task naming and clear communication between agents
  - Ensure all outputs are validated before integration
  - Manage partial failures gracefully — retry or reroute when needed
  - Maintain transparency in the workflow (log which agent performed which subtask)

  Example End User Request:
  "Generate a Q2 sales performance report with visualizations and an executive summary."

  Expected Orchestrator Behavior:
  - Break down → Delegate → Monitor → Integrate → Deliver
```

For information about when to use orchestration, refer to [Plan your implementation](https://www.infobip.com/docs/ai-agents/planning#multi-agent-system-considerations).