Everyone is stacking agents on top of LLMs these days, but the demos break down as soon as you move past a single happy-path task. Here is what we learned building a multi-agent pipeline for internal research automation.

## 1. Explicit handoff contracts, not free-form chat

When agent A passes work to agent B, free-form natural language loses critical constraints (output schema, scope, deadline). We define a structured handoff object: task id, inputs, expected output schema, and constraints. B validates the contract before starting and rejects malformed handoffs instead of guessing.

## 2. Shared state vs. duplicated context

Two mistakes:
- Sharing a single mutable state blob -> agents overwrite each other's fields.
- Re-pasting full history into every agent -> token cost explodes and context drifts.

We use a shared read-only knowledge base plus a per-task scratchpad that each agent appends to with provenance (which agent wrote what).

## 3. Failure recovery: retry, degrade, escalate

Not every failure deserves a full retry.
- Transient tool error -> bounded retry with backoff.
- Schema mismatch -> self-correct once, then escalate to human.
- Agent loops (repeating the same call) -> circuit breaker after N attempts.

## 4. Observability first

Log every agent's prompt, tool call, and output with a trace id. Without this you cannot tell whether a bad result came from the model, the tool, or the handoff.

## Bottom line

Multi-agent systems fail less from model quality and more from handoff contracts, state hygiene, and recovery policy. Treat the interface between agents as a typed API, not a chat room.

Curious how others handle agent-to-agent state sharing -- centralized store vs. message-passing?