Skip to content

LangGraph-powered AI agent with autonomous web search and data retrieval capabilities. Multi-step reasoning system for intelligent information gathering.

Notifications You must be signed in to change notification settings

YehuditSabag/AgetsLangGraph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

LangGraph Intelligent Web Research Agent

An autonomous AI agent built with LangGraph that performs intelligent web research and data retrieval through a multi-step reasoning system.

Overview

This project demonstrates a graph-based AI agent capable of autonomous decision-making and tool usage. The agent operates through interconnected functional nodes that enable sophisticated web research workflows.

Features

  • Intelligent Web Search: Conducts contextual Google searches using SerpAPI to discover relevant resources
  • Dynamic Data Retrieval: Fetches and processes live content from discovered URLs via HTTP GET requests
  • Multi-Step Reasoning: Implements a state graph architecture for complex decision-making
  • Tool Integration: Seamlessly switches between search and fetch operations based on query requirements
  • Interactive Interface: Command-line interface for natural conversation with the agent

Architecture

The agent uses LangGraph's StateGraph to orchestrate three main nodes:

  1. LLM Node: Processes user queries and decides which tools to use
  2. Tools Node: Executes selected tools (web search or URL fetching)
  3. LLM Explain Node: Synthesizes results into human-readable responses

Prerequisites

  • Python 3.8+
  • OpenAI API key
  • SerpAPI key

Installation

  1. Clone the repository:
git clone https://github.com/yourusername/langgraph-agent.git cd langgraph-agent
  1. Install required packages:
pip install langgraph langchain langchain-openai langchain-community google-search-results requests python-dotenv
  1. Create a .env file in the project root:
OPENAI_API_KEY=your_openai_api_key_here SERPAPI_API_KEY=your_serpapi_key_here

Usage

Run the agent:

python agent.py

The agent will prompt you to enter queries. Examples:

Type your query and press Enter. The agent will autonomously decide whether to search the web or fetch URL content based on your request.

Project Structure

langgraph-agent/ ├── agent.py # Main agent implementation ├── .env # Environment variables (not tracked in git) ├── .gitignore # Git ignore file └── README.md # This file 

How It Works

  1. User enters a query through the command-line interface
  2. The LLM analyzes the query and selects appropriate tools
  3. Tools execute (web search or URL fetch)
  4. Results are processed and synthesized by the LLM
  5. Final response is presented to the user
  6. Conversation context is maintained for follow-up queries

Tools Available

  • search_tool2: Performs Google searches using SerpAPI to find relevant information
  • fetch_url_content: Sends HTTP GET requests to retrieve content from URLs

Security Note

Never commit your .env file or expose API keys in your code. This project uses environment variables to keep credentials secure.

Technologies Used

  • LangGraph: Graph-based agent orchestration
  • LangChain: LLM integration and tool management
  • OpenAI GPT-3.5: Language model for reasoning and response generation
  • SerpAPI: Web search capabilities
  • Python Requests: HTTP client for data retrieval

License

MIT License

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Acknowledgments

Built as a demonstration of autonomous agent capabilities using LangGraph's state management and tool integration features.

About

LangGraph-powered AI agent with autonomous web search and data retrieval capabilities. Multi-step reasoning system for intelligent information gathering.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages