Area 03 · AI Agents · Build this

Research agent with a plan, memory and your own MCP server

An agent that takes a research question, writes a plan, searches and reads the web, saves notes as memory, and produces a cited report. One of its tools comes from an MCP server you wrote.

Phase 3 · Weeks 11–14

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

  1. Write the loopStart from the agent loop lesson: tools list, handlers, step limit, error feedback. Log every step.
  2. Add search and fetch toolsweb_search(query) returns titles, URLs and snippets; fetch_page(url) returns cleaned text trimmed to ~3,000 characters.
  3. Add a plan toolThe agent must call update_plan first and update it as steps finish. Show the plan in the log.
  4. Write the MCP notes serverFastMCP server with save_note(topic, text, source_url) and list_notes(topic). Test it with the MCP Inspector.
  5. 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.
  6. GuardsMax 15 steps, max cost, timeout and repeated-call detection. On stop, write a partial report with the reason.
  7. Final reportA finish tool takes the report in Markdown with numbered sources. Validate that every source URL was actually fetched.
  8. 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