← Back to Projects
Multi-Agent Researcher
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
- Use a framework like
LangGraph(recommended for state-machine control) orCrewAI. - Define the State dictionary (e.g.,
messages,current_plan,gathered_facts). - Build the Planner node: Takes the user request and outputs 3 specific search queries.
- 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.
- 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.
- Build the Writer node: Synthesizes all
gathered_factsinto a markdown report. - 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."