Agent patterns

Almost every agent you'll ever build is a variation on one of a small number of patterns. The patterns aren't magic; they're just the shapes that work and the shapes that don't, learned by everyone who's shipped real agents. Knowing which pattern fits your task is the difference between "this took a week" and "this took a month and still doesn't work."

Why patterns matter.

A new agent builder usually starts by reinventing. Custom prompts, custom loop, custom memory, custom everything. Two weeks in, you realize you've just built a slightly worse version of something the field already figured out. The patterns in this section exist because thousands of people hit the same walls, and the patterns are what they settled on.

The upside: once you recognize which pattern a task wants, the agent usually falls out quickly. The downside: using the wrong pattern is brutal. A plan-execute agent trying to handle an exploratory task will keep rewriting its plan forever. A ReAct agent on a long complex task will lose its way by step 15. Match the pattern to the task or pay in debugging time.

The five patterns at a glance.

~ which pattern, for what ~

Most serious agents are two or three of these layered together: a ReAct core, a plan-execute wrapper for the big picture, evaluation running on every output, prompt caching on the system prompt. The patterns combine.

The five pages in this section.

How these patterns actually combine in practice.

A real production agent is usually a small stack of patterns, not one. Example: an operations-reporting agent that runs every morning might use plan-execute at the top level (decide today's report outline), ReAct inside each step (the agent calls tools, reads results, adjusts), prompt caching on the system prompt and tool list (saves money every run), and evaluation running in parallel to score each report on completeness. Four patterns, one agent.

The section pages treat each pattern on its own. But as you read, keep the composition in mind. Understanding patterns as Lego blocks, not as choices, is what lets you build agents that actually hold up.