What Is an AI Agent?

Agents explained simply: the agent loop, ReAct, workflows vs agents, the components of an agent (model, tools, memory, planning, guardrails), levels of autonomy, and when to use — and not use — agents.

On this page

Simple definition#

An AI agent is a system where an LLM decides what to do next, does it by calling tools, observes the result, and repeats until the goal is reached or it must stop.

A chatbot answers. An agent acts: it can look up an order, check a policy, issue a refund, and email the customer — choosing the steps itself.

From LLM to agent#

Levels of LLM systems
flowchart LR
    A["Single LLM call<br/>prompt → answer"] --> B["Augmented LLM<br/>+ retrieval, tools, memory"]
    B --> C["Workflow<br/>LLM calls and tools in a<br/>path defined by code"]
    C --> D["Agent<br/>LLM decides the path<br/>in a loop"]
    D --> E["Multi-agent system<br/>several agents<br/>coordinate"]

The most useful distinction:

Workflow Agent
Who decides the steps? Your code (predefined path) The LLM (dynamic)
Predictability High Lower
Testing Like normal software Needs scenario-based evaluation
Cost and latency Bounded, known Variable
Best for Well-understood, repeatable tasks Open-ended tasks where steps cannot be predicted

The agent loop#

The agent loop: think, act, observe
flowchart TD
    G["Goal from user"] --> T["THINK<br/>LLM reasons about the state<br/>and picks the next action"]
    T --> D{"Done?"}
    D -->|"No"| A["ACT<br/>call a tool with arguments"]
    A --> O["OBSERVE<br/>tool result added to context"]
    O --> T
    D -->|"Yes"| R["Final answer to user"]
    T -->|"budget exceeded,<br/>needs approval, or stuck"| H["Stop: ask human / escalate"]

In code, the loop is short:

messages = [system_prompt, user_goal]
for step in 1..MAX_STEPS:
    response = llm(messages, tools)
    if response has no tool calls:
        return response.text                  # final answer
    for call in response.tool_calls:
        check permissions / ask for approval if risky
        result = execute(call.name, call.arguments)
        messages.append(tool_result(call.id, result))
return "Stopped: step limit reached"          # always bound the loop

ReAct: Reason + Act#

ReAct (Yao et al., 2022) interleaves reasoning and actions. The model writes a thought, chooses an action, reads the observation, and continues:

Thought: The customer asks why order 8812 is late. I need the order status.
Action: get_order(order_id="8812")
Observation: {"status": "held", "reason": "address_verification_failed"}
Thought: Address verification failed. I should check the address on file.
Action: get_customer_address(customer_id="C-301")
Observation: {"postcode": "SW1A 1AA", "verified": false}
Thought: I can explain and offer to update the address.
Final answer: Your order is on hold because we could not verify the delivery address...

Modern models do this natively through tool calling: the “Action” is a structured tool call, not text to parse.

Components of an agent#

Anatomy of an agent
flowchart TB
    subgraph Agent
        M["Model<br/>reasoning engine"]
        P["Instructions<br/>role, goals, rules, stop conditions"]
        TL["Tools<br/>APIs, search, code, MCP servers"]
        MEM["Memory<br/>short-term context, long-term store"]
        PL["Planning<br/>decompose, reflect, re-plan"]
        GR["Guardrails<br/>permissions, approvals, budgets"]
    end
    U["User / trigger"] --> Agent
    Agent --> ENV["Environment<br/>business systems, data, people"]
    ENV --> Agent
Component Role Read more
Model Chooses actions, reasons over results Model selection
Instructions Define goal, scope, tone, rules, when to stop Prompt engineering
Tools The agent’s hands: read and change the world Tool calling, MCP
Memory Conversation state, user preferences, past cases Memory and state
Planning Break goals into steps; reflect and correct Workflow patterns
Guardrails Limit what it can do and spend Reliability, AI security

Levels of autonomy#

Level Description Example
0 — Assist Suggests; human does everything Draft an email reply
1 — Act with approval Proposes actions; human approves each “Refund €40? [Approve]”
2 — Act within limits Acts alone below thresholds; escalates above Auto-refund ≤ €50, else approval
3 — Autonomous with oversight Completes whole tasks; humans review samples and exceptions Overnight reconciliation agent
4 — Fully autonomous No routine human involvement Rare in regulated enterprises

Choose the level per action by impact and reversibility: reading is safe, writing needs limits, irreversible or high-value actions need human approval.

This table is about the authority you grant. For the matching scale of capability — from rule-based automation to fully autonomous agents — and the sense–plan–act–reflect cycle, see levels, SPAR and the three keystones.

When to use an agent#

Good fit: open-ended tasks with many possible paths (investigation, research, troubleshooting, coding), tasks spanning several systems, and tasks where a human currently follows judgment rather than a fixed procedure.

Poor fit: fixed procedures (use a workflow or plain code), strict latency or cost budgets, tasks needing guaranteed exact outcomes, and high-risk actions without a review step.

Common mistakes#

Review questions#

What is an AI agent? An LLM-driven system that pursues a goal by deciding on actions, executing them through tools, observing the results and iterating until done — with memory, instructions and guardrails around it.

What is the difference between a workflow and an agent? In a workflow, code defines the sequence of LLM calls and tools; in an agent, the LLM decides the sequence dynamically. Workflows are more predictable and cheaper; agents are more flexible for open-ended tasks.

Explain the ReAct pattern. The model alternates reasoning (“thought”), an action (tool call) and an observation (tool result) in a loop, so reasoning guides actions and results inform further reasoning, until it produces a final answer.

How do you decide how much autonomy to give an agent? By the impact and reversibility of each action: read-only actions can be autonomous; low-value reversible writes can be automatic within limits; high-value or irreversible actions require human approval. Combine with budgets, monitoring and audit logs.

When would you not use an agent? When the process is fixed and known, when latency or cost must be tightly bounded, when outcomes must be exact and auditable step by step, or when there is no safe way to limit its actions.

Summary#

  • An agent loops: think → act through tools → observe → repeat, until done or stopped.
  • Workflows (code decides) vs agents (LLM decides): prefer workflows when the path is known.
  • Components: model, instructions, tools, memory, planning, guardrails.
  • Set autonomy per action by impact and reversibility; always bound steps, tokens and time.

References#