Skip to content

Hammad-Ali07/Langgraph-Web-Research-Agent

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Research Agent

An AI-powered research agent that searches the web, analyzes multiple sources, and generates structured research reports using LangGraph.

Enter a research topic and let the agent search the web with Tavily, synthesize the results with GPT-4o-mini, and return a clear report with summaries, key findings, and sources.


✨ Overview

The Web Research Agent automates the research process by combining web search with AI-powered synthesis.

Instead of manually searching multiple websites and organizing information, simply provide a research query and let the agent gather and summarize relevant information.

Research Query → Web Search → Source Collection → AI Synthesis → Research Report

🚀 Key Features

  • 🔍 Web Search Search the web for relevant information using Tavily.

  • 🧠 AI-Powered Research Use GPT-4o-mini to analyze and synthesize search results.

  • 🔗 LangGraph Workflow Organize the research process using a structured agent workflow.

  • 📄 Structured Reports Generate reports with:

    • Summary
    • Key Findings
    • Sources
  • 🎯 Custom Research Queries Research any topic directly from the command line.

  • Simple CLI Interface Start researching with a single command.


🧠 How It Works

flowchart LR
    A[User Research Query] --> B[Search Node]
    B --> C[Tavily Web Search]
    C --> D[Search Results]
    D --> E[Synthesize Node]
    E --> F[GPT-4o-mini]
    F --> G[Structured Research Report]
Loading

Workflow

  1. The user provides a research query.
  2. The Search Node sends the query to Tavily.
  3. Tavily retrieves relevant web results.
  4. The Synthesize Node processes the search results.
  5. GPT-4o-mini analyzes the information.
  6. The agent generates a structured research report.

🛠️ Tech Stack

Technology Purpose
Python Core application language
LangGraph Agent workflow orchestration
GPT-4o-mini Research synthesis
OpenAI Large Language Model provider
Tavily Web search and research retrieval

⚙️ Getting Started

1. Clone the Repository

git clone https://github.com/your-username/your-repository.git
cd your-repository

2. Install Dependencies

pip install -r requirements.txt

3. Configure Environment Variables

Create your environment file:

cp .env.example .env

Add your API keys:

OPENAI_API_KEY=your_openai_api_key
TAVILY_API_KEY=your_tavily_api_key

🔑 API Keys

You will need:

  • OpenAI API Key for AI-powered research synthesis
  • Tavily API Key for web search

Tavily provides a free tier for getting started.


▶️ Usage

Default Research Query

python agent.py

Custom Research Query

python agent.py \
  --query "latest advances in quantum computing"

💬 Example Research Queries

What are the latest advances in AI agents?
What are the current trends in cybersecurity?
What are the latest advances in quantum computing?
Compare LangGraph, CrewAI, and AutoGen.
What are the latest developments in large language models?

📄 Sample Output

🔍 Researching: latest advances in AI agents 2024

============================================================
📄 RESEARCH REPORT
============================================================

## Summary

AI agents have seen significant advances in reasoning,
tool use, and multi-agent collaboration.

## Key Findings

- Agent frameworks are increasingly being used for production workflows.
- LLMs are improving their ability to use external tools.
- Multi-agent systems are becoming more capable of handling complex tasks.

## Sources

- https://example.com
- https://example.com

🏗️ Architecture

User Query
    ↓
Search Node
    ↓
Tavily Web Search
    ↓
Search Results
    ↓
Synthesize Node
    ↓
GPT-4o-mini
    ↓
Structured Research Report

📁 Project Structure

.
├── agent.py
├── requirements.txt
├── .env.example
├── .gitignore
└── README.md

🎯 Use Cases

This project can serve as a foundation for:

  • AI-powered research assistants
  • Market research tools
  • Competitive intelligence systems
  • News and trend analysis
  • Academic research assistants
  • Business intelligence platforms
  • Automated research reporting

🗺️ Roadmap

  • Add a web interface with Streamlit or Next.js
  • Support multi-step research workflows
  • Add source credibility scoring
  • Add citation validation
  • Support PDF and document research
  • Add research history and persistence
  • Implement multi-agent research workflows
  • Add export to Markdown and PDF
  • Add parallel web search across multiple sources

🔐 Security & API Key Safety

Never commit your API keys to GitHub.

Make sure .env is included in .gitignore:

.env

Use environment variables to securely manage your API credentials.


⭐ Support

If you find this project useful, consider giving it a ⭐ on GitHub.

About

AI-powered web research agent built with LangGraph, GPT-4o-mini, and Tavily that searches the web and generates structured research reports with key findings and sources.

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages