Skip to content

acascell/lang-chain-router-pattern

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LangGraph Router Agent

A semi-autonomous agent using the Router Pattern in LangGraph.

The graph routes user queries to one of two specialist agents:

  • RAG Agent — answers questions grounded in your vector store
  • Web Search Agent — answers questions requiring fresh / real-time information via Tavily
User Query
    │
    ▼
[Router Node]  ──── "rag"    ──►  [RAG Agent Node]        ──►  [Output]
                └── "web"    ──►  [Web Search Agent Node]  ──►  [Output]

Setup

Prerequisites

  • Ollama installed and running with qwen2.5 model
  • Tavily API Key (for web search functionality)

Install & Configure

  1. Install Ollama: Download from ollama.ai

  2. Pull Qwen2.5 model:

    ollama pull qwen2.5
  3. Start Ollama server (if not already running):

    ollama serve

    This will start at http://localhost:11434 by default.

  4. Set up the project:

    cd /path/to/langgraph-router-agent
    cp .env.example .env          # Edit .env and add your TAVILY_API_KEY
  5. Install dependencies using uv:

    uv sync

Run

uv run python -m src.main

Or use the script entry point:

uv run langgraph-router

Project Layout

src/
  config/       – env & model settings
  graph/        – LangGraph state, nodes, edges, compiled graph
  agents/       – RAG agent & Web Search agent logic
  tools/        – Tavily tool wrapper, RAG retriever wrapper
  utils/        – shared helpers (logging, prompt builders)
tests/          – pytest test suite

About

Use router pattern to spin agents based on query request

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages