Watch an AI agent think, act and recover.
An agent is a model in a loop: it reads the goal, picks a tool, reads the result and decides again until the job is done. Run one on three real business tasks and see every step: the reasoning, the tool calls over MCP, a failing tool and a safe retry, a human approval gate, and what each run costs.
Pick a task. Change the rules. Watch what breaks.
Turn guardrails off and see what slips through. Inject a tool failure and watch the agent retry safely. Switch model tiers and compare cost and speed on the exact same run.
Goal
Scripted, deterministic runs with sample data: no model is called and nothing leaves your browser. Token counts are estimates and prices are illustrative, for comparing tiers.
A model, a loop and a set of tools.
Everything you just watched is one loop. The model reads its context, chooses a tool, gets the result back as new context, and decides again. What makes an agent production-grade is everything around that loop: which tools it can reach, what it is allowed to do alone, how much it may spend, and how you find out when it goes wrong.
Tool use
The model never runs anything itself. It returns a structured request, a tool name plus JSON arguments; your code executes it and hands back the result. Good tools are narrow, clearly named, typed, and return errors written for the model to act on.
MCP
The Model Context Protocol is an open standard for connecting AI apps to tools and data. A server exposes tools, resources and prompts once, and any MCP client (Claude, an IDE, your own agent) can use them. One interface instead of a custom integration per app.
Context engineering
Each turn, the model knows only what is in its context window: system prompt, tool definitions, history, retrieved documents. Tool definitions alone are paid for on every call. I trim, summarise and retrieve just in time instead of stuffing everything in.
Guardrails & human-in-the-loop
Rules live in code, not just in the prompt. Irreversible or high-value actions such as refunds, outbound messages and deletes pause for approval, and outputs are checked for sensitive data and unsupported numbers before they leave.
Evals
Agents are tested like software: a set of real tasks with expected outcomes, graded by code checks and LLM-as-judge rubrics, and re-run on every prompt or model change so regressions show up before customers see them.
Observability
Every run leaves a trace: each model call, tool call, latency, token count and cost. That is how you debug a wrong answer, find the slow step, and prove where a cheaper model is good enough.
Workflow or agent? Usually a workflow.
The most useful call in AI automation is knowing when not to build an agent.
Workflow
- The path
- Known in advance. Fixed steps, with a model call where judgement is needed.
- Behaviour
- Predictable and easy to test.
- Cost & speed
- Low and the same every run.
- Good for
- Lead routing, invoice extraction, scheduled reports, follow-ups.
Agent
- The path
- Chosen by the model, step by step, from the tools it has.
- Behaviour
- Flexible, so it needs guardrails, budgets and evals.
- Cost & speed
- Higher and variable.
- Good for
- Research, support triage with many edge cases, troubleshooting across systems.
Most “AI agents” businesses ask for are really workflows with one or two model calls inside. I start there, and add autonomy only where the path genuinely can’t be known ahead of time.
Eight rules for agents that are safe to put in production.
- Start with a workflow. Earn the agent.
Fixed steps first; hand the model control only where the path really varies.
- Few tools, sharp edges.
Each tool does one thing, with typed inputs and errors the model can act on.
- Put the rules in code.
A prompt is a request. A guardrail is a guarantee.
- Humans approve the irreversible.
Money, messages to new people and deletes wait for a person.
- Make every action safe to retry.
Idempotency keys mean a retry can never charge or send twice.
- Budget everything.
Max steps, tokens, spend and time, with a clean handoff when one runs out.
- Ground every claim.
Numbers and facts in the output must trace back to a tool result.
- Eval before you ship. Trace after.
Test on real tasks, then keep a trace of every production run.
Want an agent, or a workflow, that runs your busywork?
I design and build production AI automations through ScalingThis: scoped, guarded, measured, and handed over with the traces to prove they work.