agentic-ai-course

Module 6 — Multi-Agent Orchestration

Every agent so far has been one Claude call (or loop of calls) doing everything itself. This module splits the work: an orchestrator breaks a goal into sub-tasks and delegates each to a narrow specialist — a separate Claude call with its own system prompt.

What you’ll learn

The core idea

def call_specialist(specialist: str, task: str) -> str:
    response = client.messages.create(
        model=MODEL,
        system=SPECIALIST_PROMPTS[specialist],
        messages=[{"role": "user", "content": task}],
    )
    return "".join(b.text for b in response.content if b.type == "text")

From the orchestrator’s point of view, delegate_to_researcher is a tool exactly like calculate was in Module 2 — it has a name, a description, and a JSON schema. The orchestrator’s agent loop doesn’t change at all; only what’s behind the tool does. This is the pattern to reach for when a single system prompt is being pulled in too many directions (e.g. “be a rigorous fact-checker AND a punchy copywriter”) — split it into two specialists instead of writing one compromised prompt.

Files

Run it

pip install -r requirements.txt
export ANTHROPIC_API_KEY=your_key_here
python exercise.py   # after filling in the TODOs
python solution.py   # to compare against a working version

Next

Module 7 — Streaming Responses — so far every response has appeared all at once; this module streams it token by token.