Skip to content

7100: Agent Architecture

⏱ 5 min read·📅 Last updated: 2026-10-22

Module Overview

This module covers the fundamental architectures of AI agents, from ReAct loops to planning systems. You'll learn to design and implement agents that can reason, act, and achieve complex goals.

Why This Matters:

  • Agents are the future of AI interaction
  • ReAct and planning enable complex multi-step tasks
  • Agent architecture determines capabilities and limitations
  • Foundation for all agentic AI systems

Learning Objectives

After completing this module, you will be able to:

  • ReAct Loops: Implement reasoning-acting cycles
  • Planning Systems: Build goal-directed agents
  • Task Decomposition: Break complex goals into subtasks
  • Agent Design: Choose architectures for specific use cases
  • Evaluation: Score trajectories with deterministic scorers, LLM judges, and confidence intervals
  • Reflection & Self-Correction: Make the loop grade and improve its own answers
  • Function Calling: Train the tool choice from pairs and guarantee the call syntax with a grammar mask

Module Contents

7101: ReAct (Reasoning + Acting) Loop System

Reasoning and Acting in Cycles

  • The ReAct pattern: Thought → Action → Observation
  • Implementing the loop
  • Tool calling
  • State management
  • Production use and advanced patterns

Experiments:

  • Implement ReAct loop from scratch
  • Build tool-calling agent
  • Add memory and context
  • Handle failures gracefully

7102: Planning and Decomposition

Goal-Directed Agent Behavior

  • Task decomposition strategies
  • Forward and backward planning
  • Task planning with dependencies
  • Replanning on failure
  • Distributed planning

Experiments:

  • Implement planning agent
  • Build task decomposition system
  • Add replanning logic
  • Coordinate multiple agents

7103: ReAct Implementation Guide

Production ReAct Agent Workshop (Guide)

  • Architecture overview
  • Complete implementation
  • Advanced features
  • Production deployment
  • Best practices

Guide: guides/7103-ReAct-Implementation-Guide.md

7104: Agent Evaluation and Observability

Measuring the Loop as Working Code

  • The evaluation ladder: deterministic checks, programmatic scorers, LLM-as-judge
  • Trajectories as JSONL; exact, containment, schema, and tool-sequence scorers
  • Bootstrap confidence intervals on small-sample success rates
  • Pairwise judge position bias, both-orders detection, swap-averaging
  • OpenTelemetry GenAI traces (invoke_agent/chat/execute_tool) and budget rollups
  • Regression gates in CI with an aggregate threshold and a golden set

Experiments:

  • Score recorded trajectories at all three ladder rungs
  • Bootstrap a success-rate interval for your own run log
  • Flip a pairwise judge with answer order, then cancel the bias
  • Wire the two-tripwire regression gate into CI

7105: Reflection and Self-Correction

The Loop That Grades Its Own Work

  • The refine loop (Self-Refine): draft-critique-revise in detect-mode discipline
  • Self-consistency: the plurality amplifier and its K-times decode bill
  • The self-correction boundary: intrinsic rewrites decay, verifier-gated repairs climb
  • The retry split: bare, critique-injected, within-run carryover
  • The campaign ledger: one batch, five policies, five bills

Experiments:

  • Run the refine loop and read the accuracy walk as a defect-class ledger
  • Watch the vote converge on the wrong mode when the wrong mode is plural
  • Price intrinsic vs verifier-gated correction on the same batch

7106: Function-Calling Training and Constrained Decoding

The Grammar Owns the Syntax, the Data Owns the Semantics

  • The grammar-to-mask mechanism: a call grammar compiled to a twelve-state FSM
  • Prompting is not constraining: 0.7940 valid bought with retries against 1.0000 guaranteed
  • Training the call: the Gorilla recipe and the pair walk to the coverage ceiling
  • Syntax guarantees, semantics trains: the 2x2 and its only deployable cell
  • The campaign ledger: four stacks, one-time training bill, per-request mask guarantee

Experiments:

  • Compile the call grammar and flip validity with the mask alone
  • Price prompting vs masking on the same request stream
  • Train the tool choice and watch the walk plateau at the vocabulary ceiling
  • Run the four-stack campaign ledger

Prerequisites

Before starting this module, ensure you have:

Review: PREREQUISITES.md for detailed requirements.

Assessment

Quiz

Practice Exercises

  • Format: Agent implementation projects
  • Duration: 7 hours
  • Topics:
    • Build ReAct agent from scratch
    • Implement planning system
    • Create multi-agent coordination
    • Evaluate agent performance
  • Location: 7100: LLM Reasoning - Practice

This module connects to:

Time Commitment

Activity Time
7101: ReAct (Reasoning + Acting) Loop System 4 hours
7102: Planning and Decomposition 4 hours
7104: Agent Evaluation and Observability 4 hours
7105: Reflection and Self-Correction 4 hours
7106: Function-Calling Training and Constrained Decoding 4 hours
Guide (7103) 4 hours
Quiz 30 minutes
Practice 7 hours
Total 31.5 hours

Resources

Essential Frameworks:

  • LangChain (agents)
  • AutoGen (multi-agent)
  • CrewAI (role-playing agents)
  • LangGraph (agent workflows)

Essential Papers:

  • "ReAct: Synergizing Reasoning and Acting in Language Models"
  • "Reflexion: Language Agents with Verbal Reinforcement Learning"
  • "Tree of Thoughts: Deliberate Problem Solving with Large Language Models"

Agent Architecture Comparison

Architecture Complexity Flexibility Best For
Simple ReAct Low Medium Single tasks
ReAct + Memory Medium High Complex tasks
Planning Agent High Very High Multi-step goals
Multi-Agent Very High Very High Distributed problems

ReAct Loop Structure

┌─────────────────────────────────────┐
│         ReAct Loop                  │
├─────────────────────────────────────┤
│ 1. Thought: What should I do?       │
│    ↓                                │
│ 2. Action: Call tool/function       │
│    ↓                                │
│ 3. Observation: Result of action    │
│    ↓                                │
│ 4. Thought: What next?              │
│    ↓                                │
│ 5. Repeat until done                │
└─────────────────────────────────────┘

Planning Strategies

Strategy Description Use Case
Sequential Linear task execution Simple workflows
Hierarchical Top-down decomposition Complex goals
Reactive Respond to changes Dynamic environments
Multi-Agent Distributed planning Parallel tasks

Agent Capabilities

Capability Simple ReAct Planning Agent Multi-Agent
Tool Use ⭐⭐⭐ ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Reasoning ⭐⭐⭐ ⭐⭐⭐⭐⭐ ⭐⭐⭐⭐
Adaptation ⭐⭐ ⭐⭐⭐⭐ ⭐⭐⭐⭐⭐
Parallel Execution ⭐ ⭐⭐ ⭐⭐⭐⭐⭐
Coordination N/A ⭐⭐ ⭐⭐⭐⭐⭐

Tips for Success

  1. Start simple: Basic ReAct before planning
  2. Design tools carefully: Good tools make good agents
  3. Handle failures: Agents will fail, plan for it
  4. Add logging: Debugging agents is hard
  5. Test thoroughly: Agents are non-deterministic

Common Pitfalls

  1. Loops that don't terminate: Always add max iterations
  2. Vague thoughts: Be specific in reasoning
  3. Too many tools: Start with essential tools
  4. No error handling: Tools fail, agents should adapt
  5. Ignoring context: Agents need memory

When to Use Each Architecture

Scenario Architecture
Simple tool use ReAct
Complex workflows Planning Agent
Parallel tasks Multi-Agent
Research and analysis ReAct + Memory
Code generation ReAct + Tools

Agent Evaluation Metrics

Metric Description Target
Success Rate Tasks completed >80%
Tool Accuracy Correct tool calls >90%
Step Efficiency Steps to completion Minimize
Error Recovery Recovers from errors >70%
Reasoning Quality Logical thought process Qualitative

Example ReAct Prompt

You are a helpful agent with access to tools.

Use this format:
Thought: [your reasoning]
Action: tool_name [input]
Observation: [result]
... (repeat)

Available tools:
- search: Search the web
- calculator: Perform calculations
- code: Execute Python code

Question: [user query]
Thought: Let me think about this...

Next Module: 7200: Tool Calling and Function Execution

Previous Module: 6500: MLOps Pipelines for RAG

Questions? Review the PREREQUISITES.md or check Phase 7 documentation.