Build an orchestrator-workers agent for research tasks
Когда использовать: The task is too big for one LLM pass but decomposes into parallel subtasks (e.g., research 10 competitors).
Предварительные требования
- Python 3.10+ — standard
- MCP servers you want the agent to use — List them in the mcp-agent config
Поток
-
Define worker agentsCreate 2 Agents —
scraperwith the firecrawl server,writerwith filesystem. Give each a focused instruction set.✓ Скопировано→ Two Agent instances -
Wire the orchestratorWrap them with
create_orchestrator(planner_llm=..., workers=[scraper, writer]). Max iterations = 10.✓ Скопировано→ Orchestrator returns plan + execution handle -
Run a real taskRun: 'Research the 5 top-rated Postgres MCPs on GitHub. For each, write a 1-page summary to ./reports/<slug>.md.'✓ Скопировано→ 5 files generated with coherent content
Итог: A parallelized agent that completes what would be 30 min of manual multi-step work in 3-5 min.
Подводные камни
- Orchestrator creates too many or too few subtasks — Give the planner LLM explicit guidance: 'break into 3-7 subtasks, each <5 minutes of work'
- Workers re-fetch the same data — Share a cache via the app state or pass results explicitly through the plan