Agent Fundamentals
Agents are LLM-powered systems that move beyond "chat" into "autonomous problem solving." The definition has shifted from simple ReAct loops to Closed-Loop Reasoning Systems that use built-in "System 2" thinking (Claude Opus 4.7 extended thinking, GPT-5.5 reasoning, DeepSeek-R2, Gemini 3.1 Pro Deep Think).
Reasoning Loops: ReAct and Beyond
Reasoning Loops define the control flow of an agent. While ReAct was the 2023 baseline, current systems use more sophisticated patterns like Plan-and-Solve, Self-Reflexion, and Inference-Time Scaling running on top of reasoning-native models.
Tool Use and MCP
Tools are the "hands" of an agent. The industry has standardized on the Model Context Protocol (MCP), which replaces fragmented custom tool definitions with a unified, local-first communication layer. MCP has matured rapidly: Streamable HTTP transport, OAuth 2.1 auth, and native computer-use tools landed across the 2025 spec revisions (what much of the ecosystem loosely calls MCP 2.0), and the 2026-07-28 revision rebuilt the protocol core as stateless, the largest overhaul since MCP launched (see the stateless rewrite below). In parallel, Agent-to-Agent (A2A) and other interoperability protocols have emerged to complement MCP's tool-access layer with agent coordination capabilities.
Multi-Agent Orchestration
Complex systems are rarely one agent. They are teams of specialized agents. Orchestration has matured from "Blind Managers" to Hierarchical Supervisors, Dynamic Swarms, and Cross-Vendor Agent Networks enabled by interoperability protocols like A2A. Gartner projects that 40% of enterprise applications will feature task-specific AI agents by end of 2026, up from under 5% in early 2025.
Agent Memory and State
Memory is what allows an agent to learn and maintain context over time. Agent memory has matured from "Chat History" into a Multi-Tiered Cognitive Architecture with four named layers (Working, Episodic, Semantic, Procedural), each with its own write pattern, latency budget, and failure modes. Production systems (Mem0, Letta, Anthropic Memory Tool + Skills, Zep/Graphiti, LangMem) now treat memory selection as a first-class architecture decision.
Planning and Decomposition
Planning is the "System 2" component that allows agents to solve multi-stage problems without "wandering." Production agents have moved from simple "Chain-of-Thought" to Recursive Decomposition and Tree Search, with reasoning-native models (Claude Opus 4.7, GPT-5.5 extended thinking, DeepSeek-R2) doing the heavy planning internally.
Error Handling and Recovery
Agents fail in non-deterministic ways. Error handling has moved from "Try-Catch blocks" to Agentic Self-Correction and Stateful Rollbacks, with frameworks like LangGraph and Microsoft Agent Framework providing native checkpoint/resume primitives.
Human-in-the-Loop Patterns
No agent is 100% reliable. Human-in-the-Loop (HITL) is the bridge that ensures safety and accuracy in high-stakes environments. Production stacks have moved beyond "Approval Buttons" to Co-Reasoning and Interrupt-Based Steering, exposed natively in frameworks like LangGraph (interrupt+resume) and Microsoft Agent Framework.
Agentic Security and Sandboxing
Agents represent a massive security shift: they don't just "leak information," they "take actions." Agentic security focuses on Action Isolation and The Proxy Pattern, and OWASP's LLM Top 10 v2.0 now explicitly carves out agent-specific risks like excessive agency and tool exfiltration.
Evaluating Agentic Systems
Evaluating agents is fundamentally different from evaluating RAG. While RAG is about "Accuracy," Agents are about "Reliability," "Efficiency," and "Safety." Production agent eval relies on Trajectory Benchmarks and LLM-as-Judge for multi-step reasoning, with tools like Langfuse, LangWatch, Braintrust, and Arize Phoenix offering native trace-level scoring.
Durable Execution for Long-Running Agents
An agent run is not a request/response handler. It calls tools, reads documents, triggers actions, waits for approvals, and carries state across steps that may run for minutes, hours, or days. That collides with ordinary infrastructure: processes get killed, nodes get recycled, and deploys roll pods. A naive agent loop holding state in memory loses everything on any of those events, and a naive retry re-runs side effects. Durable execution is the discipline that makes long-running agents survive all of it. This chapter covers the model, the tools, how it maps onto agent loops, and when it is worth the complexity.
Loop Engineering
Chapter 02 covered how a model reasons inside a single step: ReAct, Reflexion, Plan-and-Solve. Loop engineering is the discipline that wraps that reasoning. It is the practice of designing, instrumenting, and continuously improving the control loops around a core agent (a model plus tools), instead of hand-prompting the model turn by turn.
Agentic Systems
Building production AI agents in 2026: reasoning loops, MCP tool use, multi-agent orchestration, memory, planning, error recovery, human-in-the-loop, and evaluation.