Anup Shinde
AI Agents

What an AI agent actually is, and how to build one

June 9, 20266 min read

What an AI agent actually is, how it differs from a plain LLM, and what I learned building several in Python.

Title card for the post: What an AI agent actually is

“AI agent” is one of those terms that got popular faster than it got defined. Half the time it means a genuinely autonomous system; the other half it means a single API call with a fancy name. So before the hype melts your brain, here is the plain version, from someone who has actually built a few.

I wrote a series on building AI agents in Python, working up from a simple decision-maker to an LLM-powered agent to one that knows when to stop and ask. This post is the map for that territory: what an agent is, how it differs from “just calling an LLM,” and where the idea earns its keep versus where it is overkill.

What an AI agent actually is

An AI agent is a system that pursues a goal by running a loop: it looks at the current state, decides on an action, takes that action using some tool, observes the result, and repeats until the goal is met or it gives up.

That is the whole idea. The “intelligence” can be an LLM, or it can be plain rules. What makes it an agent rather than a function is the loop and the autonomy: you give it a goal, not a script, and it decides the steps.

Strip it to four moves:

  1. Perceive the current state (the input, the result of the last action).
  2. Decide what to do next.
  3. Act through a tool (call an API, run code, query something).
  4. Observe the outcome, then loop back to step 1.

If that loop sounds familiar, it should: it is the same loop that makes a coding tool like Claude Code agentic rather than a chat box. Read files, edit, run, observe, repeat. Same shape, different tools.

An agent is not just an LLM call

This is the distinction that cuts through most of the confusion.

A plain LLM call is single-shot: prompt in, text out, done. It has no memory of what it just did and takes no action in the world. Ask it to “book me a flight” and you get a description of how one might book a flight.

An agent wraps that LLM (or rule set) in the loop above and gives it tools. Now “book me a flight” becomes: check dates, call a search tool, read results, decide, call a booking tool, confirm. The model is still just producing text at each step, but the loop turns that text into a sequence of real actions.

So the upgrade from “LLM” to “agent” is not a smarter model. It is a loop plus tools plus a goal.

The smallest useful agent

You do not need an LLM to have an agent. The first one in my series, a simple decision-making agent, runs the loop with plain logic: it perceives state, applies rules, acts, observes. Building that first makes the LLM version much clearer, because you see that the LLM is just swapping in for the “decide” step. Everything around it, the loop, the tools, the stopping condition, is plumbing you control.

Then in part two the LLM takes over the deciding. That is where it gets powerful and where it gets dangerous, because now the “decide” step can be confidently wrong, and the loop will happily act on a wrong decision.

Tools are what make it useful

An agent with no tools is just a chatbot in a while loop. Tools are the functions it can call to actually do something: search, fetch a page, run a query, write a file, hit an API.

Designing good tools is most of the real work. Each tool needs a clear purpose, sane inputs, and a result the agent can reason about. When I built an SEO analysis tool with AI agents, which was a while ago, well before the current generation of agentic tools like Claude Code, the agents you could build looked primitive next to what we have now. But the core lesson has not aged a day: the agent was only as good as the information and the tools I gave it. Fetch the page, extract the signals, score them. The model orchestrated; the tools did the work. Get the inputs and the tools right and the agent looks smart. Get them vague and it flails.

The part everyone underestimates: knowing when to stop

The failure mode of agents is not being too dumb. It is being too eager. A naive loop will charge ahead on a bad assumption, take ten actions where one was needed, or spin until it runs out of budget.

The most useful agent in my series is the one in part three: an agent that asks before acting when it is unsure. That one change, building in a “stop and clarify” step, does more for reliability than a bigger model would. An agent that knows the edge of its competence and checks in beats one that confidently does the wrong thing fast.

Where agents bite you

  • Most “agent” problems are a function call. If the task is deterministic and one-shot, you do not need a loop and an LLM. Reaching for an agent because it is exciting is how you turn a five-line function into a flaky, expensive subsystem.
  • The loop amplifies wrong decisions. A single bad LLM output in a chat is harmless. The same output inside an acting loop takes a real action you then have to undo.
  • Cost and latency stack up. Every loop iteration can be an LLM call. Ten steps is ten calls. Watch it, or a “quick agent” quietly becomes the expensive part of your system.
  • It will be confidently wrong. Same caveat as every AI tool: the verification has to live in your loop, not in your optimism.

FAQ

What is an AI agent in simple terms?

A program that pursues a goal on its own by looping: it looks at the situation, decides what to do, does it using a tool, looks at the result, and repeats until it is done. The decision step can be powered by an LLM or by plain rules.

What is the difference between an AI agent and an LLM?

An LLM is a single text-in, text-out model call. An AI agent wraps a model (or rules) in a loop and gives it tools, so it can take a sequence of real actions toward a goal instead of just producing one block of text.

How do you build an AI agent?

Start with the loop (perceive, decide, act, observe) and a clear goal. Give it a small set of well-defined tools it can call. Use rules or an LLM for the decide step, and add a stopping condition so it knows when it is done or should ask for help. My Python series builds exactly this, step by step.

What are some examples of AI agents?

Coding tools like Claude Code (read, edit, run, repeat), research and analysis tools that gather and score data, customer-support agents that look things up and take actions, and task automation that strings several steps together. The common thread is a goal plus a loop plus tools.

Is “agentic AI” the same as an AI agent?

Roughly, yes: “agentic” is the adjective for systems that act in this goal-plus-loop-plus-tools way. “AI agent” is the noun for one such system. The marketing uses them interchangeably; the underlying idea is the loop.

An AI agent is not magic and it is not a smarter model. It is a loop, some tools, and a goal, wrapped around a decision step that you should never fully trust. Build the loop, design the tools, and teach it when to stop. That is the whole craft.