Skip to content

AmritaPanjwani/LangGraph-Multi-Agent-System-for-Intent-Based-LLM-Routing-Emotional-vs-Logical-AI-Agents-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🧠 LangGraph Multi-Agent System for Intent-Based LLM Routing

LangGraph Python LLM Multi-Agent License

A LangGraph-powered multi-agent AI system that intelligently classifies user intent and dynamically routes conversations to specialized LLM agents (emotional vs logical) using a state-machine-based agentic architecture.

This project demonstrates how to move beyond a single “chatbot” and design clear, explainable, role-based AI agents coordinated through LangGraph.


✨ Key Features

  • 🧩 Multi-Agent Architecture (not a single LLM chatbot)
  • 🧠 Intent Classification using Structured LLM Output
  • 🔀 Dynamic Routing with LangGraph
  • 💬 Specialized Agents
    • Therapist Agent → emotional support & empathy
    • Logical Agent → factual, analytical responses
  • 🔁 Shared Conversational State
  • 🧪 Fully local LLM execution via Ollama
  • 📦 Clean, extensible, production-style design

🏗️ Architecture Overview

LangGraph-based AI Agent Architecture


Why this is a Multi-Agent System

This system consists of multiple autonomous agents, each with:

  • A clear role
  • A specific goal
  • Independent reasoning
  • Access to a shared state
Component Role
Classifier Agent Determines user intent
Router Agent Controls execution flow
Therapist Agent Emotional & empathetic responses
Logical Agent Analytical & factual responses

Even though agents share the same LLM backend, they are logically independent agents, which qualifies this as a multi-agent system.


🛠️ Tech Stack

  • Python 3.9+
  • LangGraph – state machine & agent orchestration
  • LangChain – LLM abstraction
  • Ollama – local LLM inference
  • LLaMA 3 – base language model
  • Pydantic – structured LLM outputs
  • TypedDict & Annotated – typed shared state


🚀 Getting Started

1️⃣ Prerequisites

python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt

Run the chatbot

python main.py

🔍 Why LangGraph?

LangGraph enables:

  • Deterministic agent routing
  • Explicit state management
  • Visualizable execution paths
  • Clean separation of concerns
  • Easy extension to more agents, loops, or tools

This makes LangGraph ideal for building agentic LLM systems, not just simple chatbots.


🔮 Possible Extensions

  • Critic / Reviewer Agent
  • 🧠 Memory Summarization Agent
  • 🔁 Self-reflection or retry loops
  • 🔧 Tool-using agents (search, calculator, RAG)
  • 🤝 Parallel or debating agents

📌 Who Is This For?

  • Data Scientists exploring agentic AI
  • Engineers learning LangGraph
  • Developers moving beyond basic chatbots
  • Anyone building explainable LLM systems

📜 License

This project is licensed under the MIT License.
Feel free to use, modify, and build on it.

About

An agentic LLM system using LangGraph to classify user intent and route conversations to emotional or logical AI agents. Built with local LLMs (Ollama) to demonstrate clean, explainable multi-agent architectures.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages