← Lab
Experiment·Agentic Systems & Orchestration·5 min read

Agent Patterns Catalog

Five control-flow patterns worth knowing, and the question that decides which one a task needs.

Agent Patterns Catalog

Most agent architecture arguments dissolve once you ask a narrower question: who decides what happens next? These five patterns are the useful answers, from most deterministic to least.

01Prompt chainingSplit one hard task into ordered steps, each with its own prompt and its own check. Use when the task decomposes cleanly; avoid when steps are independent, since chaining only adds latency.
02RoutingClassify first, then send to a specialist with a narrow prompt and a small tool set. Use when inputs fall into distinct kinds; avoid building the router on an LLM when a classifier is cheaper and more accurate.
03ParallelizationFan out independent work and merge. The only pattern that makes a pipeline faster rather than slower. Avoid when later steps need earlier output.
04Agent loopThink, act, observe, repeat — with a hard iteration cap and a timeout that are not optional. Use when the step count is genuinely unknown.
05Structured outputMake the model fill a schema rather than write prose you then parse. Validation failure is a retry, not a crash. Use anywhere output feeds another system.

Choosing between them

Work down the list and stop at the first pattern that can do the job. If you can enumerate the steps on a whiteboard, you do not need the agent loop. If the steps have no dependency on each other, parallelization beats chaining. If the output is consumed by code, structured output is not optional regardless of which other pattern you picked.

What to take away
  • Ask who decides what happens next — that picks the pattern.
  • Stop at the first pattern that can do the job.
  • Routing on a classifier beats routing on an LLM.
  • Structured output is mandatory wherever code consumes the result.

Field notes on building production AI systems — collected, verified and written up so they are useful to anyone working on the same problems.

smoke
“Innovation distinguishes between a leader and a follower.”

Need an AI system that holds up in production? Tell me what breaks today and I'll tell you what I'd build.

Call Me now !

mail

abdelmajidzaddi088@gmail.com

address

Mohammedia, Morocco

phone

+212 695 557 631