/pattern/graph-based-orchestration/

03 · Multi-AgentAgent GraphState Graph Orchestration

Graph-based Orchestration.
An executable graph of agents, tools, and state.

Agent coordination, tools, and state transitions are modeled as an explicit, executable state graph consisting of nodes and edges. It composes the two workflow relaxations — conditional edges (Routing) and bounded cycles (Loop) — over a closed node set with a validated state schema.

When to reach for it

  • Coordination must be completely traceable and testable.
  • Complex flows involving cycles and strict conditions must run stably in production.

When it backfires

  • A linear workflow is sufficient.
  • Graph maintenance outweighs the benefits.
  • Autonomous emergence is preferred over explicit control.

The tradeoff

Extreme predictability and controllability are gained against significant modeling overhead.

The mental model

A shape you can draw on a napkin.

The developer wires the node set and the admissible edges; a router node lets an LLM choose which edge to take at runtime.

  1. Nodes and edges are registered up front — the set stays closed.
  2. At conditional edges an LLM picks the next path from the registered set.
  3. Cycles are allowed, but a recursion limit bounds every loop.

Compare all six coordination patterns

RouterNode ANode BFan-in
Pitfalls

Two ways this pattern will hurt you.

Hallucinated routing — the model picks an edge that does not exist

When the router is an LLM, it can return an edge label that was never registered. The graph then either crashes or silently falls through to a default that hides the failure.

Fix · Validate the router's output against the registered edge set before transitioning. Reject and retry on mismatch; never inherit corrupted routing decisions.

Unbounded cycles — the graph never terminates

Cycles are legal in this pattern. Without an explicit guard, a router that keeps choosing the same back-edge will loop until the process is killed.

Fix · Set a hard recursion / step budget at the runtime level and an exit predicate the graph checks every iteration. Treat the budget as a correctness boundary, not a performance hint.

Framework support

Where Graph-based Orchestration is native.

LangGraphNative
AWS StrandsAWS Strands GraphNative
Microsoft Agent FrameworkNative

Search

Search patterns, frameworks, and pages.