A workflow follows your steps. An agent pursues your goal. That difference sounds philosophical right up until you have to write the goal down.

Because the goal you hand an agent is a specification, and it gets executed with a compiler's literalism. Underspecify it and the agent fills the gaps with whatever best satisfies the words you actually used.

Three things that have to be written down

The first is success criteria a machine can check. "Improve the report" is a hope with nothing to check against. "Every section contains current-quarter figures, each with a cited source" is checkable, by the agent and by you. If success can only be assessed by a human squinting at the output, you have delegated a vibe.

The second is boundaries, enforced outside the prompt. What it may spend, which systems it may touch, what it must never modify. These belong in credentials and runtime limits, not in a politely worded instruction. More on that distinction in the guardrails post.

The third is stop conditions: done, blocked, out of budget, and the fourth one everyone forgets: looping. An agent repeating the same failing approach will do so cheerfully until something external intervenes.

python
if risk == "high":
    escalate_to_human()
elif retries > 2:
    stop_with_reason("retry budget exceeded")
elif evidence_quality < threshold:
    ask_for_more_context()
elif tool_budget.remaining == 0:
    stop_with_reason("tool budget exhausted")
else:
    continue_workflow()

The code bounds the action and gives an explicit reason for each stop.

The price is more early stops and escalations than an unbounded agent produces, so count them per condition. One that fires constantly is mis-set or pointing at a real defect; one that has never fired has never been tested.

The review exercise worth stealing

Hand your goal specification to a colleague and ask them a single question: what would a malicious-but-compliant reading of this do?

Leave "what should it do" aside and ask what it could do while technically satisfying every word you wrote. That reading is available to the agent too, and it is the one you will meet in production when the inputs stop resembling your test cases.

The answers are usually uncomfortable and always cheap to fix at this stage. "Reduce open ticket count" is satisfied by closing tickets without resolving them. "Maximise response quality" is satisfied by taking forty minutes and thirty tool calls per request.

Vague goals produce confident agents doing the wrong thing efficiently. The first run usually looks impressive, which is precisely what delays the discovery.

Write down what success means for your agent precisely enough that a stranger could verify it. Until you can, keep a human approving its output.

Terms in this piece

About this explainer

Format
Explainer
Level
Practitioner
Read
2 min read
Published
Jun 21, 2026

Short mental models: one idea, why it matters, what to do about it.

Comparison · · 1 min read

LangGraph vs writing the agent loop yourself

Two ways to write the same supervisor, an explicit state graph or a loop your own code owns on the model API. Compared on control flow, tracing, testing, checkpointing and what each makes hard.