Back to Projects

Research Assistant

A multi-agent system that performs automated research and generates comprehensive responses using LangGraph and Gemini models.

Overview

A multi-agent system that performs automated research and generates comprehensive responses. A research agent searches and analyzes sources, an answer drafter turns those findings into a cited response, and a LangGraph workflow coordinates the two.

Features

  • Research agent that gathers information using the Tavily search API
  • Search results analyzed with the Gemini model, returning structured research findings
  • Answer drafter agent that takes the research findings and synthesizes them into clear responses
  • Citations to sources included in every drafted response
  • Responses can be refined based on feedback
  • LangGraph workflow orchestration coordinating the research and drafting agents
  • Workflow state transitions maintained across the graph
  • The graph is compiled and executed asynchronously
  • Pydantic models validate the workflow state
  • WorkflowState tracks the topic, research results, draft results and next state
  • CLI interface — enter a research topic when prompted

Architecture

  • Research Agent — uses the Tavily search API to gather information, analyzes the search results using the Gemini model, and returns structured research findings.
  • Answer Drafter Agent — takes the research findings as input, synthesizes them into clear responses, includes citations to sources, and can refine responses based on feedback.
  • Workflow Orchestration — uses LangGraph for state management, coordinates the research and drafting agents, maintains workflow state transitions, and compiles and executes the graph asynchronously.

Implementation details

  • State management — Pydantic models validate state; WorkflowState tracks the topic, research results, draft results and next state.
  • Graph flow — the entry point is the "research" node, where the research agent performs search and analysis; results pass to the "draft" node, where the answer drafter generates the final response, and the graph completes with the final state.
  • Async execution — uses LangGraph's ainvoke pattern with a proper async/await flow throughout, with state transitions handled by graph compilation.

Key files

  • main.py — entry point and CLI interface
  • graph/workflow.py — LangGraph workflow implementation
  • agents/research_agent.py — research agent implementation
  • agents/answer_drafter.py — answer drafting agent implementation
  • utils/tavily_tool.py — search API integration

Configuration

  • GOOGLE_API_KEY — for Gemini model access
  • TAVILY_API_KEY — for search functionality

Setup & usage

  • Install dependencies: pip install -r requirements.txt
  • Set up the environment variables in a .env file.
  • Run the assistant: python main.py
  • Enter your research topic when prompted.
  • The system performs research using Tavily, analyzes the findings with Gemini, generates a comprehensive response, and provides source citations.

Model configuration

Uses the Gemini 1.5 Flash model for research analysis, response drafting, and content refinement.

Tech stack

PythonLangGraphGoogle Gemini 1.5 FlashTavily Search APIPydanticasyncio

Tagged

LangGraphGeminiPythonMulti-Agent
Get in touch