An AI agent is a system that uses a language model to pursue a goal over multiple steps, deciding for itself what to do next and which tools to use. Unlike a single prompt-and-response exchange, an agent runs a loop: it observes, decides, acts using tools, sees the result, and repeats until the task is done or it stops.
Key takeaways
- The defining feature is that the model, not a fixed script, chooses the next step.
- Agents need tools to affect anything outside the conversation.
- The core pattern is the agent loop: think, act, observe, repeat.
- Reliability, not capability, is the main engineering challenge.
- Agents should have limits: step caps, permissions and human approval for risky actions.
An AI agent explained in simple terms
A chatbot is someone who answers your questions. An agent is an assistant you give a task to: “sort out the invoice discrepancy with this supplier”. They look things up, check systems, draft a message, come back with questions, and keep going until the job is done or they are stuck. The difference is not intelligence but autonomy over the steps.
Components of an agent
| Component | Role |
|---|---|
| Model | Decides what to do next, usually a strong LLM or reasoning model |
| Instructions | A system prompt defining goal, rules and limits |
| Tools | Search, databases, APIs, code execution, file access |
| Memory | Working context plus any persistent store |
| Loop controller | Runs steps, enforces limits, handles errors |
| Guardrails | Permissions, approvals, budgets, stop conditions |
The agent loop
- Receive the goal and current context.
- Decide: answer directly, or call a tool.
- Execute the tool call.
- Observe the result, including errors.
- Update understanding and repeat.
- Stop when the goal is met, a limit is hit, or human input is needed.
This reasoning-and-acting pattern was formalised in research known as ReAct (2022) and underpins most agent implementations.
A worked example
Task: “Check whether invoice INV-2041 was paid, and if not, draft a reminder.”
- The agent calls an accounting API to look up the invoice.
- The result shows it is unpaid and 12 days overdue.
- It calls a CRM tool to find the billing contact.
- It drafts a polite reminder referencing the amount and due date.
- It stops and presents the draft for human approval before sending.
Each step was chosen by the model, but sending, the only irreversible action, requires a person.
Agents vs workflows
A fixed sequence of LLM calls is a workflow: predictable, testable and usually cheaper. An agent decides its own path: flexible, but harder to predict. Good practice is to use the simplest thing that works, and reserve agents for tasks where the steps genuinely cannot be known in advance. See agentic workflow.
Where agents work well today
- Software engineering tasks across multiple files.
- Research and information gathering with citations.
- Customer support with lookups and updates.
- Data extraction and system-to-system operations.
- Routine back-office processes with clear success criteria.
Risks and controls
- Compounding errors: a mistake at step 2 corrupts everything after.
- Cost: loops can consume many tokens.
- Prompt injection: untrusted content can hijack an agent’s instructions.
- Irreversible actions: payments, deletions and messages need approval.
- Looping: set maximum steps and time limits.
- Observability: log every step, tool call and result.
Limitations
- Reliability drops as the number of steps grows.
- Hard to test exhaustively, since paths vary.
- Tool quality and documentation limit performance.
- Autonomy must be earned through evaluation, not assumed.
