Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agent - LangGraph Agentic AI Framework

A sophisticated agentic AI system built with LangGraph that demonstrates advanced multi-agent coordination, web search integration, and real-time information retrieval.

Overview

This project implements an intelligent agent framework that can:

  • Process complex queries using agentic workflows
  • Perform web searches using Tavily Search API for real-time information
  • Handle multi-step reasoning and decision-making
  • Manage state across distributed agents
  • Serve web-based frontend interface

Features

  • LangGraph State Management: Robust state handling with TypedDict for type safety
  • Web Search Integration: Tavily Search API integration for fetching current information
  • HuggingFace LLM: Support for HuggingFace models and endpoints
  • Multi-Agent Architecture: Distributed task execution with agent coordination
  • Freshness Detection: Built-in logic to detect freshness-related queries
  • Full-Stack Application: Python backend + Next.js frontend

Project Structure

agent/
├── basic.py              # Core agent logic and workflows
├── server.py             # Backend server implementation
├── frontend/             # Next.js frontend application
│   ├── src/
│   ├── public/
│   └── package.json
├── blog_posts/           # Research and documentation
├── requirements.txt      # Python dependencies
└── .env                  # Environment variables

Getting Started

Prerequisites

  • Python 3.10+
  • Node.js 18+
  • Tavily API Key
  • HuggingFace API Token

Installation

# Install Python dependencies
pip install -r requirements.txt

# Install frontend dependencies
cd frontend
npm install
cd ..

Configuration

Create a .env file in the parent directory with:

TAVILY_API_KEY=your_tavily_key
HUGGINGFACEHUB_API_TOKEN=your_hf_token

Running the Application

# Start backend server
python server.py

# In another terminal, start frontend (from frontend directory)
npm run dev

Key Components

basic.py

  • State Management: Defines agent state with message history and routing logic
  • Agent Chain: Creates multi-step workflows using LangGraph StateGraph
  • Search Integration: Handles web searches for freshness-related queries
  • Output Parsing: Uses Pydantic for structured output validation

frontend/

Next.js-based web interface for interacting with the agent system, featuring:

  • Real-time chat interface
  • Response streaming
  • Type-safe configuration with TypeScript

Technologies

  • LangGraph: Agent orchestration and state management
  • LangChain: LLM integration and prompt management
  • HuggingFace: LLM models and embeddings
  • Tavily: Web search API
  • Next.js: Frontend framework
  • FastAPI/Starlette: Backend server

Environment Variables

  • TAVILY_API_KEY: API key for Tavily web search
  • HUGGINGFACEHUB_API_TOKEN: HuggingFace authentication token
  • HF_LLM_MODEL: HuggingFace model to use (default: meta-llama/Llama-2-7b-chat)

Usage Examples

The agent can handle various query types:

from basic import create_agent_graph

# Create agent graph
graph = create_agent_graph()

# Run agent with a query
response = graph.invoke({
    "messages": [HumanMessage("What are the latest trends in AI?")],
    "routing": "research"
})

License

MIT

Contributing

Contributions welcome! Please submit pull requests with clear descriptions of changes.

About

Agent scaffolding and orchestration experiments.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages