Skip to content

Stage 6: AI Agents

6 Build controlled tool-using systems, not vague autonomy.

Goal

Learn the agent loop, planning, tools, MCP, memory, multi-agent coordination, evaluation, observability, and security boundaries.

Roadmap to Master This Stage

  1. Read the stage goal and diagram before opening the parts.
  2. Move through the parts in order unless you can already pass the exit criteria.
  3. Study each sub-part folder: overview, deep dive, and examples/practice.
  4. Build the stage artifact in small slices and measure the listed metrics.
  5. Use the part exam after each part, or open the global Exam tab to test across the roadmap.

Stage Structure Diagram

%%{init: {"flowchart": {"htmlLabels": true, "nodeSpacing": 70, "rankSpacing": 90}, "themeVariables": {"fontSize": "18px"}} }%%
flowchart LR
  P1["<b>6.1</b><br/>Agent Loop Fundamentals"]
  P2["<b>6.2</b><br/>Reasoning and Planning<br/>Patterns"]
  P1 --> P2
  P3["<b>6.3</b><br/>Tool Design"]
  P2 --> P3
  P4["<b>6.4</b><br/>MCP and Tool Ecosystems"]
  P3 --> P4
  P5["<b>6.5</b><br/>Memory and Agentic RAG"]
  P4 --> P5
  P6["<b>6.6</b><br/>Multi-Agent Systems"]
  P5 --> P6
  P7["<b>6.7</b><br/>Agent Evaluation and<br/>Observability"]
  P6 --> P7
  P8["<b>6.8</b><br/>Agent Security and<br/>Safety"]
  P7 --> P8

Parts

Part Simple explanation Build focus
6.1 Agent Loop Fundamentals Build the observe-think-act-observe-finish loop explicitly before using frameworks. Build a manual ReAct-style agent.
6.2 Reasoning and Planning Patterns Use planning, decomposition, reflection, and routing only when the task needs them. Compare direct, ReAct, and planner-executor designs.
6.3 Tool Design Give agents safe, typed, observable interfaces to useful software capabilities. Create three typed tools.
6.4 MCP and Tool Ecosystems Use Model Context Protocol concepts to expose tools and resources with clear boundaries. Create one MCP-style tool server or documented equivalent.
6.5 Memory and Agentic RAG Manage short-term state, long-term memory, retrieval, summarization, and forgetting. Build an agent with retrieval and selective memory.
6.6 Multi-Agent Systems Coordinate specialized agents only when the extra communication improves outcomes. Build a planner-researcher-writer-reviewer comparison.
6.7 Agent Evaluation and Observability Make runs inspectable through task evals, tool tests, traces, metrics, and replay. Add evals and tracing to the agent.
6.8 Agent Security and Safety Defend against prompt injection, tool abuse, secret leaks, and excessive agency. Red-team the agent and add mitigations.

Sub-Part Map

Part Sub-part Why it matters
6.1 6.1.1 Agent State and Messages Agent State and Messages is the working skill inside Agent Loop Fundamentals that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.1 6.1.2 Observe Reason Act Observe Observe Reason Act Observe is the working skill inside Agent Loop Fundamentals that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.1 6.1.3 Final Answer and Stop Rules Final Answer and Stop Rules is the working skill inside Agent Loop Fundamentals that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.1 6.1.4 Loop Budget and Cancellation Loop Budget and Cancellation is the working skill inside Agent Loop Fundamentals that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.2 6.2.1 ReAct Pattern ReAct Pattern is the working skill inside Reasoning and Planning Patterns that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.2 6.2.2 Planner Executor Planner Executor is the working skill inside Reasoning and Planning Patterns that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.2 6.2.3 Reflection and Self Critique Reflection and Self Critique is the working skill inside Reasoning and Planning Patterns that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.2 6.2.4 Routing and Workflow Agents Routing and Workflow Agents is the working skill inside Reasoning and Planning Patterns that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.3 6.3.1 Tool Contracts and JSON Schema Tool Contracts and JSON Schema is the working skill inside Tool Design that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.3 6.3.2 Function Calling Function Calling is the working skill inside Tool Design that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.3 6.3.3 Tool Errors Timeouts and Retries Tool Errors Timeouts and Retries is the working skill inside Tool Design that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.3 6.3.4 Idempotency and Side Effects Idempotency and Side Effects is the working skill inside Tool Design that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.4 6.4.1 MCP Hosts Clients and Servers MCP Hosts Clients and Servers is the working skill inside MCP and Tool Ecosystems that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.4 6.4.2 Resources Tools and Prompts Resources Tools and Prompts is the working skill inside MCP and Tool Ecosystems that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.4 6.4.3 Local vs Remote MCP Local vs Remote MCP is the working skill inside MCP and Tool Ecosystems that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.4 6.4.4 Authentication and Exposure Boundaries Authentication and Exposure Boundaries is the working skill inside MCP and Tool Ecosystems that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.5 6.5.1 Working Memory Working Memory is the working skill inside Memory and Agentic RAG that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.5 6.5.2 Long Term Memory Types Long Term Memory Types is the working skill inside Memory and Agentic RAG that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.5 6.5.3 Retrieval as a Tool Retrieval as a Tool is the working skill inside Memory and Agentic RAG that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.5 6.5.4 Summarization Compression and Forgetting Summarization Compression and Forgetting is the working skill inside Memory and Agentic RAG that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.6 6.6.1 Supervisor Worker Supervisor Worker is the working skill inside Multi-Agent Systems that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.6 6.6.2 Agents as Tools Agents as Tools is the working skill inside Multi-Agent Systems that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.6 6.6.3 Handoffs and Shared State Handoffs and Shared State is the working skill inside Multi-Agent Systems that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.7 6.7.1 Task Evals Task Evals is the working skill inside Agent Evaluation and Observability that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.7 6.7.2 Tool Unit and Integration Tests Tool Unit and Integration Tests is the working skill inside Agent Evaluation and Observability that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.7 6.7.3 Structured Tracing Structured Tracing is the working skill inside Agent Evaluation and Observability that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.7 6.7.4 Replay and Failure Triage Replay and Failure Triage is the working skill inside Agent Evaluation and Observability that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.8 6.8.1 Prompt Injection Against Agents Prompt Injection Against Agents is the working skill inside Agent Security and Safety that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.8 6.8.2 Least Privilege Tool Access Least Privilege Tool Access is the working skill inside Agent Security and Safety that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.
6.8 6.8.3 Secret Handling and Sandboxing Secret Handling and Sandboxing is the working skill inside Agent Security and Safety that helps you build the stage artifact, A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README, while collecting enough evidence to trust the result.

Stage Artifact

A tool-using agent with typed tools, memory, traces, task evals, prompt-injection tests, and an architecture README.

What to Measure

  • task success rate
  • tool error rate
  • loop step count
  • cost per successful task
  • security test pass rate

Exit Criteria

  • implement a manual agent loop
  • design typed tools and permissions
  • use memory intentionally
  • trace, evaluate, and red-team runs

Previous: Stage 5: AI Applications | Next: Stage 7: Model Infrastructure