← Back to Projects

Multi-Agent Researcher

advancedPhase 08 · AI AgentsPythonLangGraphTavily / Serper

Use LangGraph or AutoGen to build a research assistant that plans a query, scrapes sources, grades relevance, and writes a cited report.

What you'll learn

  • Managing state across multiple LLM calls
  • Providing tools (Web Search, Web Scrape) to an agent
  • Implementing loops and conditional edges (e.g., "if search results are bad, search again")
  • Decoupling roles (Planner, Researcher, Writer)

Architecture

User Query
  → Planner Agent (Breaks query into sub-topics)
  → Researcher Agent (Searches web, reads pages)
  → Grader Node (Checks if info is relevant, loops back if not)
  → Writer Agent (Compiles final report with citations)

Steps

  1. Use a framework like LangGraph (recommended for state-machine control) or CrewAI.
  2. Define the State dictionary (e.g., messages, current_plan, gathered_facts).
  3. Build the Planner node: Takes the user request and outputs 3 specific search queries.
  4. Build the Researcher node: Iterates through the queries, uses a Search API tool (Tavily/Serper), and uses a basic Web Scraper tool to pull page text.
  5. Build the Grader node: An LLM call that looks at the scraped text and returns "relevant" or "irrelevant". If irrelevant, it triggers a loop back to the Researcher.
  6. Build the Writer node: Synthesizes all gathered_facts into a markdown report.
  7. Compile the graph and run it on a complex query like "Compare the Q1 2024 earnings reports of Microsoft and Google regarding their AI infrastructure spending."

← Back to the roadmap