Skip to main content
Back to Blog
Blog

Intelligent Routing: How AI Agents Talk to Each Other

Routing is the hidden infrastructure of multi-agent systems. Here's how MadoHub makes agent-to-agent communication explicit, inspectable, and configurable.

In any multi-agent system, the agents themselves get most of the attention. But the routing layer — the mechanism that decides what goes where — is what determines whether the system works or collapses into incoherent noise.

What routing actually means

Routing is the process of taking an agent's output and delivering it to the right destination in the right format at the right time. This sounds trivial, but each of those three dimensions introduces real complexity:

  • Right destination: Does the output go to one agent or many? Does it depend on the content?
  • Right format: Should the output be passed as-is, summarized, or transformed?
  • Right time: Should the downstream agent start immediately, wait for multiple inputs, or poll for updates?

Triggers: when a route fires

Every connection in MadoHub carries a trigger — the condition that decides when its output gets delivered downstream. There are four:

  • on-complete: fires after the upstream agent finishes its current task
  • on-idle: fires when the upstream agent goes quiet without an explicit completion signal
  • on-keyword: watches the tile's output for a keyword you specify and fires when it appears
  • always: delivers continuously regardless of state, useful for tapping a running process

One nuance worth knowing: on-complete and on-idle aren't actually two different speeds. Under the hood they're handled identically — both start the same idle timer and wait roughly 8 seconds of silence after the signal before delivering. Neither one fires instantly.

Transform nodes

Sometimes the raw output of one agent isn't suitable input for the next. A code generator might produce a full file with explanatory comments, but the test writer only needs the function signatures.

Transform nodes sit on connections and reshape the data in transit. Each connection carries one of five transform types:

  • raw: the last 10 lines of output, untouched
  • summary: an AI-generated summary of the output
  • full-output: the last 30 lines of output, for when more context is needed
  • prompt-wrap: wraps the output in a template with variables like {output}, {round}, {maxRounds}, and {source}
  • ai-routing: an AI-generated, context-aware prompt built specifically for the downstream agent (requires an API key)

Guarding against runaway loops

Give two agents a connection back to each other and you've built a loop. Loops are how review-and-revise workflows work — but an unbounded loop is also how you burn through a context window or a budget in minutes.

MadoHub bounds this with loop protection on every route: a maximum round count (five by default, configurable from one to twenty), a cooldown between deliveries (three seconds by default, configurable up to thirty), and an optional stop keyword — a case-insensitive substring you supply that ends the loop the moment it appears in an agent's output.

For a different kind of safety net, there's Peer-Veto: a delivery gate, not a voting system. It doesn't ask agents to agree on anything. It simply blocks a delivery when the target tile is missing or its process has already exited, so a route never silently posts into a tile that can't receive it.

Inspecting the routing layer

The biggest problem with most agent orchestration systems is opacity. When something goes wrong, you can't tell whether the issue was the agent, the prompt, or the routing.

MadoHub logs every routing decision. Click any connection to see the full history: what was sent, when it was sent, which trigger fired, and whether a transform was applied. This makes debugging multi-agent workflows as straightforward as reading a network trace.

Routing is infrastructure. It's not glamorous. But getting it right is the difference between a demo and a system you can rely on.