What you will have at the end
- A CLI: research "question" → Markdown report with sources
- A notes MCP server usable from other clients too
- Traces of real runs showing plan, tool calls and stop reason
Step by step
- Write the loopStart from the agent loop lesson: tools list, handlers, step limit, error feedback. Log every step.
- Add search and fetch toolsweb_search(query) returns titles, URLs and snippets; fetch_page(url) returns cleaned text trimmed to ~3,000 characters.
- Add a plan toolThe agent must call update_plan first and update it as steps finish. Show the plan in the log.
- Write the MCP notes serverFastMCP server with save_note(topic, text, source_url) and list_notes(topic). Test it with the MCP Inspector.
- Connect the agent to MCPAt startup, open a client session to your notes server, list its tools and add them to the agent’s tools.
- GuardsMax 15 steps, max cost, timeout and repeated-call detection. On stop, write a partial report with the reason.
- Final reportA finish tool takes the report in Markdown with numbered sources. Validate that every source URL was actually fetched.
- Run and documentRun 5 real questions, save the reports and traces, and put cost, steps and time per run in the README.
DONE WHEN
- Every report cites only pages the agent fetched
- No run exceeds the step or cost limit
- The notes server works in at least one other MCP client
Stretch goals
- Parallel workers for sub-questions (orchestrator-worker)
- Checkpoint and resume
- Human approval before fetching more than N pages