A model that loops: it observes, decides, calls something outside itself, reads the result, and decides again. Autonomy is a dial, not a category — and every notch costs predictability.
1. Agent, workflow, chatbot: three different things
Chatbot
Workflow
Agent
Control flow
Human writes every turn
Code decides the path
Model decides the next step
Number of model calls
One per message
Fixed, known in advance
Variable, bounded by a budget
Failure surface
Bad answer
Brittle branch
Loops, drift, side effects
Best for
Conversation, drafting
Repeatable business process
Open-ended goals over tools
Testability
Prompt evals
Deterministic unit tests
Trajectory evals plus budgets
Default to the workflow. If you can draw the decision tree, do not let a model guess it. Agency is worth paying for only when the path genuinely depends on what the tools return.
Autonomy ladder
Level
Who decides
Example
Risk
L0 — suggested
Human
Draft a reply
Almost none
L1 — assisted
Human, model retrieves
Search and propose a fix
Bad evidence
L2 — approve each action
Model proposes, human confirms
Create a ticket after review
Confirmation fatigue
L3 — bounded autonomy
Model, inside limits
Refund up to a threshold
Silent accumulation of small errors
L4 — unsupervised
Model
Nightly reconciliation with escalation
Blast radius
2. The loop
Dashed path: the loop repeats with the observation added to context. The exit must be a budget, not a hope.
The canonical formulation is ReAct: interleave a short reasoning trace with an action, feed the observation back, repeat. Modern implementations add an explicit verification step before the exit.
while budget.remaining() and steps < MAX_STEPS:
thought = model.reason(goal, history, tools)
if thought.is_final: break
action = thought.tool_call # validated against schema
result = registry.invoke(action, timeout=..., idempotency_key=...)
history += [thought, action, truncate(result)]
verify(history) # own call, own criteria
return answer_or_escalation(history)
3. The four capabilities
Capability
Question it answers
Implemented by
Planning
What sequence of steps reaches the goal?
Decomposition prompt, plan-and-execute, tree search
Tool use
How do I affect the world or read live data?
Typed function calling, MCP servers, HTTP APIs
Memory
What must survive the next turn?
Scratchpad, summary, vector store, structured state
Reflection
Is the result good enough to ship?
Self-critique, verifier model, executable checks
Reflection with a checker beats reflection by opinion. A test that runs, a schema that validates, or a diff that applies gives the agent ground truth. "Are you sure?" gives it a second guess.
4. Orchestration patterns
Pattern
Shape
Use when
Cost
Single agent + tools
One loop, many tools
Most tasks; start here
Low
Router
Classify, then dispatch to a specialist prompt
Distinct intents with different contracts
Low
Supervisor
Manager agent delegates to workers, merges results
Parallelisable sub-tasks
Medium
Pipeline / chain
Fixed sequence of agents
Stages with clean hand-offs
Low, deterministic
Hierarchical
Supervisors of supervisors
Large tool surfaces
High, hard to debug
Swarm / handoff
Peers pass control
Support triage with specialisms
Medium, unbounded
Multi-agent is not free accuracy. Every hand-off loses context and adds a place for errors to hide. Add an agent only when it removes a tool-selection conflict or isolates a permission boundary.
5. Designing tools the model can use
Rule
Why
One verb per tool; no boolean mode flags
The model picks tools by description, not by branching inside a call
Descriptions state when not to use it
Prevents the most common wrong selection
Schema validated before execution
Turns a malformed call into a clear error the model can fix
The agent must not inherit the user's full authority
{
"name": "get_order_status",
"description": "Return status for one order. Use only when the user supplies an order id; use search_orders when they describe the order instead.",
"inputSchema": { "type": "object", "properties": { "order_id": { "type": "string", "pattern": "^[A-Z]{2}-\\d{6}$" } }, "required": ["order_id"] },
"outputSchema": { "type": "object", "properties": { "status": { "enum": ["placed","shipped","delivered","cancelled"] }, "eta_days": { "type": "integer" } } }
}
6. Memory and context
Layer
Contents
Lifetime
Failure if misused
Working context
Goal, recent steps, tool results
One task
Overflow, lost early instructions
Scratchpad
Plan, open questions, decisions
One task
Stale plan followed blindly
Episodic store
Past tasks, outcomes, corrections
Weeks
Retrieving irrelevant precedent
Semantic store
Domain knowledge, documents
Long
Outdated or poisoned content
Structured state
Entities, ids, statuses
Long
Divergence from the system of record
Summarise, do not accumulate. Compaction — replacing old turns with a structured summary — keeps the instruction at the top of the window and the cost flat. Keep the raw transcript outside the prompt for audit.
At 99% per step, a 50-step task succeeds 60% of the time. At 95%, it succeeds 8% of the time. Autonomy multiplies error, which is why budgets and checkpoints matter more than model choice.
Failure mode
Symptom
Control
Loop
Same tool called with the same arguments
Repeat detection, max steps, forced replan
Goal drift
Answers a nearby question
Restate the goal every N steps
Context rot
Ignores early instructions
Compaction, pinned system block
Overreach
Deletes or sends more than asked
Least privilege, dry-run mode, approvals
False completion
Claims success without evidence
Verifier with executable checks
Cascading bad data
A wrong id propagates
Validate entities against the source before use
8. Guardrails and authority
Control
Implementation
Blocks
Least privilege
Per-tool, per-tenant credentials, no wildcard scopes
Full-account damage
Human in the loop
Approval gate for irreversible actions
Silent destructive writes
Sandbox
Container, no network by default, read-only mounts
Code execution escapes
Budgets
Tokens, steps, money, wall-clock per task
Runaway cost
Allow-list
Domains, tables, repositories the agent may touch
Scope creep
Dry run
Produce the diff or the payload, apply on approval
Irreversible mistakes
Audit log
Every call with arguments, result hash, actor
Unexplainable outcomes
Prompt injection is the agent's main attack surface. Any text the agent reads — a web page, an email, a PDF, a tool description — is a potential instruction. Keep retrieved content in a clearly delimited, untrusted block and never let it authorise a tool call.
9. Observability and evaluation
Signal
Why it matters
Trajectory (steps, tools, arguments, results)
The only way to explain a wrong outcome
Steps and tokens per task
Leading indicator of loops and cost drift
Tool error rate by tool
Finds bad schemas faster than prompt tweaks
Escalation and abstention rate
Distinguishes "confident" from "correct"
Outcome evals on frozen scenarios
Compares versions on end state, not wording
Replay of failed trajectories
Turns incidents into regression tests
Evaluate on three levels: final answer correctness, trajectory efficiency (did it take the short path?), and safety (did it stay inside its permissions?). A single end-to-end score hides all three.