Steven's Knowledge

Agent Architectures

The handful of patterns underneath every agent framework

"Agent" has become a fuzzy word. Strip away the marketing and almost every agent in production is one of a few architectures. Knowing them is more useful than picking a framework.

The Spectrum

From least to most autonomous:

  1. Workflow / chain — fixed steps, no branching by the model. Reliable, predictable, easy to debug. Most "AI features" are this.
  2. Routed workflow — the model picks which of N predefined paths to take, then the path is fixed.
  3. Tool-using assistant — the model can call tools but the overall structure is bounded (e.g., max N turns, single user goal).
  4. Autonomous agent — the model loops on its own, deciding when it's done. Can run for many minutes or hours.

More autonomy means more capability and more failure surface. Most production wins live at levels 2–3, not 4.

The Core Loop

Every agentic system above level 1 runs the same loop:

  1. Read the current state and goal.
  2. Choose an action (call a tool, ask a question, finish).
  3. Execute the action.
  4. Observe the result.
  5. Update state.
  6. Repeat or stop.

The interesting design questions are: what's in the state? When does it stop? How do you keep the context coherent across many iterations?

Stopping Conditions

Unbounded agents are dangerous and expensive. Always have:

  • Hard turn limit — absolute cap on iterations.
  • Cost / token cap — circuit breaker on spend.
  • No-progress detection — stop when consecutive turns aren't changing state.
  • Explicit completion signal — a "finish" tool the model calls when done.

ReAct, Plan-and-Execute, Reflexion

Three classic patterns:

  • ReAct — interleave reasoning and acting. The model thinks, acts, observes, thinks, acts. The default loop in most frameworks.
  • Plan-and-Execute — produce a full plan first, then execute it step by step. Better for tasks with clear structure.
  • Reflexion — after each attempt, the model critiques its own behavior and tries again. Quality up, cost up.

You can compose them; agents in the wild often plan, execute with ReAct, and reflect at the end.

Where Agents Actually Work

Today, agentic systems work best when:

  • The task has clear success criteria the model can check.
  • The action space is constrained to a curated set of safe tools.
  • The cost of failure is low or the human is in the loop.
  • The environment gives feedback the model can react to (compile errors, test failures, search results).

Agents struggle in open-ended environments without good signals. That's the current frontier.

On this page