Skip to content

Lesson 1 of 9 · 24m

Agents Are Control Systems, Not Chatbots

Model an agent as state, policy, actuators, and feedback so the design conversation moves beyond clever prompting.

The first agent incident I debugged was not caused by a bad model. It was caused by three engineers using the word "agent" to mean three different things: a prompt, a Python loop, and a product feature. The system dutifully combined all three into a production outage. If you want agents that survive contact with users, start with control-system vocabulary.

The mental model

An agent is a loop that observes state, chooses an action, executes that action through a tool, and incorporates feedback:

observe -> decide -> validate -> act -> record -> repeat or stop

The model is one component inside that loop. It is not the loop, not the product, and not the source of truth. State lives in your database, files, tickets, browser session, or task queue. The agent receives a view of state and proposes transitions.

Separate policy from improvisation

The policy layer decides what the agent is allowed to do. The model helps decide what is useful to do next. Do not collapse those concerns:

def may_run(tool_name: str, args: dict, ctx: RunContext) -> bool:
    if tool_name not in ctx.allowed_tools:
        return False
    if tool_name == "send_email" and not ctx.user_confirmed:
        return False
    return args.get("environment") != "production" or ctx.break_glass

This is deliberately boring code. Boring is good. Every agent needs a place where authority is expressed without probabilistic interpretation.

Autonomy is a budget, not a vibe

Define the maximum number of steps, wall-clock time, external calls, writes, and dollars the run may consume. Also define what happens when the budget expires. "Keep going until done" is how small tasks become thousand-dollar loops.

limits:
  max_steps: 18
  max_tool_calls: 30
  max_wall_clock_seconds: 900
  max_write_operations: 3
  require_confirmation_for:
    - send_email
    - merge_pull_request
    - production_write

The budget is part of the user experience. Users forgive an agent that stops cleanly and asks; they do not forgive one that spins silently or makes irreversible changes.

Prefer proposals over raw autonomy

For consequential actions, have the model produce a proposed action and a validation result before execution. The validator can be deterministic, schema-based, policy-based, or human. This preserves agency while preventing the model from being the final authority on side effects.

Field notes

  • If you cannot explain the state machine, you do not have an agent architecture yet; you have a prompt attached to luck.
  • Treat every tool result as untrusted input, including results from your own internal services.
  • Make stopping a first-class action. A good agent often chooses done, blocked, or needs_confirmation.
  • Write down who owns rollback before the first production write. After the write is the wrong time to discover no one does.

Was this lesson helpful?

Sign in to rate