AI Agent Patterns & Orchestration

Choose an orchestration pattern based on the job instead of defaulting to “more agents”.

Practical mini-lab

Research workflow: parallel first, synthesize last

A market-research request needs product data, customer reviews and competitor pricing. Three independent reads can run in parallel, then one synthesizer combines them.

User question ├─ Product researcher ─┐ ├─ Review researcher ─┼─→ Synthesizer → final answer └─ Pricing researcher ┘
results = await asyncio.gather(
    product_agent.run(question),
    review_agent.run(question),
    pricing_agent.run(question),
)
answer = await synthesizer.run({"sources": results})
Trade-off: parallel agents reduce latency when work is independent, but they cost more tokens and become wasteful when every step depends on the previous one.