Back to InsightsArchitecture & AI

Architecting Resilient Multi-Agent AI Workflows in Production

Pankajkumar Mori9 min read

A multi-agent demo is easy to build and almost impossible to trust. Two or three LLM calls chained together, a bit of tool use, a happy path that works every time you show it to a client. The gap between that demo and a system you can run unattended in production is not a matter of adding more agents. It is a matter of assuming, from the first line of code, that every step will eventually fail, and designing around that instead of hoping it won't happen.

The failure mode nobody demos

Most agent pipelines are built and tested against a narrow set of well-behaved inputs, then shipped against the real world, which is not well-behaved. A tool call times out. An upstream API changes its response shape without warning. A model returns output that is almost valid JSON but not quite. None of these are exotic edge cases. Over a few thousand runs, they are the median case.

The pattern we see most often in systems that fail in production is a single long-running chain with no checkpoints: agent A calls agent B, which calls agent C, and if anything anywhere in that chain throws, the entire multi-minute run is lost and has to start over from the top. That is fine for a demo. It is not fine for a system a client is paying for, because it means every transient failure costs full replay latency and full replay cost, and the failure rate compounds with every additional agent in the chain.

Treat every agent boundary as an untrusted boundary

The single highest-leverage change we make to a client's agent architecture is almost always the same one: stop treating the handoff between two agents as a function call and start treating it as a network call to a service you do not control. That reframing changes everything downstream.

It means every agent-to-agent handoff gets a schema the receiving agent validates against, not just parses optimistically. It means every tool call gets an explicit timeout and a retry policy with backoff, not an unbounded await. It means the output of a generative step is never trusted directly as input to a state-changing action (a database write, a payment, an email send) without a deterministic validation layer in between that has nothing to do with the model itself.

Checkpoints, not chains

Instead of one long chain, we design workflows as a sequence of checkpointed stages, each with its own persisted state. If stage four fails, the system resumes at stage four with the outputs of stages one through three intact, rather than re-running the whole pipeline from the start. This sounds like an obvious engineering pattern because it is one. It is also the single most commonly skipped step in agent systems built quickly, because checkpointing adds real implementation work that a demo does not need and a production system cannot ship without.

  • Idempotency keys on every state-changing tool call, so a retried step cannot double-charge a card or double-send an email
  • A dead letter path for runs that exhaust their retry budget, routed to a human queue instead of silently disappearing
  • Per-stage timeouts tuned to that stage's actual latency profile, not one global timeout for the entire run
  • Structured, versioned schemas for every inter-agent message, validated at the boundary before the next stage ever sees it

Observability is not optional past three agents

Below two or three agents, you can debug a bad run by reading the raw transcript. Past that, you cannot, because the transcript is thousands of tokens across dozens of tool calls and the actual point of failure is buried somewhere in the middle. Every production agent system we build gets per-hop tracing from day one: which agent ran, what it received, what it returned, how long it took, and what it cost, all queryable as structured data rather than log text you grep through by hand.

This is what actually lets you answer the question that matters in week three of running a system in production, which is never "is the AI good" but always "why did run 4,821 fail and did we lose anything when it did." Without per-hop tracing, that question takes an afternoon. With it, it takes two minutes.

A founder's note on why this matters

I have watched enough agent projects get built fast and then quietly abandoned six weeks after launch, once the failure rate under real traffic became too expensive to keep patching by hand. The instinct in this industry right now is to ship the demo and call it done. We do the opposite on purpose. An AI system that fails loudly, recovers cleanly, and tells you exactly what went wrong is worth more to a business than one that looks more impressive in a sales call and falls over the first week it meets real users. That is not a caveat we add to agent work. It is the actual engineering.