In this guide
An AI agent is a system built around a language model that can pursue a goal over several steps. It decides what to do next, uses tools such as search, a calculator or a company database, looks at the results, and keeps going until it believes the job is done. A chatbot answers one message at a time. An agent acts in a loop.
How an AI agent works
Almost every agent, however it is marketed, is built from the same parts:
- A model. A large language model reads the goal and the current state, then decides the next action.
- Tools. These are functions the model may ask for: search the web, read a file, query a database, send an email, call an API. The model does not run them itself. The surrounding program does, then hands the result back.
- Memory. Short-term memory is whatever sits in the context window. Longer-term memory is usually notes or documents stored outside the model and fetched when needed.
- A loop. The program repeats: ask the model what to do, run the tool, feed back the result, ask again. It stops when the model says it is finished or when a limit is reached.
A simple version of the loop looks like this:
goal = "Find the three most recent invoices from Acme and total them"
while not done and steps < max_steps:
action = model.decide(goal, history)
if action is a tool call:
result = run_tool(action)
history.append(action, result)
else:
done = true
answer = action.textThe max_steps limit matters. Without it, an agent that gets confused can loop indefinitely and spend money doing so.
AI agent vs chatbot vs automation
These three are often confused.
- A chatbot responds to a prompt and stops. It may use tools, but a person drives each turn.
- A fixed automation follows steps a human wrote in advance. It is predictable and cheap, but it cannot handle a situation nobody planned for. See what AI automation is for where this fits.
- An agent chooses its own steps at run time. That flexibility is the benefit, and also the risk.
In practice the line is blurry. Many useful products are mostly fixed workflow with one or two steps where a model makes a judgement call.
Examples of AI agents in practice
- A research assistant that searches several sources, reads the pages, compares them and writes a summary with citations.
- A coding agent that reads a repository, edits files, runs the tests and tries again when they fail.
- A support agent that looks up an order, checks the returns policy and drafts a reply for a person to approve.
Each of these has a clear goal, a small set of tools and a way to check whether the result is acceptable. Those three traits predict whether an agent will work well.
Where AI agents go wrong
Agents inherit every weakness of language models and add new ones, because errors compound across steps.
- Compounding mistakes. A wrong assumption in step two can poison steps three to ten. Hallucinations become actions rather than just sentences.
- Unclear goals. "Improve our website" gives an agent nothing to aim at. Vague goals produce busy but useless work.
- Over-broad permissions. An agent that can delete files or send email can do real damage when it misreads a situation.
- Prompt injection. If an agent reads untrusted text, such as a web page or an inbound email, that text can contain instructions that hijack it. This is covered in what prompt injection is.
- Cost and speed. Every loop is another model call, so agents are slower and costlier than one prompt.
How to use agents responsibly
- Start with a narrow task. One goal, a few tools, clear success criteria.
- Give the least access that works. Read-only tools first. Add write access only when you must.
- Keep a human approval step before anything irreversible, such as sending, paying or deleting. Designing an AI workflow with human approval walks through this.
- Set limits on steps, time and spend.
- Log every step so you can see why it did what it did.
- Test on realistic cases, including awkward ones, before trusting it.
Agent tooling changes quickly, so learn the stable ideas of goals, tools, loops and limits rather than any single product.
If you want a structured path through these ideas, the later stages of the QAM.AI programme cover agents and workflows in short text lessons with practical exercises, and the free preview lessons let you try the format first.
Key takeaways
- An AI agent is a model plus tools plus a loop, working towards a goal over several steps.
- It differs from a chatbot by choosing its own actions, and from fixed automation by not following a script.
- Errors compound across steps, so narrow scope, limited permissions and logging are essential.
- Keep a human approval step before any action that cannot be undone.
- Treat any text an agent reads from outside as potentially hostile.
Frequently asked questions
Are AI agents the same as ChatGPT?
No. A chat assistant is one product that may include agent-like features, but an agent is a design pattern: a model that uses tools in a loop. Many different products and custom systems are built this way.
Can an AI agent work without human supervision?
Technically yes, but it is rarely wise for tasks with real consequences. Reliability varies with the task, and mistakes can compound. Most sensible deployments keep a person in the loop for approvals and review the logs regularly.
Do I need to code to build an AI agent?
Not always. Several no-code and low-code tools let you connect a model to tools and set rules. Understanding the loop, the permissions and the failure modes matters more than the language you use, and it helps you judge whether a tool is safe to rely on.
This guide is general educational information and is reviewed periodically. AI tools change quickly, so check each vendor's current documentation before relying on specific features or limits.