Every concept your team needs — defined, diagrammed, and honestly critiqued. No hype, no vendor framing. This chapter covers the precise definition of an AI agent, how it differs from assistants and automation, the five anatomical components that make up every agent, the five practical agent types in production today, and the four reasoning patterns that determine how agents think and act.
The term "agent" is overloaded in the industry. A chatbot with a web search button is not an agent. This module establishes a precise definition, draws the boundaries between agents, assistants, and automation, and explains why agentic AI only became reliably practical in 2023–2024.
An AI agent is a system that perceives its environment, reasons about what to do, and takes actions — repeatedly, in a loop — until a goal is achieved or a stopping condition is met.
The key distinction from a standard LLM call is the loop. A single prompt-response exchange is not agentic. An agent runs across multiple steps, uses tools, and adapts its behaviour based on the results of prior actions.
Practitioner note: The term "agent" is overloaded in industry. A chatbot with a web search button is not an agent. A system that plans a multi-step research task, calls APIs, reads documents, and writes a structured report autonomously — is.
The key difference is the loop and autonomy. An assistant responds to one prompt and waits. An agent takes the response, observes the result, decides what to do next, and acts again — without requiring human input at each step.
| Dimension | AI Assistant | AI Agent |
|---|---|---|
| Interaction | Single turn: one prompt, one reply | Multi-turn loop: act, observe, adapt |
| Tool use | None, or one-shot retrieval | Dynamic — selects and chains tools |
| Memory | Context window only | Short-term + optional long-term store |
| Goal handling | Respond to the immediate request | Decompose goals into sub-tasks |
| Error recovery | None — user must re-prompt | Detects failure and retries or replans |
| Human involvement | Required every step | Optional — can run unattended |
Traditional automation executes a fixed script: if X then Y. It is fast, reliable, and auditable — but brittle. Any input outside the expected range breaks it. An AI agent reasons about what to do given the current situation. It handles ambiguity, adapts to unexpected inputs, and makes judgment calls. The trade-off is that it is slower, harder to audit, and can fail in unpredictable ways.
| Dimension | Automation | AI Agent |
|---|---|---|
| Decision logic | Hard-coded rules (if/else) | LLM reasoning at runtime |
| Adaptability | None — breaks on unexpected inputs | High — handles ambiguity natively |
| Auditability | Fully deterministic, traceable | Probabilistic — requires tracing tools |
| Speed | Milliseconds | Seconds to minutes per step |
| Cost | Near-zero per run | Token costs per step |
| Best for | High-volume, well-defined, stable tasks | Ambiguous, variable, judgment-heavy tasks |
Rule of thumb: If you can write a flowchart that covers every case, use automation. If the task requires reading context, making judgment calls, or handling exceptions — consider an agent. Hybrid architectures (automation orchestrating agents) are often the most practical solution.
Agentic AI became practical when three capabilities matured simultaneously. Reliable tool use — LLMs can now call functions with structured arguments and handle results consistently (Claude 3+, GPT-4, Gemini 1.5+). Long context windows — 100k–1M token contexts allow agents to hold large plans, documents, and histories without lossy compression. Instruction following — modern LLMs respect complex, multi-step system prompts consistently enough to build reliable loops around. None of these individually created agents. Together, they made the loop reliable enough to ship.
“An agent is not just an LLM with tools — it is a system that perceives, decides, and acts in a loop, with the capacity to recover from failure.”
— agentic-ai / agents-intro · 01.1Every AI agent, regardless of framework or application, is composed of five components: Perception, Reasoning, Action, Memory, and the Loop that connects them. Understanding each layer — what it does, how it can fail, and what controls it — is the foundation of sound agent engineering.
Perception is how the agent reads its current situation. Everything the agent "sees" must fit in its context window: the original user goal, prior conversation history, results from previous tool calls, retrieved documents, and any structured data passed from external systems.
Context window pressure: Everything the agent perceives must fit in its context window. Long-running agents accumulate history rapidly. Plan for context compaction or summarisation from the start — see 03.1 Memory Architectures.
Reasoning is the LLM's core step: given the current context, what should the agent do next? This may involve decomposing the goal into sub-tasks, selecting a tool, generating a response, or deciding the task is complete. Reasoning quality is heavily influenced by the system prompt, the model's instruction-following ability, and the reasoning pattern used.
Actions are the agent's interface to the world. They are executed after the reasoning step and their results are fed back into the next perception cycle. Actions range from low-risk reads to high-risk irreversible writes. Apply the minimal footprint principle: prefer reversible actions, request only the permissions needed, and escalate to human approval before irreversible actions.
| Action type | Examples | Risk |
|---|---|---|
| Read / retrieve | Web search, DB query, file read, RAG | Low |
| Compute | Code execution, data transform, calculation | Medium |
| Write / mutate | File write, DB update, API POST | High |
| Communicate | Send email, Slack message, create ticket | High |
| Spawn sub-agent | Delegate task to a child agent | High |
Memory is how the agent persists and retrieves information across steps and sessions. Without memory, every agent step starts from scratch. There are four memory types, each with different scope and implementation requirements.
| Memory type | Scope | Implementation |
|---|---|---|
| In-context (working) | Current session | Context window — conversation history |
| External (semantic) | Cross-session | Vector database (Pinecone, Weaviate, pgvector) |
| Episodic | Cross-session | Structured log of past interactions |
| Procedural | Persistent | Fine-tuned weights or few-shot skill programs |
The loop is the core execution cycle. It repeats until the agent decides the task is done, a step limit is reached, or a human intervenes. Always set a MAX_STEPS budget. An agent stuck in a bad loop will run until it times out or depletes your token budget.
while not done: context = build_context(goal, history, memory) response = llm(system_prompt, context) if response.type == "tool_call": result = execute_tool(response.tool, response.args) history.append({"tool": response.tool, "result": result}) elif response.type == "finish": return response.output # ✓ Done elif response.type == "error": history.append({"error": response.reason}) # model will reason about the error on next turn step_count += 1 if step_count >= MAX_STEPS: raise StepLimitExceeded
“Memory is what separates a stateless chatbot from a true agent. Without it, every step starts from zero and the agent cannot learn from its own history.”
— agentic-ai / agents-intro · 01.2Not all agents are the same. Task agents, coding agents, browser agents, research agents, and voice agents have different tool sets, latency requirements, failure modes, and design constraints. Knowing which archetype your problem belongs to shapes every architectural decision that follows.
General-purpose agents built to complete a goal defined in natural language. The most common type in production. Given a task like "book a meeting with everyone on this list," a task agent plans the steps, calls calendar and email APIs, handles failures, and reports back.
Specialised agents for software development tasks — writing, running, testing, and debugging code. They operate in sandboxed environments with access to a shell, file system, and test runner. The key design challenge is managing long-lived file state and multi-step test feedback loops — the agent must track which files exist, what tests pass, and how the codebase has evolved across many steps.
Agents that control a web browser — navigating pages, filling forms, clicking buttons, and extracting information. They must handle dynamic, unpredictable web UIs that were not designed for machine interaction. Vision-based agents (screenshot grounding) work on any UI; DOM-based agents are faster but fragile to site changes.
Agents that gather, synthesise, and report on information from multiple sources. They typically combine web search, document retrieval, and structured reasoning to produce written outputs. The primary failure mode is hallucination — the agent cites sources incorrectly or fills gaps with invented facts. Mitigation: require citations for every factual claim and implement a verification step.
Real-time agents operating over audio. The loop must complete within milliseconds to feel natural. Typically built on speech-to-text → LLM → text-to-speech pipelines, with tool calls happening asynchronously to avoid blocking the audio stream. Latency is the dominant constraint — every added tool call adds 300–800ms to the response time.
“The archetype shapes the architecture. A research agent and a voice agent share the same loop definition but almost nothing else — different tools, different latency budgets, different failure modes, different safety requirements.”
— agentic-ai / agents-intro · 01.3The reasoning pattern determines how an agent thinks and sequences its actions. The right pattern depends on task structure, quality requirements, risk level, and how much the plan can be determined upfront. These four patterns cover the vast majority of production agentic systems.
ReAct (Reason + Act) interleaves reasoning traces with tool calls. Before each action, the agent writes a Thought explaining what it is doing and why. This makes the agent's behaviour interpretable and significantly reduces hallucination by forcing the model to commit to its reasoning before acting.
Why ReAct works: Forcing a thought step reduces the chance the model jumps to an incorrect action. It also creates a natural audit trail — every decision is explained. Use it as the default pattern for task and research agents.
A planner LLM first decomposes the goal into an ordered list of sub-tasks. An executor then runs each sub-task sequentially or in parallel. Useful when the full plan can be determined upfront and the steps are largely independent of each other.
Limitation: Plan & Execute assumes the plan stays valid throughout execution. If step 2 reveals the goal needs to change, the planner must re-plan. For dynamic tasks where intermediate results frequently change direction, prefer ReAct or a replanning loop.
After completing a task, a reflection step critiques the output and decides whether to iterate. A critic agent — or the same LLM with a different system prompt — evaluates quality and either accepts the result or sends it back for revision. This pattern dramatically improves output quality on tasks where quality is hard to specify upfront but easy to recognise after the fact.
The agent pauses at defined checkpoints and asks for human approval before proceeding. Essential for high-stakes or irreversible actions. The key design question is when to interrupt — too often and the agent is just a slow chatbot; too rarely and errors compound undetected.
Design principle: Start with more interrupts than you think you need. Remove them gradually as you build confidence in the agent's behaviour in production. It is much easier to remove a checkpoint than to recover from an undetected error.
| Pattern | Best for | Main trade-off |
|---|---|---|
| ReAct | Most tasks — best default | Slightly more tokens per step (the Thought) |
| Plan & Execute | Stable, well-scoped tasks with independent steps | Breaks when intermediate results change the goal |
| Reflection | Quality-sensitive outputs (writing, code, analysis) | 2× latency and cost per iteration |
| HITL | High-stakes or irreversible actions in production | Latency — waiting for human input |
Agent = LLM + Tools + Memory + Loop + Goal Loop = Perceive → Reason → Act → Observe → (repeat) Stop = Goal achieved | Step limit | Human interrupt | ErrorAgent vs assistant vs automation
Automation → Fixed rules, deterministic, fast, cheap, brittle Assistant → Single-turn LLM, no loop, no persistent memory Agent → Multi-step loop, tool use, memory, goal-directed, adaptiveReasoning patterns
ReAct → Thought + Action interleaved — best default Plan & Execute → Upfront plan → sequential execution — good for stable tasks Reflection → Actor + Critic loop — best for quality-sensitive outputs HITL → Human approval at checkpoints — required for high-stakes actionsKey safety rules
1. Always set MAX_STEPS 2. Minimal footprint — read before write, reversible before irreversible 3. Validate all tool outputs — assume adversarial content is possible 4. Instrument every step — latency, tokens, tool, input, output 5. Build evals before shipping