RetroDeckRETRODECK

What Is an Agent in AI? The Four Parts That Make One

An agent in AI is a language model that pursues a goal by choosing its own actions. It has four parts: the model that decides, tools it can call, a loop that executes those calls and returns results, and state that persists between steps. The model picks each next step; code sets the tools and limits.

The working definition

In classic AI textbooks, an agent is anything that perceives its environment and acts on it. That definition covers a thermostat, which is why it is not much use to someone building software in 2026. The working definition today is narrower.

An AI agent is a language model given four things: tools it can request, a loop that executes those requests and feeds results back, state that persists across steps, and a goal with a condition for stopping. Remove any one and you have something else. A model with no tools is a chatbot. Tools with no loop is a single function call. A loop with no state forgets what it did two steps ago. A loop with no stopping rule runs until the budget does.

The defining property is that the model chooses the next step. The developer supplies the tools and the boundaries; the model decides which tool to call, with what arguments, and when the job is done.

The four parts, and what each one is responsible for

The model

The model is the decision maker and nothing more. It reads the context, then emits text, a structured tool request, or a signal that it is finished. It cannot execute anything, and it remembers nothing between calls. Everything that looks like memory or action is supplied by the other three parts.

The tools

Tools are how an agent affects anything outside its own output: reading files, querying a database, calling an API, running a shell command, searching the web. Each one is a name, a description, and a parameter schema. The set of tools is the agent's real permission boundary. An agent cannot delete what it has no tool to delete.

The loop

The loop is ordinary code. It sends context to the model, executes whatever tool the model requests, appends the result, and calls the model again. It also enforces limits: maximum steps, timeouts, spending caps, and which actions need human approval. Where the loop runs, and how it is isolated, is the job of an agent runtime.

The state

State is everything the agent knows at a given step: the goal, the conversation so far, tool results, and anything loaded from longer-term memory. Short-term state lives in the context window. Long-term state lives in files, databases, or a retrieval index the agent can search. How state is managed decides most of an agent's cost and most of its mistakes.

What is not an agent

Plenty of products are labelled agents without meeting the definition. Three common cases:

A chatbot. It answers within one exchange and takes no action. Adding a system prompt and a persona does not change that.

A fixed workflow. A pipeline that always runs the same steps in the same order, with a model filling in one or more of them, is automation. Anthropic's widely cited guide to building agents draws this line: in a workflow, code decides the path; in an agent, the model does. Workflows are often the better choice, because they are cheaper, faster, and easier to test.

A retrieval pipeline. Fetching documents and passing them to a model is retrieval augmented generation. It becomes agentic only when the model decides whether, what, and how many times to search.

The distinction matters because the failure modes differ. A workflow fails at a known step. An agent can fail by choosing the wrong path, repeating itself, or stopping too early, and you only find out by reading its trace.

A spectrum, not a switch

Agency is a matter of degree. At the low end, a model picks one tool from a short list and a person approves the result. In the middle, a coding assistant edits files and runs tests across dozens of steps, pausing for approval on anything destructive. At the high end, a long-running agent works for hours toward a goal, managing its own sub-tasks with no one watching.

Each step up the spectrum buys flexibility and costs predictability. More autonomy means more model calls, more context, more places to go wrong, and more need for sandboxing and audit logs. The right level is the lowest one that gets the job done.

Where agent state should live

The simplest agents keep everything in the context window, which means every step resends every previous step. That works for short tasks and gets expensive for long ones. Better designed agents keep the window small and search for what they need: past decisions, documentation, code, notes.

This is the part of an agent RDK supplies. Files from a local vault are indexed as encrypted private chunks, and the agent retrieves the relevant ones before calling the model, which cuts token spend 80 to 90 percent on repeated or reference-heavy work.

When to build one

Build an agent when the steps cannot be known in advance: open-ended research, debugging, triaging varied requests, work that depends on what the last step returned. Build a workflow when they can. A useful test: if you can draw the flowchart, write the flowchart in code and use the model only where judgement is needed.

Frequently asked questions

What is an agent in AI, in simple terms?
An AI agent is a language model that can take actions, not just answer. It is given tools, such as file access or an API, and runs in a loop: it decides on a step, the system executes it, the model sees the result, and it decides the next step. It keeps going until the goal is met or a limit stops it.
What is the difference between an AI agent and a chatbot?
A chatbot responds within a conversation and takes no action outside it. An agent can call tools that change things: editing files, sending messages, querying systems, running code. It also works across many steps toward a goal without a person prompting each one. Many chat products now include agent modes, so the same interface can be either.
Is ChatGPT or Claude an AI agent?
The models themselves are not agents; they generate text and tool requests. The products built around them can be. When an app gives the model tools, runs a loop that executes them, and keeps state across steps, as coding assistants and computer-use modes do, that product is acting as an agent. Plain question answering is not.
What are the main components of an AI agent?
Four parts: a model that decides the next step, tools that let it act, a loop that executes tool calls and returns results, and state that carries the goal, history, and retrieved knowledge from one step to the next. Around those sit limits and permissions, which decide how much the agent is allowed to do unsupervised.
Are AI agents the same as automation?
No. Traditional automation follows a path a person defined in advance. An agent chooses its own path at run time based on what each step returns. That makes agents better for open-ended tasks and worse for predictable ones, where fixed automation is cheaper, faster, and easier to test. Many production systems combine both.