ReAct Research Agent
Implement a ReAct loop over a fake web corpus: thought, search, citations, max steps, and a cannot-answer path when evidence is missing.
Outcome: A research agent that searches a toy corpus, quotes sources, stops at a step cap, and says it cannot answer when the corpus is silent.
intermediate · 6–8 hours
- 01
Overview and Architecture
Map ReAct: interleaved thoughts, actions, and observations over a closed web of documents, with citations as a first-class output.
- 02
Fake Web Search and Open
Build a closed corpus, a token-overlap search tool, and an open(url) reader that truncates pages and never invents URLs.
- 03
The ReAct Loop
Parse Thought/Action/Action Input, run search and open, cap steps, and finish with an answer object including citations.
- 04
Citations, Max Steps, and Cannot-Answer
Validate citations against opened URLs, require evidence spans, and implement a first-class cannot-answer finish for missing facts.
- 05
Evals and Hardening
Score an eval set, block duplicate searches, resist snippet-only answers, and keep the agent from citing the distractor ad page.