Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

AgentX: Multi-Agent Query Routing System

AgentX Logo Python LangChain LLaMA

An intelligent multi-agent AI system that automatically classifies and routes queries to specialized agents

Features • Installation • Usage • Architecture • Demo

Overview

AgentX is a sophisticated multi-agent AI system that intelligently routes user queries to the most appropriate specialized agent. Built with LangChain and powered by LLaMA 3.1, it seamlessly handles diverse query types through three specialized agents:

  • General Knowledge Agent - Handles open-domain questions
  • RAG Agent - Searches internal project documents using vector similarity
  • SQL Agent - Converts natural language to SQL queries

Features

  • Intelligent Query Classification - Automatically determines the best agent for each query
  • Retrieval-Augmented Generation (RAG) - Semantic search through project documents using FAISS
  • Natural Language to SQL - Converts user questions to executable database queries
  • Multi-Agent Orchestration - Seamless coordination between specialized AI components
  • Robust Error Handling - JSON parsing and validation for reliable LLM responses
  • Real-time Processing - Fast query routing and response generation

Tech Stack

Category Technologies
Language Python 3.11+
AI/ML Framework LangChain, Ollama
Language Model LLaMA 3.1 (8B-instruct)
Vector Database FAISS
Embeddings HuggingFace Sentence Transformers
Database SQLite3
Data Processing Pandas, NumPy

Prerequisites

  • macOS (Intel or Apple Silicon)
  • Python 3.11+
  • Ollama installed and running
  • 8GB+ RAM (recommended for LLaMA 3.1 8B model)

Quick Start

1. Clone the Repository

git clone https://github.com/yourusername/agentx.git
cd agentx

2. Run Setup Script (Automated)

chmod +x setup_agentx.sh
./setup_agentx.sh

3. Manual Setup (Alternative)

# Install Ollama
curl -fsSL https://ollama.com/install.sh | sh

# Create virtual environment
python3 -m venv venv
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

# Start Ollama and download model
ollama serve &
ollama pull llama3.1:8b-instruct-q8_0

4. Run AgentX

source venv/bin/activate
python agentx_original.py

Architecture

graph TB
    A[User Query] --> B[Decision Agent]
    B --> C{Query Classification}
    C -->|Type 1| D[General Agent]
    C -->|Type 2| E[RAG Agent]
    C -->|Type 3| F[SQL Agent]
    
    E --> G[FAISS Vector DB]
    E --> H[Project Documents]
    F --> I[SQLite Database]
    F --> J[Employee Records]
    
    D --> K[Response]
    E --> K
    F --> K
Loading

Agent Breakdown

Decision Agent

  • Classifies incoming queries using LLaMA 3.1
  • Routes to appropriate specialized agent
  • Returns structured JSON with reasoning

General Knowledge Agent

  • Handles open-domain questions
  • Uses LLM's built-in knowledge
  • No external data sources required

RAG Agent

  • Searches project document database
  • Uses FAISS for vector similarity search
  • Provides context-aware responses

SQL Agent

  • Converts natural language to SQL
  • Executes queries on employee database
  • Returns formatted results

Sample Queries

Query Type Example Agent Used
General "Why is global warming on the rise?" General Agent
Project "What projects involve robotics?" RAG Agent
Employee "Who has 3+ years of experience?" SQL Agent

Project Structure

agentx/
├── agentx_original.py      # Main application
├── input/
│   └── Projects.txt        # Project documents
├── setup_agentx.sh         # Setup script
├── requirements.txt        # Dependencies
└── README.md              # This file

Configuration

Environment Variables

# Model configuration
MODEL_NAME=llama3.1:8b-instruct-q8_0
TEMPERATURE=0
MAX_TOKENS=2048

Adding Custom Data

  1. Projects: Add to input/Projects.txt separated by ##########
  2. Employee Data: Modify the employees list in the script
  3. Embeddings: Customize the HuggingFace model in the code

Demo

Expected Output

Processing Query: Have we undertaken any projects related to robotics?
Query Type: 2
Reasoning: This query pertains to a specific project...
Searching Company's Internal Project Database

Response: Yes, we have undertaken Project Gamma - Autonomous Robotics Platform...

Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Acknowledgments

  • Meta AI for the LLaMA model
  • LangChain for the excellent framework
  • HuggingFace for sentence transformers
  • Facebook Research for FAISS

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages