Building a multi-agent workflow with CrewAI and MCP
A "swarm" is usually the wrong mental model. What works in production is a small, fixed set of specialised agents with defined hand-offs — a pipeline, not a crowd. CrewAI gives you the agent/task/crew structure; MCP gives every agent the same clean access to tools.
The architecture that holds up
Planner ──► Researcher ──► Writer ──► Reviewer
│ │ │ │
└──────── shared MCP servers (search, files, DB) ────────┘
Each agent has: one role, one model, a bounded token budget, and access to only the MCP tools its job needs. Hand-offs pass structured data, not free text.
Why long-horizon swarms fail
95% per-step reliability over 10 steps → 0.95^10 ≈ 60% task success
99% per-step reliability over 10 steps → 0.99^10 ≈ 90%
Errors compound multiplicatively. More agents = more steps = lower success. The fix is fewer steps, verification sub-steps (a cheap model checks an expensive model's output), and bounded retries — not a bigger model.
Build order
- One agent, one tool, end to end. Get a single task working before you add a second agent.
- Add agents only at real hand-off points — where the output type genuinely changes (raw notes → draft → reviewed draft).
- Budget every agent. A hard token/step cap per run. An uncapped agent loop is your top cost incident.
- Scope MCP access per agent. The writer does not need shell access.
- Gate irreversible actions. Anything that writes to prod or sends a message prompts a human.
Local vs API
For the planner and reviewer, a mid-size local model (14–32B) is fine and keeps data in-house. The researcher, if it does hard synthesis, may warrant an API model. Route by need, not by default.
The rule
Start with a two-agent pipeline. Add a third only when you can name the specific hand-off it enables. If you're reaching for five agents, you're solving an orchestration problem you could solve with three well-scoped ones and better verification.
