top of page

What Is an AI Agent, Really?

carocsteads
2 days ago
4 min read

Agents, from the ground up · Part 1 of 7

I asked an AI agent to write tests for a security detector. Its first attempt failed. It read the error, fixed its own mistake, ran the tests again, and they passed. I didn't touch a thing.

What was actually happening there isn't magic, and you don't need any jargon to understand it. One simple mental model explains every AI agent you'll meet. Once you have it, the buzzwords that come later (subagents, orchestrators, memory, MCP) all slot neatly into place.


A model can think, but it can't act

A large language model (Claude, GPT, Gemini, any of them) does exactly one thing: you give it text, and it gives you text back. That's it. On its own it can't open your files, run a command, call an API, or browse a website.

It's a brilliant brain in a jar. It can reason about your codebase beautifully, but it has no hands to touch it.

So how does something like Claude Code edit real files, run your test suite, and fix the failures it finds? The model didn't sprout hands. Someone built it a body.


An agent = a model + a loop + tools

An agent is what you get when you wrap that model in a small program that gives it tools and runs it in a loop:

  1. Think. The model reads the task and everything it has seen so far, and decides on the next step.

  2. Act. Instead of answering in prose, it emits a structured request: "call read_file on the app's main source file."

  3. Observe. The surrounding program actually runs that tool and hands the result (the file contents, the test output, the error) back to the model.

  4. Repeat until the model decides the task is done and answers in plain text instead of asking for another tool.

That wrapper program is called the harness, or the agent runtime. Stripped to its bones, it's surprisingly small. Here it is as simplified pseudocode:

messages = [task]
while True:
    reply = model(messages, tools=available_tools)
    if reply.wants_tool:
        result = run_tool(reply.tool_name, reply.arguments)
        messages.append(result)      # the model "sees" what happened
    else:
        break                        # no more tool calls = done
return reply.text

That's most of it. Real harnesses add permissions, retries, logging, and context management, but the heartbeat is that loop.

Diagram of the agent loop: 1. Think (the model reads the task), 2. Act (it asks for a tool), 3. Observe (the harness runs the tool and returns the result), 4. Repeat until no more tool requests, then the model answers.
The model is the brain. The harness is the body. An agent is the two working together in a loop.

What a "tool call" really is

The model never touches your computer. When it "uses a tool," it just writes something like this:

{ "tool": "run_command", "input": { "cmd": "pytest tests/test_detector.py" } }

The harness reads that, decides whether it's allowed, runs it, and pastes the output back into the conversation. The model is always a text-in, text-out machine. The harness does the doing. This matters a lot for security, too: every real-world effect an agent has goes through code you control. That's where you put guardrails.


A real example, step by step

On FinBot, an open-source AI-security training app I work on, one agent's whole job is writing tests. I ask it: "Write tests for the path-traversal detector." Here's how the loop plays out:

  1. Read the detector's source to understand what it flags (things like ../ sequences and encoded variants).

  2. Open a similar existing test file to copy the house style: fixtures, naming, how assertions are written.

  3. Write a new test file covering normal paths, obvious traversal, URL-encoded traversal, and edge cases.

  4. Run pytest. It fails, not because the detector is wrong but because a fixture was set up incorrectly.

  5. Read the error, fix the fixture, and run again.

  6. Green. It reports back what it covered and stops.

Nobody gave it that six-step plan. It read, reasoned, used its tools, noticed its own mistake from real feedback, and corrected it. That self-direction, driven by real observations, is what makes it an agent and not just a fancy autocomplete.

Step 4 is the one that matters. A plain chatbot would have handed me broken tests with total confidence. The loop let the agent hit reality, see that it was wrong, and fix it before I ever looked.

Why this one idea unlocks everything

Once you see agent = model + loop + tools, the jargon stops being intimidating:

  • More tools means it can do more things (a browser tool, a database tool, an MCP server).

  • A narrower prompt and fewer tools means a specialist: a test-writer, a reviewer, a bug-hunter.

  • Several loops at once means parallel agents, coordinated by an orchestrator.

  • Notes written to disk and reloaded means "memory."

  • A deterministic check on the output means a pipeline you can actually trust.

Every one of those is a variation on the same three ingredients. That's what the rest of this series unpacks.

Next up, Part 2: Agents vs. workflows. When is it really an agent, and when is it just a fancy pipeline? (Spoiler: often the pipeline is the better choice.)

Enjoyed this? Get every new post by email with the Subscribe to the blog form at the bottom of this page. You can also sign up as a site member (top of the page) to follow along.

Agents, from the ground up · © Carolina Steadham

Comments


Subscribe to the blog

© 2026 by Carolina Steadham. All rights reserved.

bottom of page