Skip to content

About

This is a project related to building an AI research agent using LangGraph, LangChain, and Tavily

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Research Agent

This is an autonomous AI Research Agent built using LangGraph, LangChain, and Tavily. The agent starts with a broad topic, devises specific sub-questions, autonomously searches the web for answers, evaluates if its findings are sufficient (looping for more context if not), and finally compiles a comprehensive Markdown report.

🏗️ Architecture

The cyclical agent logic is powered by LangGraph. Below is a high-level representation of the state machine:

graph TD
    Start((Start)) --> generate_questions[Generate Questions]
    generate_questions --> conduct_research[Conduct Research]
    conduct_research --> evaluate_research{Evaluate Findings}
    
    evaluate_research -- "NEEDS_MORE_RESEARCH" --> conduct_research
    evaluate_research -- "SUFFICIENT" --> compile_report[Compile Report]
    
    compile_report --> End((End))
    
    classDef default fill:#e3f2fd,stroke:#1565c0,stroke-width:2px,color:#000;
    classDef decision fill:#fff3e0,stroke:#ef6c00,stroke-width:2px,color:#000;
    
    class generate_questions,conduct_research,compile_report default;
    class evaluate_research decision;
Loading

🚀 Getting Started

Follow these steps to set up and run the Research Agent on a new machine.

1. Requirements

Ensure you have Python 3.10+ installed on your system.

2. Set Up the Environment

Open a terminal, navigate into the research_agent/ directory, and initialize a virtual environment:

python3 -m venv venv

Activate the virtual environment:

# On macOS / Linux:
source venv/bin/activate  

# On Windows:
venv\Scripts\activate

3. Install Dependencies

Install all required modules such as LangGraph and Tavily via pip:

pip install -r requirements.txt

4. Configure API Keys

The application requires credentials to work properly. Create a new .env file in the root of the research_agent/ folder:

touch .env

Open the .env file and insert the following keys using your own credentials:

TAVILY_API_KEY="your_tavily_api_key_here"
OPENAI_API_KEY="your_openai_api_key_here"

(You can get a Tavily key from tavily.com and an OpenAI key from platform.openai.com)

5. Run the Agent

Run the main script to orchestrate the nodes and begin researching! You can edit the initial_state target topic found in main.py to change the research question.

python3 main.py

The resulting findings will be autonomously compiled and saved to research_report.md.

About

This is a project related to building an AI research agent using LangGraph, LangChain, and Tavily

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages