Skip to content

Module 2: Foundational Concepts

Carlos Lizarraga-Celaya edited this page Sep 30, 2026 · 21 revisions

2. Foundational Concepts

Now that we know what agents are, we move on to the next question: how do modern LLM-based agents actually reason and act?

The Module 2 readings introduce five interconnected frameworks that form the technical and analytical vocabulary of contemporary LLM-based agent design. These frameworks address:

  • How agents reason (Chain-of-Thought, ReAct, Tree of Thoughts, LATS)
  • How they act through tools (create_agent architecture)
  • How their reasoning can be interpreted and critiqued (trace analysis)
  • How their behavior can be shaped through language (prompt engineering)
  • How competing architectural choices are evaluated for production deployment (trade-off assessment)

a. Chapter 1: The Four Agent Reasoning Paradigms

i. Chapter 1 Lesson (~18 min)

The four reasoning paradigms in Module 2 represent a developmental arc in the field: each addresses specific limitations exposed by its predecessor. Understanding this arc - not merely the techniques themselves - is the key to knowing when each paradigm is appropriate. The progression from CoT to LATS is a progression from linear to branching, from reactive to deliberate, and from low-cost to high-cost reasoning.

Paradigm 1: Chain-of-Thought Prompting (Wei et al., 2022)

Wei et al. (2022) demonstrated that prompting large language models to produce intermediate reasoning steps - a chain of thought - substantially improves performance on complex reasoning tasks including arithmetic, commonsense reasoning, and symbolic manipulation. The critical finding is that this capacity is emergent: it is absent in smaller models and appears only above a scale threshold, suggesting that chain-of-thought reasoning reflects a qualitative capability transition rather than a continuous improvement curve.

Paradigm 2: ReAct - Synergizing Reasoning and Acting (Yao et al., 2022)

Yao et al. (2022) introduced ReAct as a solution to the fundamental limitation that chain-of-thought operates entirely within the model's internal knowledge - it cannot access external information during reasoning. ReAct interleaves reasoning steps (Thought) with actions (Act) and observation of action outputs (Observe), creating a three-phase cycle that grounds reasoning in real-world information retrieved during the task.

The ReAct loop is the default reasoning architecture for production agents today. The ability to read and diagnose a ReAct trace - identifying which Thought step was faulty, which Act was incorrectly specified, or which Observe was misinterpreted - is the core diagnostic skill of Module 2.

Paradigm 3: Tree of Thoughts (Yao et al., 2023)

Yao et al. (2023) identified a fundamental limitation of ReAct for complex, open-ended problems: the linear thought-action-observe cycle commits to a single path and cannot recover gracefully from dead ends. Tree of Thoughts (ToT) replaces the linear chain with a deliberate search over a tree of coherent language sequences (thoughts), where the model generates multiple candidate reasoning paths, evaluates them using a heuristic or the model itself, and selects the most promising path to explore - with backtracking.

Note

When Tree of Thoughts is Justified
ToT incurs substantially higher computational cost than CoT or ReAct - it requires generating and evaluating multiple reasoning branches per step, which multiplies inference costs. ToT is justified when: (1) the problem has a large state space with many possible solution paths; (2) intermediate states can be meaningfully evaluated before the full solution is known; (3) backtracking is necessary because early commitment to a wrong path is catastrophically costly; and (4) computational budget and latency are not primary constraints. Canonical use cases include planning problems, multi-step mathematical proof construction, and creative generation tasks with complex constraint satisfaction.

Paradigm 4: Language Agent Tree Search (Zhou et al., 2023)

Zhou et al. (2023) proposed LATS (Language Agent Tree Search) as a unifying framework that integrates the deliberate search of ToT with the grounded tool use of ReAct and a reinforcement learning-inspired self-reflection mechanism. In LATS, each node in the search tree represents not just a thought but a complete action-observation pair - the agent acts in the world at each search node and uses the observation to evaluate node quality. This enables the system to ground its deliberate search in real-world feedback rather than purely internal model judgment. The cost of LATS is commensurate with its power: it requires many more LLM calls per task, more complex state management, and more sophisticated evaluation logic. LATS is the current state of the art for tasks that require both deliberate planning over a large state space AND real-world information retrieval during search. Most production systems today use ReAct for cost reasons; LATS represents the frontier of what is possible when cost and latency constraints permit.

The Four-Paradigm Comparison Attributes

The following table enables side-by-side evaluation across seven attributes that determine architectural selection in professional practice:

ii. Learning Resources

Reading 1 — Chain of Thought Prompting [~ 10 min]

  • Wei, J. et al. (2022). Chain-of-thought prompting elicits reasoning in large language models. NeurIPS 2022.
    • Read: Abstract + Section 2 (Chain-of-Thought Prompting) and Figure 1. You may skim Section 4 (Experimental Setup) but are not required to read it in full.
    • Extract: What is a reasoning trace in the CoT sense? What does CoT add to standard few-shot prompting? What task class shows the largest CoT benefit, and why?

Reading 2 — ReAct: Reason + Act [~ 12 min]

  • Yao, S. et al. (2022). ReAct: Synergizing reasoning and acting in language models. ICLR 2023.
    • Read: Sections 1 and 2 (Introduction + ReAct: Synergizing Reasoning and Acting).
    • Extract: How does ReAct differ structurally from CoT? What is the Thought/Action/Observation cycle? When does the loop terminate?

iii. Chapter 1 Quiz

b. Chapter 2: Tool Integration Architecture

i. Chapter 2 Lesson (~14 min)

Tool use is what separates an AI agent from an LLM. An LLM without tools operates on the knowledge encoded in its parameters during training - frozen at its training cutoff, unable to access external systems, and capable only of text generation. An agent with tools can retrieve live information, execute code, write to databases, send communications, and interact with APIs. However, tool integration introduces a new class of failure modes that are distinct from LLM reasoning failures and require different diagnostic approaches.

The create_agent Factory (LangChain)

LangChain's create_agent is the current production API for constructing multi-tool ReAct agents. It replaces the legacy AgentExecutor class with a cleaner factory function that integrates directly with LangGraph's stateful execution graph. create_agent accepts five primary parameters and returns a compiled, runnable agent:

  • model — a chat model instance (e.g., ChatOpenAI, ChatAnthropic) or a model identifier string. This is the LLM backbone that drives all reasoning steps.
  • tools — a sequence of BaseTool objects, callables, or tool-specification dicts. The agent's tool registry is constructed from this sequence; tool descriptions embedded in each BaseTool are used for selection at inference time.
  • system_prompt — an optional string or SystemMessage that injects persistent behavioral instructions before any user turn. This is the primary mechanism for role definition, output format constraints, and ethical boundaries.
  • middleware — an optional sequence of AgentMiddleware objects for observability, tracing, and logging. Middleware intercepts each reasoning step without modifying agent logic, enabling production monitoring without altering behavior.
  • response_format — an optional structured output specification (Pydantic model, type, or schema dict) that constrains the agent's final response to a defined schema. When set, the agent's output parser enforces this format rather than returning raw text.

The agent returned by create_agent runs a LangGraph-backed ReAct loop internally: on each invocation, it iterates through Thought → tool call → Observation cycles until a terminal condition is reached, then produces a Final Answer in the specified response format. Unlike AgentExecutor, state management, loop control, and tool dispatch are handled by the underlying LangGraph execution graph — making the agent inherently compatible with checkpointing, streaming, and multi-agent orchestration.

Tool Description Design - The Specification Discipline

Tool descriptions are the contract between the agent and the tool ecosystem. An effective tool description answers five questions precisely:

  • What does this tool do? State the tool's function in one sentence using active verbs and concrete output types. Example: 'Searches the web and returns the top-5 result snippets for a given query string.'
  • When should the agent use it? Specify the conditions under which this tool is appropriate, and explicitly note conditions where it is NOT appropriate. This prevents incorrect tool selection.
  • What arguments does it require? List every argument with its type, format, and any constraints. Ambiguous argument specifications produce hallucinated values, especially for structured data types.
  • What does the output look like? Describe the output format so the agent can parse it correctly. If the tool returns JSON, describe the schema. If it returns plain text, describe its structure.
  • What errors can it produce? List the error states the tool may return and what the agent should do on each error. Undocumented errors produce agents that silently misinterpret failure states as data.

Note

THE HETEROGENEOUS TOOL ECOSYSTEM
Production agents rarely use a single tool type. A realistic tool set might include: a web search tool (retrieves live information), a Python REPL (executes code and returns output), a database tool (reads/writes structured data), a file tool (reads/writes documents), an email tool (sends communications), and a calendar tool (reads/modifies schedule data). Each tool type has distinct description requirements, argument schemas, error modes, and risk profiles. The skill of designing a cohesive, well-described heterogeneous tool set - where the agent reliably selects the right tool for each subtask - is the practical competency developed in Module 2's Guided Labs.

ii. Learning Resources

Reading 3 — LangChain create_agent [~10 min]

  • LangChain Documentation: create_agent API Reference and Tool Creation Reference.

    • Read the entire create_agent API Reference section. Pay particular attention to: the role of the tools parameter in constructing the tool registry, how tool descriptions embedded in BaseTool objects are used for selection at inference time, and how response_format constrains the agent's output.
  • Video 2 — "Understanding ReACT with LangChain" - Sam Witteveen (~22 min)

    • Watch focus: the conceptual distinction between CoT and ReAct and the observation integration step.
    • As you watch, map what you see in the video to the structural definitions from Reading 2. If the video uses a different term for the same concept, note both.

iii. Chapter 2 Quiz

c. Chapter 3: Reasoning Trace Interpretation and Critique

i. Chapter 3 Lesson (~5 min)

A reasoning trace is the complete log of an agent's internal reasoning steps, tool calls, and tool observations during the execution of a task. In production systems, the reasoning trace is the primary diagnostic artifact when an agent fails to produce correct output. The ability to read a reasoning trace analytically - identifying where reasoning deviated, why a tool call was incorrect, and what change to the agent design would fix the failure - is a high-value professional competency.

The Five Classes of Reasoning Trace Failure

Systematic trace analysis reveals that agent failures cluster into five distinguishable failure classes, each with a different root cause and a different fix:

ii. Learning Materials

iii. Chapter 3 Quiz

d. Chapter 4: Prompt Engineering for Agent Behavioral Control

i. Chapter 4 Lesson (~9 min)

For agents, prompt engineering is not the craft of writing better chatbot prompts. It is a design discipline for specifying agent behavior across four dimensions: what the agent knows about its role and constraints (system instructions), what tools the agent can use and how (tool descriptions), what patterns of reasoning the agent should follow (few-shot CoT scaffolds), and what format the agent's outputs must conform to (output format constraints). Each dimension is independently configurable and independently contributes to agent reliability.

Note

BEHAVIORAL CONTROL IS NOT A PATCH - IT IS AN ARCHITECTURE
A common error in agent development is to treat behavioral problems as prompting problems: when the agent does something unintended, the instinct is to add a sentence to the system prompt. This approach accumulates fragile constraints that interact unpredictably. The professional approach is to treat behavioral control as an architectural concern: define behavioral boundaries clearly at design time, test them systematically before deployment, and instrument the agent to detect and log behavioral violations in production. Module 2's hands- on project requires you to document three specific behavioral constraints and the prompting mechanism used to enforce each.

ii. Learning Materials

iii. Chapter 4 Quiz

Chapter 5: Architectural Trade-off Assessment for Production Deployment

i. Chapter 5 Lesson (~7 min)

Selecting a reasoning architecture is not a purely technical decision. It is a multi-objective optimization problem with six dimensions that professional practitioners must evaluate explicitly.

The architecture justification in your Project Proposal must document your reasoning across all six dimensions - not just the technical choice, but the evidence-based justification for that choice given the specific problem context.

The European Parliament's AI Act (2024) is directly relevant to architectural choice for high-risk AI systems. Article 13 of the Act requires that high-risk AI systems provide output that is 'sufficiently transparent' to enable the system's deployer to understand and interpret the system's outputs. For agent systems deployed in high-risk domains - healthcare decision support, legal document processing, financial analysis - this interpretability requirement has direct implications for architecture selection. A LATS agent operating in a high-risk domain may face regulatory scrutiny that a ReAct agent would not, precisely because the branching trace is harder to audit.

ii. Learning Resources

Reading 4 - EU AI Act, Article 13 *European Parliament (2024). Regulation (EU) 2024/1689 — Artificial Intelligence Act. Read Title III, Chapter 2, Article 13 (Transparency and provision of information to deployers). The primary regulatory source cited in Chapter 5; directly governs interpretability requirements for high-risk AI systems. Reading 5 - NIST AI RMF

  • National Institute of Standards and Technology (2023). AI Risk Management Framework (AI RMF 1.0). The U.S. federal framework for identifying, measuring, and managing AI risk across the system lifecycle — maps directly onto the safety/risk dimension of Chapter 5's six-dimension trade-off model.

iii. Chapter 5 Quiz


Created: 05/10/2026 (C. Lizárraga)
Updated: 08/03/2026 (M. Yung)

Clone this wiki locally