github

Multi-agent workflows often fail. Here’s how to engineer ones that don’t. (opens in new tab)

Multi-agent workflows often fail because agents make implicit assumptions about state, ordering, and intended actions. The post argues that these systems should be engineered like distributed software rather than treated as chat interfaces. Typed schemas, explicit action definitions, and MCP-enforced interfaces make agent behavior more predictable and failures easier to contain.

Typed Schemas Prevent Data Drift

  • Natural-language exchanges and inconsistent JSON lead to changing field names, mismatched types, and ambiguous payloads.
  • Typed interfaces define machine-checkable contracts, such as a UserProfile with fixed fields and allowed plan values.
  • Schema violations can fail fast, triggering retries, repairs, or escalation before invalid state spreads.
  • Debugging becomes contract-based instead of dependent on inspecting logs and guessing.

Action Schemas Clarify Intent

  • Agents cannot reliably infer what “take action” means; they may assign, close, escalate, or do nothing.
  • Action schemas restrict outcomes to explicit, valid choices such as:
    • Requesting more information
    • Assigning an issue
    • Closing an issue as a duplicate
    • Taking no action
  • A discriminated union or similar structure ensures every agent returns one recognized action.
  • Invalid or ambiguous actions can be rejected, retried, or escalated.

MCP Enforces Agent Interfaces

  • Schemas and action definitions are only conventions unless consistently enforced.
  • Model Context Protocol (MCP) provides explicit input and output schemas for tools and resources.
  • Calls are validated before execution, preventing agents from inventing fields, omitting required inputs, or drifting between interfaces.
  • MCP therefore acts as the enforcement layer for both data structure and intended behavior.

Reliable multi-agent systems require explicit contracts at every boundary. Engineers should treat agents like code components: define their data and actions precisely, enforce interfaces with mechanisms such as MCP, and prevent invalid state from propagating.