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
- ๐ฏ Problem Statement
- ๐ก Solution Approach
- ๐๏ธ Architecture & System Design
- โจ Key Features
- ๐ ๏ธ Tech Stack
- ๐ Project Structure
- ๐ Quick Start
- ๐ Live Demo & Screenshots
- ๐ Use Cases Deep Dive
- ๐ AI News Sample Outputs
- ๐ง Implementation Details
- ๐ฎ Future Roadmap
- ๐ค Contributing
- ๐ License
- ๐จโ๐ป Author
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 |
โ 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
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 โ โ
โ โโโโโโโโโโโโโโโโโโโ โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
| 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 |
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ 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 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
# 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 โ
โ โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
|
|
|
โ
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
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
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
# 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# Start the Streamlit app
streamlit run app.py- Open the application in your browser (default:
http://localhost:8501) - Enter your Groq API Key in the sidebar
- Select your preferred LLM Model
- Choose a Use Case
- For tool-based features, enter your Tavily API Key
- Start chatting!
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
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_conditionfor dynamic routing - Tavily search for real-time web data
- Automatic tool invocation based on LLM decision
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
The system automatically generates news summaries stored in the AINews/ folder:
# 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 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 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
from typing import Annotated
from langgraph.graph.message import add_messages
class State(TypedDict):
messages: Annotated[list, add_messages]- Uses
TypedDictfor type safety add_messagesreducer for automatic message accumulation
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()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)[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| 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 |
- 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
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
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.



