01
Chapter 01 · Foundations

What is an AI Agent?
Core concepts & anatomy

agentic-ai / agents-intro 4 modules  ·  ~40 min read  ·  Vol. I · 2026

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.

01.1 Concepts What makes an agent, how it differs from assistants and automation.
01.2 Anatomy Perception, reasoning, action, memory — and the core loop that ties them together.
01.3 Agent Types Task, coding, browser, research, and voice agents — with real examples.
01.4 Reasoning Patterns ReAct, Plan & Execute, Reflection, and Human-in-the-Loop.
01.1
Module
Concepts & Definition

What an AI agent is — and what it isn't

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.

Live Foundational

Definition

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.

Agent = LLM + Tools + Memory + Loop + Goal Input → [Perceive] → [Reason] → [Act] → [Observe result] ↑___________________________| (repeat until done)

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.

Agent vs Assistant

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.

DimensionAI AssistantAI Agent
InteractionSingle turn: one prompt, one replyMulti-turn loop: act, observe, adapt
Tool useNone, or one-shot retrievalDynamic — selects and chains tools
MemoryContext window onlyShort-term + optional long-term store
Goal handlingRespond to the immediate requestDecompose goals into sub-tasks
Error recoveryNone — user must re-promptDetects failure and retries or replans
Human involvementRequired every stepOptional — can run unattended

Agent vs Automation

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.

DimensionAutomationAI Agent
Decision logicHard-coded rules (if/else)LLM reasoning at runtime
AdaptabilityNone — breaks on unexpected inputsHigh — handles ambiguity natively
AuditabilityFully deterministic, traceableProbabilistic — requires tracing tools
SpeedMillisecondsSeconds to minutes per step
CostNear-zero per runToken costs per step
Best forHigh-volume, well-defined, stable tasksAmbiguous, 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.

Why Now?

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.

Key takeaways — 01.1
The loop is the definition. A single LLM call is not an agent, no matter how sophisticated the prompt.
Agents are not always better. For deterministic, high-volume tasks, traditional automation wins.
Hybrid architectures — automation orchestrating agents — are often the most practical production approach.
Three capabilities unlocked agents: reliable tool use, long contexts, and consistent instruction following.

“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.1
01.2
Module
Anatomy & The Loop

Five components, one loop — the complete agent architecture

Every 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.

Live Foundational

Perception — Reading the Environment

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.

Perception inputs: → User goal / task description → Conversation history (prior turns) → Tool results (from previous steps) → Retrieved documents (RAG) → Structured context (JSON, schemas) → Environmental state (date, user profile, etc.)

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 — Deciding What to Do

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.

Reasoning outputs (one per step): → Tool call { name: "web_search", args: { query: "..." } } → Direct reply { type: "text", content: "..." } → Task complete { type: "finish", result: "..." } → Sub-task plan { type: "plan", steps: [...] }

Action — Acting on the World

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 typeExamplesRisk
Read / retrieveWeb search, DB query, file read, RAGLow
ComputeCode execution, data transform, calculationMedium
Write / mutateFile write, DB update, API POSTHigh
CommunicateSend email, Slack message, create ticketHigh
Spawn sub-agentDelegate task to a child agentHigh

Memory — Persisting State

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 typeScopeImplementation
In-context (working)Current sessionContext window — conversation history
External (semantic)Cross-sessionVector database (Pinecone, Weaviate, pgvector)
EpisodicCross-sessionStructured log of past interactions
ProceduralPersistentFine-tuned weights or few-shot skill programs

The Agent Loop

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.

The Agent Loop — Control Flow
Goal
Build context (goal + history + memory)
LLM Reasoning step
tool_call →
execute → append result → loop
finish →
return output ✓
error →
append error → retry or replan
step_count ≥ MAX_STEPS →
graceful_fail()
Python · The agent loop skeleton
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
Key takeaways — 01.2
Always set MAX_STEPS. No agent loop should ever run without a hard step budget.
Errors are observations. Return them to the agent; it will reason about recovery on the next turn.
Apply minimal footprint. Read before write, reversible before irreversible, confirm before acting.
Plan for context pressure. Long loops fill the window fast. Summarisation must be designed in from day one.

“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.2
01.3
Module
Agent Types

Five agent archetypes in production today

Not 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.

Live Practical

Task Agents

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.

Examples: AutoGPT, Claude Projects, OpenAI Assistants Key tools: Calendar API, email API, web search, file system, code execution Key challenge: Goal ambiguity — user intent rarely maps cleanly to tool calls

Coding Agents

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.

Examples: Claude Code, Devin, GitHub Copilot Workspace, Cursor Agent Key tools: Code editor, terminal/shell, test runner, git, web search Key challenge: Long-lived file state and test feedback loops

Browser Agents

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.

Examples: Claude computer use, Playwright Agent, Browserbase, MultiOn Key tools: Playwright/Puppeteer, screenshot capture, DOM parser, click/type actions Key challenge: Web UI fragility — sites change without warning

Research Agents

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.

Examples: Perplexity, Gemini Deep Research, Claude Research mode Key tools: Web search, PDF reader, RAG, document summariser, citation tracker Key challenge: Hallucination — agents must cite sources and flag uncertainty

Voice Agents

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.

Examples: OpenAI Realtime API, ElevenLabs Conversational AI, Bland.ai Key tools: STT (Whisper), TTS (ElevenLabs, Cartesia), telephone API (Twilio) Key challenge: Latency — every added tool call adds 300–800ms to response time
Key takeaways — 01.3
Choose your archetype first. Each type has different tools, latency budgets, and failure modes.
Research agents must cite everything. Hallucinated citations are the primary failure mode.
Voice agents are latency-first. Every tool call added is 300–800ms the user feels.
Browser agents need DOM + vision. Either alone is fragile; combined is most robust.

“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.3
01.4
Module
Reasoning Patterns

ReAct, Plan & Execute, Reflection, and Human-in-the-Loop

The 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.

Live Foundational

ReAct — Reason + Act

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.

Thought: I need to find the current CEO of Anthropic. Action: web_search("Anthropic CEO 2026") Result: "Dario Amodei is CEO of Anthropic." Thought: I have the answer. I can now respond. Action: finish("Dario Amodei is the CEO of Anthropic.")

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.

Plan & Execute

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.

[Planner] Goal: "Research and write a competitive analysis of Notion vs Linear" Plan: 1. Search for Notion pricing and features 2. Search for Linear pricing and features 3. Find recent reviews of both products 4. Synthesise into a structured report [Executor] Step 1 → web_search("Notion pricing 2026") → result Step 2 → web_search("Linear pricing 2026") → result Step 3 → web_search("Notion vs Linear reviews") → result Step 4 → llm_synthesise(results) → final_report

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.

Reflection

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.

[Actor] → Drafts a report [Critic] → Reviews draft Issues: "Section 2 lacks citations. Conclusion is too vague." [Actor] → Revises based on critique [Critic] → Re-reviews → "Approved" [Output] → Final report

Human-in-the-Loop (HITL)

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.

Interrupt triggers (examples): → Before any write/mutate action → When confidence is below threshold → Before spending over $X in API costs → When a new tool or permission is needed → On first run of a new task type

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 Comparison

PatternBest forMain trade-off
ReActMost tasks — best defaultSlightly more tokens per step (the Thought)
Plan & ExecuteStable, well-scoped tasks with independent stepsBreaks when intermediate results change the goal
ReflectionQuality-sensitive outputs (writing, code, analysis)2× latency and cost per iteration
HITLHigh-stakes or irreversible actions in productionLatency — waiting for human input
Cheat Sheet — agentic-ai / agents-intro
Definition
Agent = LLM + Tools + Memory + Loop + Goal
Loop  = Perceive → Reason → Act → Observe → (repeat)
Stop  = Goal achieved | Step limit | Human interrupt | Error
Agent 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, adaptive
Reasoning 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 actions
Key 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
Key takeaways — 01.4
Default to ReAct. It handles the widest range of tasks and makes reasoning auditable.
Plan & Execute breaks on dynamic goals. Use a replanning loop or ReAct when intermediate results change direction.
Reflection 2× the cost, 2× the quality. Use it selectively for high-quality output tasks.
Start with more HITL gates, not fewer. It's easier to remove a checkpoint than recover from an undetected error.
Back to Library Index
Next chapter 02 · Agent Design Patterns