Claude Code, Codex, Cursor and Amp look different, but underneath they're the same thing: a model, a few tools, and a while loop. Once you see the loop, you'll understand why agents succeed, why they fail, and what you control.
Key takeaways
- An agent is a model using tools in a loop: it asks for a tool, the harness runs it, the result goes back in, repeat until done.
- Tool calls are just JSON. The model never runs anything itself; ordinary code (the harness) does.
- The model is stateless. Everything it knows about your task is in its context window: system prompt, tools, memory files, your messages and every tool result.
- Errors compound over steps. At 95% accuracy per step, a 10-step task succeeds about 60% of the time.
- Agents don't push back on vague requests. They guess confidently, so what you put in the context decides what comes out.
Try it with your agent
See the loop from the inside:
List the tools you have in this session and what each one does. Mark which ones can change files or run commands. Then, without running anything, show me the exact sequence of tool calls you'd make to find where we handle user login.
Transcript
Intro
Claude Code, Codex, Cursor and Amp all look different. Under the hood, they're almost the same program. Once you see it, a lot of agent behavior suddenly makes sense.
The recipe
Anthropic's definition fits in one line. An agent is a model, using tools, in a loop. The model decides what to do next. The tools let it act on the world. And the loop keeps it going until the job is done.
Thorsten Ball, who builds the Amp agent, put it bluntly. It's an LLM, a loop, and enough tokens. Everything else that makes a great agent feel magical is elbow grease.
Tools are JSON
So what is a tool call, really? The model never runs anything itself. It replies with a little bit of JSON that names a tool and its input. Then the harness, which is ordinary code, runs the command and sends the output back. As Dex Horthy says: there's nothing special about tools. It's just JSON and code.
The loop
And here's the loop that ties it together. Send the conversation to the model. If it asked for tools, run them and append the results. Then go around again, until the model stops asking for tools and answers you. That's the core of Claude Code, Codex and Cursor alike.
In a real session, the loop looks like this. You ask for a fix. The agent searches, reads a file, runs the tests, edits the code and runs the tests again. You didn't tell it which tools to use. It chained them on its own.
Few tools, big reach
Boris Cherny says Claude Code gives the model a surprisingly small set of tools: edit files, search files, run shell commands. But a shell is everything an engineer has at a terminal. When the team first gave the model tools, he says, the model just wanted to use them.
What it sees
Here's the part most people miss. The model is stateless. It remembers nothing between calls, so the harness replays the whole conversation every time. Everything the agent knows about your task sits in this context window: the system prompt, tool definitions, your memory files, your messages, and every tool result it has collected.
The harness
Simon Willison calls a coding agent a harness for an LLM. The model sits at the bottom. The harness wraps it with prompts, tools, permissions and memory. The tools reach into your repo. And on top, there's you, deciding what goes in and what counts as done.
Why it matters
This explains a classic failure. A human colleague would push back on a vague request. A model won't. As Thorsten Ball points out, it says: you're absolutely right, I'll fix the bug with the upload. Then it guesses. Barry Zhang from Anthropic gives the antidote: put yourself in the agent's context window.
Errors compound
There's one more consequence of the loop. Every step is a chance to be wrong, and errors compound. Chip Huyen's arithmetic: at ninety-five percent accuracy per step, a ten-step task succeeds about sixty percent of the time. A hundred-step task, almost never. So keep tasks scoped and verify along the way.
Quick check
Quick check. Your agent decides a helper function doesn't exist and writes a duplicate. What most likely happened? Tap your answer.
Try it
Now watch the loop yourself. Ask your agent to list its tools and plan the exact tool calls it would make for a small question about your code, without running them. You'll start to see your codebase the way it does.
Recap
Recap. An agent is a model using tools in a loop. Tool calls are just JSON that ordinary code executes. The model only knows what's in its context. And errors compound, so keep steps small and verified. Next: what agents are brilliant at, and where they reliably fail.