Skip to content

Latest commit

ย 

History

25 Commits

Folders and files

NameName
Last commit message
Last commit date
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿค– Agentic AI Chatbot with LangGraph

A Production-Ready Multi-Agent AI System Built with LangGraph & LangChain

Python LangGraph Streamlit License: MIT GitHub

Agentic AI Chatbot Interface

An enterprise-grade, stateful AI agent system demonstrating advanced LangGraph workflows with tool integration, real-time web search, and automated AI news aggregation.

๐Ÿš€ Quick Start โ€ข ๐Ÿ“– Documentation โ€ข ๐ŸŽฏ Features โ€ข ๐Ÿ“Š Demo


๐Ÿ“‹ Table of Contents


๐ŸŽฏ Problem Statement

The Challenge in Modern AI Applications

In today's rapidly evolving AI landscape, organizations face critical challenges when building conversational AI systems:

Problem Impact
Stateless Conversations Traditional chatbots lose context between interactions, leading to fragmented user experiences
Limited Tool Integration Most AI systems cannot dynamically interact with external APIs and real-time data sources
Monolithic Architecture Single-purpose bots lack flexibility and are difficult to scale or modify
Information Overload Keeping up with AI industry developments requires constant manual effort
Production Readiness Transitioning from prototype to production-grade systems is complex

Real-World Scenarios

โŒ Customer asks follow-up question โ†’ Bot has no memory of previous context
โŒ User needs real-time information โ†’ Bot provides outdated static responses  
โŒ Business wants new feature โ†’ Entire system needs rebuilding
โŒ Team needs AI news digest โ†’ Manual curation takes hours daily

๐Ÿ’ก Solution Approach

Introducing Stateful Agentic AI with LangGraph

This project implements a graph-based, stateful AI agent architecture using LangGraph that addresses all the above challenges through:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                    ๐ŸŽฏ AGENTIC AI SOLUTION FRAMEWORK                      โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                         โ”‚
โ”‚   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚
โ”‚   โ”‚   STATE     โ”‚    โ”‚   GRAPH     โ”‚    โ”‚   TOOLS                 โ”‚    โ”‚
โ”‚   โ”‚  MANAGEMENT โ”‚โ”€โ”€โ”€โ–ถโ”‚   BUILDER   โ”‚โ”€โ”€โ”€โ–ถโ”‚   INTEGRATION           โ”‚    โ”‚
โ”‚   โ”‚             โ”‚    โ”‚             โ”‚    โ”‚                         โ”‚    โ”‚
โ”‚   โ”‚ โ€ข Messages  โ”‚    โ”‚ โ€ข Nodes     โ”‚    โ”‚ โ€ข Tavily Search         โ”‚    โ”‚
โ”‚   โ”‚ โ€ข Context   โ”‚    โ”‚ โ€ข Edges     โ”‚    โ”‚ โ€ข Web Scraping          โ”‚    โ”‚
โ”‚   โ”‚ โ€ข History   โ”‚    โ”‚ โ€ข Conditionsโ”‚    โ”‚ โ€ข News Aggregation      โ”‚    โ”‚
โ”‚   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚
โ”‚          โ”‚                  โ”‚                       โ”‚                   โ”‚
โ”‚          โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                   โ”‚
โ”‚                             โ–ผ                                           โ”‚
โ”‚                   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”                                   โ”‚
โ”‚                   โ”‚  UNIFIED OUTPUT โ”‚                                   โ”‚
โ”‚                   โ”‚   โ€ข Chat UI     โ”‚                                   โ”‚
โ”‚                   โ”‚   โ€ข Markdown    โ”‚                                   โ”‚
โ”‚                   โ”‚   โ€ข Reports     โ”‚                                   โ”‚
โ”‚                   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜                                   โ”‚
โ”‚                                                                         โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Core Design Principles

Principle Implementation
๐Ÿ”„ Stateful Conversations LangGraph's StateGraph with message accumulation using add_messages reducer
๐Ÿ”ง Modular Architecture Plug-and-play nodes enabling easy feature additions
๐ŸŒ Real-time Data Access Tavily API integration for live web search capabilities
๐Ÿ“Š Automated Intelligence Self-running news aggregation with LLM-powered summarization
๐ŸŽจ User-Centric Design Streamlit-based intuitive interface with configuration-driven customization

๐Ÿ—๏ธ Architecture & System Design

High-Level Architecture

                                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                                    โ”‚           STREAMLIT UI              โ”‚
                                    โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚
                                    โ”‚  โ”‚  โ€ข LLM Selection            โ”‚   โ”‚
                                    โ”‚  โ”‚  โ€ข Use Case Selection       โ”‚   โ”‚
                                    โ”‚  โ”‚  โ€ข API Key Management       โ”‚   โ”‚
                                    โ”‚  โ”‚  โ€ข Chat Interface           โ”‚   โ”‚
                                    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚
                                    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                   โ”‚
                                                   โ–ผ
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                                   MAIN ORCHESTRATOR                                   โ”‚
โ”‚                                      (main.py)                                        โ”‚
โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
โ”‚  โ”‚   UI Loader    โ”‚โ”€โ”€โ”€โ–ถโ”‚   LLM Config   โ”‚โ”€โ”€โ”€โ–ถโ”‚          Graph Builder             โ”‚  โ”‚
โ”‚  โ”‚                โ”‚    โ”‚   (Groq)       โ”‚    โ”‚                                    โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Load Config  โ”‚    โ”‚                โ”‚    โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”   โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Get Inputs   โ”‚    โ”‚ โ€ข API Key      โ”‚    โ”‚  โ”‚     USE CASE ROUTER        โ”‚   โ”‚  โ”‚
โ”‚  โ”‚ โ€ข Validate     โ”‚    โ”‚ โ€ข Model Select โ”‚    โ”‚  โ”‚                            โ”‚   โ”‚  โ”‚
โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ” โ”Œโ”€โ”€โ”€โ”€โ” โ”‚   โ”‚  โ”‚
โ”‚                                              โ”‚  โ”‚  โ”‚Basic โ”‚ โ”‚Tool  โ”‚ โ”‚Newsโ”‚ โ”‚   โ”‚  โ”‚
โ”‚                                              โ”‚  โ”‚  โ”‚Chat  โ”‚ โ”‚Chat  โ”‚ โ”‚Bot โ”‚ โ”‚   โ”‚  โ”‚
โ”‚                                              โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ””โ”€โ”€โ”€โ”€โ”˜ โ”‚   โ”‚  โ”‚
โ”‚                                              โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜   โ”‚  โ”‚
โ”‚                                              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                   โ”‚
                    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
                    โ”‚                              โ”‚                              โ”‚
                    โ–ผ                              โ–ผ                              โ–ผ
    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
    โ”‚     BASIC CHATBOT         โ”‚  โ”‚   CHATBOT WITH TOOLS      โ”‚  โ”‚      AI NEWS AGENT        โ”‚
    โ”‚                           โ”‚  โ”‚                           โ”‚  โ”‚                           โ”‚
    โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”  โ”‚
    โ”‚  โ”‚       START         โ”‚  โ”‚  โ”‚  โ”‚       START         โ”‚  โ”‚  โ”‚  โ”‚    FETCH NEWS       โ”‚  โ”‚
    โ”‚  โ”‚         โ”‚           โ”‚  โ”‚  โ”‚  โ”‚         โ”‚           โ”‚  โ”‚  โ”‚  โ”‚    (Tavily API)     โ”‚  โ”‚
    โ”‚  โ”‚         โ–ผ           โ”‚  โ”‚  โ”‚  โ”‚         โ–ผ           โ”‚  โ”‚  โ”‚  โ”‚         โ”‚           โ”‚  โ”‚
    โ”‚  โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”‚  โ”‚  โ”‚  โ”‚    โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”      โ”‚  โ”‚  โ”‚  โ”‚         โ–ผ           โ”‚  โ”‚
    โ”‚  โ”‚    โ”‚ CHATBOT โ”‚      โ”‚  โ”‚  โ”‚  โ”‚    โ”‚ CHATBOT โ”‚โ—€โ”€โ”   โ”‚  โ”‚  โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚  โ”‚
    โ”‚  โ”‚    โ”‚  NODE   โ”‚      โ”‚  โ”‚  โ”‚  โ”‚    โ”‚  NODE   โ”‚  โ”‚   โ”‚  โ”‚  โ”‚  โ”‚  โ”‚  SUMMARIZE  โ”‚    โ”‚  โ”‚
    โ”‚  โ”‚    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜      โ”‚  โ”‚  โ”‚  โ”‚    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜  โ”‚   โ”‚  โ”‚  โ”‚  โ”‚  โ”‚    (LLM)    โ”‚    โ”‚  โ”‚
    โ”‚  โ”‚         โ”‚           โ”‚  โ”‚  โ”‚  โ”‚         โ”‚       โ”‚   โ”‚  โ”‚  โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚  โ”‚
    โ”‚  โ”‚         โ–ผ           โ”‚  โ”‚  โ”‚  โ”‚    โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”  โ”‚   โ”‚  โ”‚  โ”‚  โ”‚         โ”‚           โ”‚  โ”‚
    โ”‚  โ”‚       END           โ”‚  โ”‚  โ”‚  โ”‚    โ”‚ TOOLS   โ”‚โ”€โ”€โ”˜   โ”‚  โ”‚  โ”‚  โ”‚         โ–ผ           โ”‚  โ”‚
    โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚  โ”‚  โ”‚    โ”‚ NODE    โ”‚      โ”‚  โ”‚  โ”‚  โ”‚  โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”    โ”‚  โ”‚
    โ”‚                           โ”‚  โ”‚  โ”‚    โ””โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”˜      โ”‚  โ”‚  โ”‚  โ”‚  โ”‚ SAVE RESULT โ”‚    โ”‚  โ”‚
    โ”‚  Flow: Simple LLM call    โ”‚  โ”‚  โ”‚         โ”‚           โ”‚  โ”‚  โ”‚  โ”‚  โ”‚ (Markdown)  โ”‚    โ”‚  โ”‚
    โ”‚                           โ”‚  โ”‚  โ”‚         โ–ผ           โ”‚  โ”‚  โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ”‚  โ”‚
    โ”‚                           โ”‚  โ”‚  โ”‚       END           โ”‚  โ”‚  โ”‚  โ”‚         โ”‚           โ”‚  โ”‚
    โ”‚                           โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚  โ”‚  โ”‚         โ–ผ           โ”‚  โ”‚
    โ”‚                           โ”‚  โ”‚                           โ”‚  โ”‚  โ”‚       END           โ”‚  โ”‚
    โ”‚                           โ”‚  โ”‚  Flow: Conditional loop   โ”‚  โ”‚  โ”‚                     โ”‚  โ”‚
    โ”‚                           โ”‚  โ”‚  with tool execution      โ”‚  โ”‚  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚
    โ”‚                           โ”‚  โ”‚                           โ”‚  โ”‚                           โ”‚
    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜  โ”‚  Flow: Sequential        โ”‚
                                                                  โ”‚  pipeline processing      โ”‚
                                                                  โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

State Management Flow

# Centralized State Definition using TypedDict
class State(TypedDict):
    messages: Annotated[list, add_messages]  # Auto-accumulating message history
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚                        STATE LIFECYCLE                              โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚                                                                    โ”‚
โ”‚   User Input โ”€โ”€โ–ถ State[messages] โ”€โ”€โ–ถ Node Processing โ”€โ”€โ–ถ Update   โ”‚
โ”‚        โ”‚              โ”‚                     โ”‚               โ”‚      โ”‚
โ”‚        โ”‚              โ”‚                     โ”‚               โ”‚      โ”‚
โ”‚        โ”‚         โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”           โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ”    โ”Œโ”€โ”€โ”€โ”€โ–ผโ”€โ”€โ”€โ”€โ” โ”‚
โ”‚        โ”‚         โ”‚ Message โ”‚           โ”‚   LLM   โ”‚    โ”‚  New    โ”‚ โ”‚
โ”‚        โ”‚         โ”‚  List   โ”‚           โ”‚Response โ”‚    โ”‚ State   โ”‚ โ”‚
โ”‚        โ”‚         โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜           โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜    โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜ โ”‚
โ”‚        โ”‚                                                    โ”‚      โ”‚
โ”‚        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜      โ”‚
โ”‚                          Feedback Loop                             โ”‚
โ”‚                                                                    โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โœจ Key Features

๐Ÿค– Basic Chatbot

  • Direct LLM conversation
  • Context-aware responses
  • Streaming message support
  • Multiple model selection

๐Ÿ”ง Chatbot with Tools

  • Real-time web search via Tavily
  • Dynamic tool invocation
  • Conditional graph routing
  • Tool response integration

๐Ÿ“ฐ AI News Aggregator

  • Automated news fetching (Daily/Weekly/Monthly)
  • LLM-powered summarization
  • Markdown report generation
  • Chronological sorting

๐ŸŽ›๏ธ Configuration System

  • INI-based configuration
  • Multiple LLM support
  • Dynamic UI generation
  • Easy extensibility

Feature Highlights

โœ… Stateful Conversations     - Messages persist across interactions
โœ… Tool Integration           - Seamless external API integration  
โœ… Multi-Model Support        - Groq (Llama 3.3, Qwen, GPT-oss)
โœ… Real-time Search           - Live web data via Tavily
โœ… Automated Reports          - Self-generating news summaries
โœ… Modular Design             - Easy to extend and modify
โœ… Production Ready           - Error handling & validation
โœ… Clean UI                   - Intuitive Streamlit interface

๐Ÿ› ๏ธ Tech Stack

Category Technologies
Framework LangGraph LangChain
LLM Provider Groq
Frontend Streamlit
Search API Tavily
Language Python

Dependencies

langchain          # Core LLM orchestration
langgraph          # Stateful graph workflows
langchain-groq     # Groq LLM integration
streamlit          # Web UI framework
tavily-python      # Web search API
python-dotenv      # Environment management
faiss-cpu          # Vector similarity search
sentence-transformers  # Text embeddings

๐Ÿ“ Project Structure

Agentic-Chatbot/
โ”‚
โ”œโ”€โ”€ ๐Ÿ“„ app.py                          # Application entry point
โ”œโ”€โ”€ ๐Ÿ“„ requirements.txt                # Python dependencies
โ”œโ”€โ”€ ๐Ÿ“„ README.md                       # Project documentation
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ AINews/                         # Generated news summaries
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ฐ daily_summary.md            # Daily AI news digest
โ”‚   โ”œโ”€โ”€ ๐Ÿ“ฐ weekly_summary.md           # Weekly AI news digest
โ”‚   โ””โ”€โ”€ ๐Ÿ“ฐ monthly_summary.md          # Monthly AI news digest
โ”‚
โ”œโ”€โ”€ ๐Ÿ“ assets/                         # UI screenshots & images
โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ UI.png                      # Main interface screenshot
โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ basic_chatbot_output.png    # Basic chatbot demo
โ”‚   โ”œโ”€โ”€ ๐Ÿ–ผ๏ธ chatbot_with_tool_output.png # Tool integration demo
โ”‚   โ””โ”€โ”€ ๐Ÿ–ผ๏ธ ai_news_daily_output.png    # News aggregator demo
โ”‚
โ””โ”€โ”€ ๐Ÿ“ src/
    โ””โ”€โ”€ ๐Ÿ“ LangGraphAgenticAI/
        โ”œโ”€โ”€ ๐Ÿ“„ __init__.py
        โ”œโ”€โ”€ ๐Ÿ“„ main.py                 # Main orchestrator
        โ”‚
        โ”œโ”€โ”€ ๐Ÿ“ graph/
        โ”‚   โ””โ”€โ”€ ๐Ÿ“„ graph_builder.py    # LangGraph workflow builder
        โ”‚
        โ”œโ”€โ”€ ๐Ÿ“ LLMS/
        โ”‚   โ””โ”€โ”€ ๐Ÿ“„ groq_llm.py         # Groq LLM configuration
        โ”‚
        โ”œโ”€โ”€ ๐Ÿ“ nodes/
        โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ basic_chatbot_node.py      # Simple chat node
        โ”‚   โ”œโ”€โ”€ ๐Ÿ“„ chatbot_with_tool_node.py  # Tool-enabled chat node
        โ”‚   โ””โ”€โ”€ ๐Ÿ“„ ai_news_node.py            # News processing nodes
        โ”‚
        โ”œโ”€โ”€ ๐Ÿ“ state/
        โ”‚   โ””โ”€โ”€ ๐Ÿ“„ state.py            # State definition (TypedDict)
        โ”‚
        โ”œโ”€โ”€ ๐Ÿ“ tools/
        โ”‚   โ””โ”€โ”€ ๐Ÿ“„ search_tool.py      # Tavily search integration
        โ”‚
        โ””โ”€โ”€ ๐Ÿ“ ui/
            โ”œโ”€โ”€ ๐Ÿ“„ uiconfigfile.ini    # UI configuration
            โ”œโ”€โ”€ ๐Ÿ“„ uiconfigfile.py     # Config parser
            โ””โ”€โ”€ ๐Ÿ“ streamlitui/
                โ”œโ”€โ”€ ๐Ÿ“„ load_ui.py      # Streamlit UI builder
                โ””โ”€โ”€ ๐Ÿ“„ display_results.py  # Output renderer

๐Ÿš€ Quick Start

Prerequisites

Installation

# Clone the repository
git clone https://github.com/BrijeshRakhasiya/Agentic-Chatbot.git
cd Agentic-Chatbot

# Create virtual environment
python -m venv venv

# Activate virtual environment
# Windows
venv\Scripts\activate
# macOS/Linux
source venv/bin/activate

# Install dependencies
pip install -r requirements.txt

Running the Application

# Start the Streamlit app
streamlit run app.py

Configuration

  1. Open the application in your browser (default: http://localhost:8501)
  2. Enter your Groq API Key in the sidebar
  3. Select your preferred LLM Model
  4. Choose a Use Case
  5. For tool-based features, enter your Tavily API Key
  6. Start chatting!

๐Ÿ“Š Live Demo & Screenshots

Main Interface

Main UI

Streamlit-based user interface with sidebar configuration

Basic Chatbot Output

Basic Chatbot

Simple conversational AI with context retention

Chatbot with Tool Integration

Chatbot with Tools

Real-time web search integration using Tavily API

AI News Aggregator

AI News Output

Automated AI news fetching and summarization


๐Ÿ”„ Use Cases Deep Dive

1๏ธโƒฃ Basic Chatbot

Graph Flow:

START โ”€โ”€โ–ถ chatbot_node โ”€โ”€โ–ถ END

Implementation:

class BasicChatbotNode:
    def process(self, state: State) -> dict:
        return {"messages": self.llm.invoke(state['messages'])}

Key Points:

  • Direct LLM invocation
  • State-based message history
  • Simple request-response pattern

2๏ธโƒฃ Chatbot with Tools

Graph Flow:

START โ”€โ”€โ–ถ chatbot_node โ—€โ”€โ”€โ–ถ tools_node โ”€โ”€โ–ถ END
              โ”‚                  โ–ฒ
              โ”‚    (conditional) โ”‚
              โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Implementation:

def chatbot_with_tools_build_graph(self):
    tools = get_tools()
    tool_node = create_tool_node(tools)
    
    llm_with_tools = self.llm.bind_tools(tools)
    
    self.graph_builder.add_node("chatbot", chatbot_node)
    self.graph_builder.add_node("tools", tool_node)
    self.graph_builder.add_conditional_edges("chatbot", tools_condition)

Key Points:

  • Uses tools_condition for dynamic routing
  • Tavily search for real-time web data
  • Automatic tool invocation based on LLM decision

3๏ธโƒฃ AI News Aggregator

Graph Flow:

fetch_news โ”€โ”€โ–ถ summarize_news โ”€โ”€โ–ถ save_result โ”€โ”€โ–ถ END

Pipeline Steps:

Step Function Description
1 fetch_news() Query Tavily API for AI news
2 summarize_news() LLM summarization with custom prompt
3 save_result() Generate markdown file output

Key Points:

  • Supports daily, weekly, monthly timeframes
  • Chronological sorting (latest first)
  • Automatic markdown report generation

๐Ÿ“ˆ AI News Sample Outputs

The system automatically generates news summaries stored in the AINews/ folder:

๐Ÿ“… Daily Summary Sample

# Daily AI News Summary

### 2025-12-29  
- **22:08 IST** โ€“ FedEx launches an AI education program for its 
  global workforce, teaching employees responsible AI use.
  [Source](https://www.investing.com/news/...)

- **20:45 IST** โ€“ Israeli PM Netanyahu discussed AI and smart 
  transportation with Elon Musk.
  [Source](https://www.ynetnews.com/...)

- **12:36 IST** โ€“ China drafts world's first rules restricting 
  AI chatbots from influencing emotions.
  [Source](https://www.cnbc.com/...)

๐Ÿ“Š Weekly Summary Sample

# Weekly AI News Summary

### 2025-12-26  
- **Washington Post** โ€“ Amazon, Microsoft and Google pledged 
  $67.5 billion to India for data-centers and AI.
  [Source](https://www.washingtonpost.com/...)

### 2025-12-25  
- **Nvidia & Groq** โ€“ Nvidia signs licensing deal with AI-chip 
  startup Groq and hires its leadership.
  [Source](https://www.nytimes.com/...)

๐Ÿ“† Monthly Summary Sample

# Monthly AI News Summary

### 2025-12-11  
- **$50 bn AI push in India** โ€“ Amazon and Microsoft pledge 
  more than $50 bn for AI infrastructure in India.
  [Source](https://www.bbc.com/...)

### 2025-12-16  
- **Google AI Centers** โ€“ Google.org pledges $8 million for 
  AI hubs in health, agriculture, education.
  [Source](https://www.lokmattimes.com/...)

๐Ÿ“ Full outputs available in: AINews/daily_summary.md | AINews/weekly_summary.md | AINews/monthly_summary.md


๐Ÿง  Implementation Details

Core Components

1. State Management

from typing import Annotated
from langgraph.graph.message import add_messages

class State(TypedDict):
    messages: Annotated[list, add_messages]
  • Uses TypedDict for type safety
  • add_messages reducer for automatic message accumulation

2. Graph Builder Pattern

class GraphBuilder:
    def __init__(self, model):
        self.llm = model
        self.graph_builder = StateGraph(State)
    
    def setup_graph(self, usecase: str):
        if usecase == 'Basic Chatbot':
            self.basic_chatbot_build_graph()
        elif usecase == 'Chatbot with Tool':
            self.chatbot_with_tools_build_graph()
        elif usecase == 'AI News':
            self.ai_news_builder_graph()
        return self.graph_builder.compile()

3. Tool Integration

from langchain_community.tools.tavily_search import TavilySearchResults
from langgraph.prebuilt import ToolNode

def get_tools():
    return [TavilySearchResults(max_results=2)]

def create_tool_node(tools):
    return ToolNode(tools=tools)

4. Configuration System

[DEFAULT]
PAGE_TITLE = LangGraph: Build Stateful Agentic AI
LLM_OPTIONS = Groq
USECASE_OPTIONS = Basic Chatbot, Chatbot with Tool, AI News
GROQ_MODEL_OPTIONS = llama-3.3-70b-versatile, llama-3.1-8b-instant

Design Patterns Used

Pattern Application
Factory Pattern GraphBuilder.setup_graph() creates appropriate graph based on use case
Strategy Pattern Different node implementations for different behaviors
State Pattern State TypedDict manages conversation state
Template Method graph_builder.compile() finalizes graph construction

๐Ÿ”ฎ Future Roadmap

  • Multi-LLM Support - Add OpenAI, Anthropic, Gemini providers
  • Memory Persistence - Store conversations in database
  • RAG Integration - Document-based Q&A capabilities
  • Voice Interface - Speech-to-text input support
  • Authentication - User login and session management
  • Docker Deployment - Containerized deployment
  • API Endpoints - REST API for external integration
  • Advanced Analytics - Usage tracking and insights

๐Ÿค Contributing

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

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

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

MIT License

Copyright (c) 2025 Brijesh Rakhasiya

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

๐Ÿ‘จโ€๐Ÿ’ป Author

Built with โค๏ธ by Brijesh Rakhasiya

GitHub


โญ Star this repository if you found it helpful!

๐Ÿ” Back to Top

About

Production-ready multi-agent AI system with LangGraph - featuring chatbots with real-time web search & automated AI news aggregation

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages