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:
- Orchestrator agent: Receives a high-level goal (e.g. “Research and write a short report on quantum computing”).
- 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.
- Each subagent tool wraps a real
anthropic.messages.create()call with a specialized system prompt. - The orchestrator assembles the final result and prints it.
- 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:
- Use
anthropic.AsyncAnthropicclient. - Define a task list (e.g. summarize 5 different articles — use hardcoded text blobs).
- Use
asyncio.gather()to fan out all 5 summarization calls simultaneously. - Collect results and print in order with timing info (total time vs. sequential estimate).
- Add a concurrency limiter (
asyncio.Semaphore(3)) to demonstrate rate-limit safety.
How to run: python parallel_agents.py
Dependencies: anthropic (async client)