Observe, Plan, Act, Verify

An agent is a loop plus tools

Everything up to this point has been a single request-response interaction with a model. An AI agent is a step up from that: an application that lets a model choose among a controlled set of tools, across multiple steps, in order to work toward a goal, rather than answering in one shot. A simple agent loop looks like this: it receives a goal, observes the current state of things, proposes one specific action, calls the corresponding tool, reads back that tool's result, and then decides whether to continue looping or stop. It's important to be precise about where the real authority sits in that loop: the surrounding application code - often called the agent harness - is what actually owns the loop itself, its safety limits, and the real, executable tool code behind each action. The model only ever proposes what to do next; it never directly executes anything on its own.

goal: "Find and report any service using more than 80% memory"
step 1: observe  -> call tool: list_processes()
step 2: plan     -> model: "check memory of the top 3 by RSS"
step 3: act      -> call tool: get_memory(pid=4821)
step 4: verify    -> result matches success condition? if not, loop again

Because a model can, in principle, keep proposing actions indefinitely (or get stuck in a repetitive loop chasing the same failed approach), the harness needs firm limits: a maximum number of steps, a maximum elapsed time, caps on input/output size per step, and detection for the model repeating the same action over and over without progress. Just as important, define an explicit, checkable success condition up front, rather than simply trusting the model's own claim that it's "done" - a model confidently declaring success is not the same as the goal actually being achieved.

Analogy: The model is a junior operator radioing in suggestions for what to do next. The agent harness is the runbook that says what's allowed, the access badge that determines what doors actually open, the supervisor reviewing risky calls, and the circuit breaker that trips if something goes wrong repeatedly.