Learning / Agentic Operations / Lesson 0008

Agentic Operations · Lesson 0008 · Level 2 · Developing · Guided build

The ReAct Multi-Hop Build

Thought → action → observation, looped — the workhorse pattern, built and logged by hand.

Your win for this lesson: an agent that answers a question no single lookup can answer, with a logged thought/action/observation trace you can replay — the rubric's first M2 exercise. Prerequisites: Lesson 0002, Lesson 0005.

1 · The corpus (offline, deterministic)

No web APIs needed — the pattern is the point. Create exercises/notes/ with 6–10 small text files forming a chain of facts, e.g. team.md ("The pipeline runs on Temporal; Marisol owns the worker fleet"), marisol.md ("Marisol's runbook lives at runbook-w3.md"), runbook-w3.md ("Worker restarts require the ops channel approval; the channel is #ops-west")… Design a question that takes 3+ hops: "Which channel must approve a restart of the fleet owned by the person who owns the pipeline workers?"

2 · Two tools

Extend your 0005 loop with two tools (same schema discipline — descriptions say when):

search_notes(query)  ->  filenames whose content matches the query terms
read_note(filename)  ->  the file's full text

Implementation stays boring: substring/keyword match for search; path-validate read_note against the notes directory (untrusted input — 0005's rule).

3 · Elicit the pattern

ReAct is interleaved reasoning and acting (Yao et al.): the model states a thought, takes one action, reads the observation, adjusts. Two changes produce it:

Pass: the multi-hop question is answered correctly, and the trace file reads as a coherent chain: each thought references the previous observation. If the model answers from nothing (hallucinated hop), tighten the prompt: "Only state facts you have read from a note in this session."

4 · Watch it adjust — the part CoT can't do

Now sabotage one hop: rename a file so a search comes back empty, or plant a note whose content contradicts another. Re-run and read the trace.

Pass: the trace shows the model reacting to the observation — reformulating the search, choosing another file — rather than plowing on. That mid-course adjustment is the entire argument for ReAct over linear chain-of-thought on tool-driven tasks. Keep this trace; it's gate evidence.
Justify the choice (the M2 gate skill): write three sentences — why ReAct and not CoT for this task (external facts needed mid-reasoning); why not Tree-of-Thought (no branching search justifying the token cost); what the per-hop cost was (read it off your usage log). If you can write those three sentences about any task, you've passed the heart of M2.

Self-grade

Next

Lesson 0009 — RAG build & break: grounding at scale, and what happens when chunking is wrong.