Skip to main content
When requests require multiple skills—research, calculations, approvals—an orchestrator coordinates the flow and keeps users updated through streaming events.

What you’ll build

  • An orchestrator agent that plans steps, invokes sub-agents/tools, and composes the final reply.
  • Tasks that enforce ordering (e.g., research → summarize → verify).
  • NDJSON streaming so users see progress.

Prerequisites

  • CrewAI multi-agent setup from crew-ai.mdx
  • At least two specialized agents or tools to orchestrate

Steps

1

List stages

Define the stages your orchestrator must follow (e.g., gather context → call tool → summarize).
2

Write orchestration rules

In the backstory, describe exactly when to call each sub-agent/tool and how to merge outputs.
3

Enable streaming

Keep stream=True on the Crew so CometChat receives progress as steps complete.
4

Test with complex prompts

Try multi-part requests to ensure the orchestrator doesn’t skip steps.

Example backstory

src/crew_demo/config/agents.yaml
orchestrator:
  role: Orchestration Lead
  goal: Plan and execute the right sequence of tools/agents
  backstory: >
    Always outline a short plan, then execute tools or call specialists as needed.
    Merge their findings into one concise answer. Do not expose raw plan text to the user.
src/crew_demo/config/tasks.yaml
orchestrator_task:
  description: >
    Plan the best sequence to solve: {user_message}
  expected_output: >
    A clear answer plus any key data. Mention which tools were used.
  agent: orchestrator
Use Process.hierarchical if you want the orchestrator to decide dynamically which sub-agent to call next.

CometChat setup

Provider: CrewAI, Agent ID: orchestrator, Deployment URL: /kickoff. Add suggested prompts like “Find our three latest deals, then draft a summary for the customer” to exercise orchestration.