Implementation Guide — Multi-Agent Examples

This directory originally contained Python example scripts that were removed from this archive.
An AI assistant can recreate them by following the instructions below.


orchestrator_subagent.py

Purpose: Implement an orchestrator–subagent pattern where one Claude instance directs others.

What to implement:

  1. Orchestrator agent: Receives a high-level goal (e.g. “Research and write a short report on quantum computing”).
  2. The orchestrator uses tool-use to call two subagent tools:
    • research_agent(topic: str) → str — a second Claude call that searches/summarizes.
    • writer_agent(research: str, format: str) → str — a third Claude call that formats the output.
  3. Each subagent tool wraps a real anthropic.messages.create() call with a specialized system prompt.
  4. The orchestrator assembles the final result and prints it.
  5. Show the full call trace (which agent was called with what input).

How to run: python orchestrator_subagent.py
Dependencies: anthropic


parallel_agents.py

Purpose: Run multiple Claude agents concurrently using asyncio for faster throughput.

What to implement:

  1. Use anthropic.AsyncAnthropic client.
  2. Define a task list (e.g. summarize 5 different articles — use hardcoded text blobs).
  3. Use asyncio.gather() to fan out all 5 summarization calls simultaneously.
  4. Collect results and print in order with timing info (total time vs. sequential estimate).
  5. Add a concurrency limiter (asyncio.Semaphore(3)) to demonstrate rate-limit safety.

How to run: python parallel_agents.py
Dependencies: anthropic (async client)