Article: Google’s Agent Development Kit (ADK) offers two main ways to manage tasks.

Dynamic Multi-Agent Routing

In the routing model a central coordinator receives the user’s request and dispatches it to specialist agents. The coordinator decides which specialist should act, the specialist performs its piece of work, and control returns to the parent.

  • How it works – The coordinator picks a specialist, forwards the task, then waits for a response before moving on.
  • Pros – Flexibility shines. Because the LLM picks the path at runtime, the system adapts to new or unexpected inputs without rewriting the flow.
  • Cons – Every hop adds network and processing overhead, so latency climbs compared with a straight-line pipeline.

Sequential Workflow Loops

The loop model replaces the coordinator with a single LoopAgent that walks through a predetermined sequence of steps, sharing a mutable session state.

  • How it works – Agents read a shared key, update it, and hand control to the next step until the sequence ends.
  • Pros – Predictability. The order never changes, making debugging and performance tuning straightforward.
  • Cons – Rigidity. Any need to deviate from the fixed order forces a redesign of the loop.

Hands-On Test: A Math Expression Parser

To see the patterns in action, we built a simple parser that evaluates arithmetic expressions using four specialist agents: adder, subtracter, multiplier, and divider.

Lessons from the Workflow Loop

  1. Prevent infinite loops – We instructed each agent to output text and end its turn immediately after updating the shared state. Without that guard the loop could spin forever.
  2. Maintain math logic – We gave the adder explicit guidance to respect the order of operations, stopping it from breaking subtraction rules.
  3. Avoid silent exits – We forced agents to print the final result before invoking the exit tool, so the user sees the outcome instead of an abrupt termination.

Error Handling

We added a zero-division guard in front of the divider specialist. The guard checks the divisor first; if it’s zero, it halts the process, sparing the whole system from a runtime exception.

Which Pattern Fits Your Project?

  • Choose Multi-Agent Routing when tasks evolve on the fly, inputs vary widely, or you need the LLM to decide the best specialist at runtime. The trade-off is higher latency, but the system handles unanticipated scenarios without code changes.
  • Choose Workflow Loops when you have a well-defined pipeline—data cleaning, transformation, aggregation, for example—where each step must happen in a strict order. The benefit is lower latency and easier debugging, at the cost of being unable to branch dynamically.