Ismail Khan

Agentic Design Patterns Twelve patterns, one question: who decides what runs next? Google Cloud Architecture Center · each glyph is the pattern's own shape WHO DECIDES WHAT RUNS NEXT? predefined logic · fewer model calls · rigid but cheap runtime reasoning · more calls and latency · adaptive CODE DECIDES a workflow agent runs the plan — no reasoning call to route A MODEL DECIDES the route is reasoned out fresh, every single request Sequential Fixed linear chain — each agent's output is the next one's input. Use when: the steps are known up front and never change. Parallel Fan out to independent subagents at once, then gather and consolidate. Use when: sub-tasks are independent and you want the latency back. Loop Repeat a sequence of subagents until an exit condition is met. Use when: polling or repeating a fixed check until it holds. Risk: get the exit condition wrong and it never stops. implements Loop Review and critique A generator writes; a critic gates it against fixed criteria. Use when: output must pass validation before it ships. implements Loop Iterative refinement Agents keep reworking one result held in session state. Use when: the output is too complex to nail in a single pass. START HERE Single agent One model, one tool set, one comprehensive system prompt. Use when: starting out — nail the prompt and tools before adding agents. Coordinator A central model splits the request and routes each part to a specialist. Use when: varied input needs routing decided at runtime. implements Coordinator Hierarchical task decomposition Coordinators delegating to coordinators, down to worker agents. Use when: the problem is ambiguous and breaking it down IS the work. Swarm All-to-all debate between specialists. No orchestrator at all. Use when: the answer benefits from argument — and you can afford it. Risk: without an exit condition it may never converge. CROSS-CUTTING not alternatives to the above — these drop into any of them thought act observe ReAct Thought, action, observation — the loop inside one agent. Use when: one agent picks wrong tools — fix reasoning first. approve? Human-in-the-loop The agent pauses at a checkpoint and waits for a person. Use when: high-stakes, subjective, or compliance-gated calls. Custom logic Orchestration written as code — branches, mixed patterns. Use when: nothing above fits. Escape hatch, not default.