Skip to content

AbhaySingh71/Aria-Agentic-AI-Orchestrator-Workflow-Engine

Repository files navigation

🤖 Aria - Advanced AI Agent Chatbot

A sophisticated multi-utility AI chatbot powered by LangGraph, featuring advanced RAG, intelligent tool calling, MCP integration, and agentic workflow orchestration.

Python LangGraph Streamlit License

Table of Contents


Overview

Aria is an intelligent conversational agent that combines the power of:

  • LangGraph: For orchestrating complex AI workflows
  • LangChain: For tool management and LLM interactions
  • Google Gemini 2.5: State-of-the-art language understanding
  • Agentic RAG: Intelligent document retrieval with reasoning
  • MCP Protocol: Extensible tool integration via Model Context Protocol
  • SQLite: Persistent multi-threaded conversation storage

This chatbot goes beyond simple retrieval—it understands when to use which tool, combines information from multiple sources, and maintains context across dozens of independent conversations.


Architecture

System Design

┌─────────────────────────────────────────────────────────┐
│                    Streamlit Frontend                    │
│  (Chat UI, PDF Management, Thread Handling)              │
└────────────────┬────────────────────────────────────────┘
                 │
┌────────────────▼────────────────────────────────────────┐
│              LangGraph State Machine                      │
│  ┌──────────────────────────────────────────────────┐   │
│  │ START → chat_node → tools_condition             │   │
│  │           ↑                    ↓                 │   │
│  │           └─── tool_node ←────┘                 │   │
│  └──────────────────────────────────────────────────┘   │
└────────────────┬────────────────────────────────────────┘
                 │
    ┌────────────┼────────────┐
    │            │            │
┌───▼──┐  ┌─────▼──┐  ┌──────▼──────┐
│ LLM  │  │ Tools  │  │ Storage     │
│      │  │        │  │ (SQLite)    │
└──────┘  └────────┘  └─────────────┘

Request Flow

  1. User Input → Streamlit frontend
  2. Thread Routing → SQLite retrieves conversation history
  3. LLM Processing → Gemini determines which tools to use
  4. Tool Execution → Parallel/sequential tool invocation
  5. Response Assembly → Stream response back to user
  6. Storage → Persist conversation to database

Key Features

🧠 1. Agentic RAG (Retrieval-Augmented Generation)

Traditional RAG:

Query → Retrieve → Generate

Aria's Agentic RAG:

Query → Analyze → Decide Retrieval Strategy → Retrieve → Reason → Generate

What makes it "Agentic":

  • Intelligent Routing: LLM decides whether RAG is needed or if other tools are better
  • Multi-step Reasoning: Can combine document insights with web search or calculations
  • Adaptive Chunking: 1000-character chunks with 200-char overlap for semantic cohesion
  • Semantic Search: Uses Google's embeddings (models/embedding-001) for similarity matching

How it works:

  1. User uploads a PDF → Text extraction & splitting
  2. Documents are embedded using Google's embedding model
  3. FAISS index created for fast similarity search
  4. When queried, LLM receives top-4 relevant chunks
  5. LLM decides: use RAG info + search + calculate + track expenses?

🔄 2. Tool Calling System

7 Integrated Tools:

Tool Purpose Provider Type
DuckDuckGo Search Real-time web information DuckDuckGo External API
Stock Prices Financial data retrieval Alpha Vantage External API
Calculator Math operations Native Built-in
RAG Tool Document Q&A FAISS + Embeddings Internal
Add Expense Track spending MCP Server Remote Protocol
List Expenses View transaction history MCP Server Remote Protocol
Summarize Generate expense summaries MCP Server Remote Protocol

Tool Calling Flow:

LLM Decision:
├─ If ("search" in intent) → DuckDuckGo_Search()
├─ If ("stock" in intent) → Get_Stock_Price()
├─ If ("math" in intent) → Calculator()
├─ If ("document" in intent) → RAG_Tool()
├─ If ("expense" in intent) → MCP_Expense_Tools()
└─ If ("none" in intent) → Direct_Response()

Key Technologies:

  • LangChain StructuredTool: Type-safe tool definitions
  • Tool Binding: LLM knows function signatures, parameters, return types
  • Conditional Edges: LangGraph routes based on LLM output
  • Async Wrapping: MCP async tools converted to sync for compatibility

🔌 3. MCP (Model Context Protocol) Integration

What is MCP? MCP is a standardized protocol for connecting AI models with external tools and data sources. It's like an "API standard" for AI assistants.

Aria's MCP Setup:

Aria Chatbot ←→ MCP Client ←→ Expense Tracker Server
              (stdio transport)

Local vs Remote:

  • Remote Setup Failed: 401 Unauthorized from remote endpoint
  • Local Setup Success: Python subprocess stdio transport

Architecture:

# Local MCP Expense Tracker
MCP Service:
├─ add_expense(amount, date, category)
├─ list_expenses(filters)
└─ summarize(period)

Transport: Stdio (stdin/stdout pipes)
Async Handling: StructuredTool wrapper for sync execution
Threading: Separate event loop for async operations

Benefits:

  • Extensibility: Add any MCP server without modifying core code
  • Isolation: Tools run in separate processes
  • Standardization: Same API whether local or remote

� 6. LangSmith Integration & Observability

What is LangSmith?

LangSmith is a unified platform for debugging, testing, and monitoring AI applications. It provides complete visibility into your LLM calls, tool usage, latency, and failures.

Aria's LangSmith Integration:

Every chat interaction is automatically traced and logged to LangSmith for real-time monitoring and debugging.

What Gets Traced:

Chat Turn Trace:
├─ User Input
│  ├─ Message content
│  ├─ Thread ID
│  └─ Message count
├─ Processing
│  ├─ LLM invocation (Gemini 2.5)
│  ├─ Tool decisions & calls
│  └─ Tool execution results
└─ Output
   ├─ AI response
   ├─ Response length
   ├─ Tools used
   └─ Execution timing

Key Metrics Captured:

Metric Purpose Use Case
Response Time Track LLM latency Identify slow responses
Tools Used Monitor tool routing Understand agent behavior
Token Count Measure input/output size Cost analysis
Error Tracking Log failures Debug issues
Thread ID Link to conversation Trace user sessions
Timestamp Record exact time Performance trending

LangSmith Dashboard Views:

  1. Traces Tab: Complete execution flow for each chat turn

    • Visual hierarchy of LLM calls, tool calls, and responses
    • Input/output for each node
    • Timing information
  2. Metrics Tab: Aggregated performance data

    • Average response time per conversation
    • Tool usage frequency
    • Error rates and types
  3. Debugging: Deep-dive into specific traces

    • See exact prompts sent to LLM
    • Tool execution details
    • Error messages and stack traces

Setup:

# Add to .env file
LANGCHAIN_TRACING_V2=true
LANGCHAIN_PROJECT=Advance LangGraph project
LANGCHAIN_API_KEY=<your-langsmith-api-key>
LANGCHAIN_ENDPOINT=https://api.smith.langchain.com

Get your API key from: https://smith.langchain.com/settings/org/api-keys

How It Works:

# Automatic tracing happens in chatbot_stream_with_tracing()
@traceable(name="Chat Turn", tags=["chat", "stream"])
def traced_stream():
    # All code here is automatically traced
    for chunk in chatbot.stream(input_dict, config=config):
        yield chunk

Every interaction flows through LangSmith's tracer, creating a complete audit trail of:

  • What the user asked
  • How the agent reasoned about tools
  • Which tools were called and why
  • What data was retrieved/computed
  • How the final response was generated

Use Cases:

  1. Real-time Monitoring: Watch trace execution as users chat
  2. Performance Analysis: Identify bottlenecks (slow tools, token usage)
  3. Debugging: Replay failed traces to understand what went wrong
  4. Cost Tracking: Monitor LLM token usage and API calls
  5. Quality Assurance: Audit agent behavior patterns
  6. User Behavior: Understand which features users interact with

Example Scenario:

User: "Based on my uploaded document, find instances where costs exceeded $10,000"

LangSmith Trace Shows:

  • LLM received: user query + system prompt + document chunks (RAG)
  • LLM decision: "Need to use RAG tool to search document"
  • Tool executed: rag_tool("costs exceeded 10000", thread_id=...)
  • Tool returned: 3 matching sections from document
  • LLM regenerated: Final response with filtered results
  • Trace metadata: response_time=2.3s, tools_used=["rag_tool"], token_count=1240

Features:

Automatic tracing - No code changes needed, works out of the box ✅ Tool tracking - See which tools called and their execution time ✅ Error capture - Failures are automatically logged with context ✅ Session continuity - Thread IDs link traces to conversations ✅ No data leakage - API calls are secure, private to your org

Dashboard Sample:

Project: Advance LangGraph project
├─ Today
│  ├─ Chat Turn (2:45 PM) - Response: "The document shows..." | Tools: rag_tool | Time: 2.3s
│  ├─ Chat Turn (2:41 PM) - Response: "AAPL is trading at..." | Tools: stock_price | Time: 1.2s
│  ├─ Chat Turn (2:38 PM) - Response: "47 * 32 = 1504" | Tools: calculator | Time: 0.5s
│  └─ Chat Turn (2:35 PM) - Response: "Here's what I found..." | Tools: duckduckgo_search | Time: 3.8s
└─ Last 7 days
   └─ (Historical data...)

For detailed configuration and troubleshooting, see LANGSMITH_FIX.md.


�💬 4. Thread Management (Multi-Conversation Support)

What are Threads?

Threads enable independent conversation contexts. Each thread has:

  • Unique UUID identifier
  • Isolated conversation history
  • Separate document index (FAISS)
  • Dedicated metadata storage

Per-Thread Storage:

Database (SQLite):
├─ Thread A (UUID: 22258138...)
│  ├─ Message 1: "Hi, analyze my budget"
│  ├─ Message 2: "Create expense tracking"
│  └─ Metadata: {docs_indexed: 1, chunks: 245}
│
├─ Thread B (UUID: 8f9a1d2c...)
│  ├─ Message 1: "Search latest AI news"
│  └─ Message 2: "What about LangGraph?"
│
└─ Thread C (UUID: 7c4e5b9a...)
   ├─ Message 1: "Calculate 500 * 2.5"
   └─ ...

Implementation:

  • SQLite Checkpointer: langgraph_checkpoint_sqlite persists state
  • Thread ID Config: Passed to every invocation via configurable["thread_id"]
  • Per-Thread Retrievers: _THREAD_RETRIEVERS dict maintains separate FAISS indexes
  • Conversation Isolation: Messages in Thread A don't affect Thread B

Thread Operations:

# Create new thread
thread_id = generate_thread_id()

# Load existing thread
state = chatbot.get_state(config={"configurable": {"thread_id": thread_id}})

# Continue conversation
for msg in chatbot.stream({"messages": [HumanMessage(...)]}, 
                          config={"configurable": {"thread_id": thread_id}}):
    process(msg)

📚 5. Database Architecture

SQLite with LangGraph Checkpointer

Schema (Auto-managed by langgraph-checkpoint-sqlite):

threads:
├─ thread_id (primary key)
├─ checkpoint_data (serialized state)
└─ timestamp

Type structure (internal):
├─ messages: List[Union[HumanMessage, AIMessage, ToolMessage]]
└─ metadata: Dict[str, Any]

Thread-Local Storage:

# Memory storage (session-based)
_THREAD_RETRIEVERS: Dict[str, Any]  # FAISS indices per thread
_THREAD_METADATA: Dict[str, dict]   # Document info per thread

# Persistent storage (database)
SQLiteSaver checkpointer               # Message history

Persistence Flow:

1. User sends message
2. LLM generates response + tool calls
3. Tools execute
4. State updated: messages + tool outputs
5. SQLiteSaver checkpoints to database
6. Next request loads from checkpoint

Why SQLite?

  • ✅ Simple, no external DB needed
  • ✅ Thread-safe (aiosqlite for async)
  • ✅ Persistent across restarts
  • ✅ Perfect for single-machine deployment
  • ✅ Easy migration to PostgreSQL later

Core Concepts

Concept 1: StateGraph (LangGraph)

What it is: A directed acyclic graph (DAG) that defines AI workflow execution.

Aria's Graph:

graph = StateGraph(ChatState)
graph.add_node("chat_node", chat_node)           # LLM invocation
graph.add_node("tools", tool_node)               # Tool execution
graph.add_edge(START, "chat_node")               # Entry point
graph.add_conditional_edges(                     # Smart routing
    "chat_node", 
    tools_condition,  # Decides: call tools or finish?
    {
        "continue": "tools",
        END: END
    }
)
graph.add_edge("tools", "chat_node")            # Loop back

Execution Trace:

START
  ↓
chat_node → [LLM decides: need tools?]
  ↓
tools_condition → {
    No tools → END (return response)
    Tools needed → tools
}
  ↓
tools → Execute all tools in parallel
  ↓
chat_node → [LLM processes tool outputs]
  ↓
(loop until no more tools needed)

Concept 2: add_messages Reducer

Problem: How do we merge tool outputs back into the message history?

Solution: Reducer function

messages: Annotated[list[BaseMessage], add_messages]

What it does:

Old messages:    [User, Assistant, ToolMessage]
New messages:    [ToolMessage, ToolMessage]
Result:          [User, Assistant, ToolMessage, ToolMessage, ...]

(Automatically merges instead of replacing)

Concept 3: Streaming

Why Stream?

  • ✅ Real-time token-by-token display
  • ✅ Better UX (doesn't feel frozen)
  • ✅ Faster apparent response time
  • ✅ Can cancel long responses

Aria's Streaming:

for message_chunk, _ in chatbot.stream(
    {"messages": [HumanMessage(content=user_input)]},
    config=CONFIG,
    stream_mode="messages"
):
    if isinstance(message_chunk, AIMessage):
        yield message_chunk.content  # Stream to Streamlit

Tech Stack

Core Frameworks

  • LangGraph 1.1.6: AI workflow orchestration
  • LangChain 1.2.15: LLM abstractions & tools
  • Streamlit 1.48: Web UI framework
  • SQLite + aiosqlite: Persistent storage

AI/ML Components

  • Google Generative AI: Gemini 2.5 Flash Lite LLM + embedding model
  • FAISS: Vector similarity search (Facebook AI Similarity Search)
  • Sentence Transformers: Embeddings pipeline

Observability & Monitoring

  • LangSmith: AI application debugging, testing, and monitoring
  • LangSmith Traces: Real-time execution tracking
  • LangSmith Metrics: Performance and cost analytics

Data Processing

  • PyPDF: PDF text extraction
  • LangChain Text Splitters: Semantic chunking (1000 chars, 200 overlap)
  • HuggingFace Hub: Model downloading

External Integrations

  • DuckDuckGo Search (ddgs 9.13.0): Web search
  • Alpha Vantage API: Stock price data
  • MCP Protocol (fastmcp 3.2.0): Standard tool interface
  • Model Context Protocol (mcp 1.27.0): Protocol support

Development Tools

  • Python 3.12.2: Language version
  • Virtual Environment (venv): Dependency isolation

Project Structure

Aria/
├── frontend.py                 # Streamlit UI (300+ lines)
│   ├── Sidebar: Thread management, PDF upload
│   ├── Main: Chat interface, features showcase
│   └── CSS: Custom styling
│
├── langgraph_backend.py        # Core orchestration (700+ lines)
│   ├── Environment Setup: LangSmith configuration
│   ├── LangSmith Integration: Trace creation & metrics
│   ├── Event Loop Setup: Thread-safe async handling
│   ├── PDF Processing: Ingestion → Chunking → Embedding
│   ├── Tool Definitions: 7 integrated tools
│   ├── MCP Client: Local expense tracker
│   ├── Chat Node: LLM invocation + tool binding
│   ├── Graph Construction: StateGraph + edges
│   └── Helper Functions: Retrievers, metadata tracking
│
├── chatbot.db                  # SQLite database
│   └─ Persisted conversation history across threads
│
├── LANGSMITH_FIX.md            # LangSmith detailed guide
├── README.md                   # Documentation (you are here!)
├── LICENSE                     # MIT License
└── requirements.txt            # Dependencies

Installation

Prerequisites

  • Python 3.12+
  • pip or conda
  • 2GB+ free disk space (for embeddings models)

Setup

  1. Clone repository:
git clone <repo-url>
cd aria-chatbot
  1. Create virtual environment:
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\Activate.ps1
  1. Install dependencies:
pip install -r requirements.txt

Required packages:

langchain==1.2.15
langchain-core==1.2.27
langchain-community==0.4.1
langgraph==1.1.6
langgraph-checkpoint-sqlite==2.0.11
langsmith>=0.1.0
google-generativelanguage==0.6.18
langchain-google-genai==2.1.9
streamlit==1.48.0
PyPDF==6.9.2
faiss-cpu==1.8.0
sentence-transformers==5.3.0
ddgs==9.13.0
aiosqlite==0.21.0
  1. Set environment variables:
export GOOGLE_API_KEY="your-gemini-api-key-here"
export LANGCHAIN_TRACING_V2=true
export LANGCHAIN_PROJECT="Advance LangGraph project"
export LANGCHAIN_API_KEY="your-langsmith-api-key-here"
  1. Run the application:
streamlit run frontend.py

App will open at: http://localhost:8505


Usage

Basic Chat

  1. Type a message in the chat input
  2. Aria analyzes which tools to use
  3. Tools execute (search, calculate, retrieve docs, etc.)
  4. Response streams in real-time

Upload Documents (RAG)

  1. Click "Document Management" in sidebar
  2. Drag & drop PDF or click "Browse files"
  3. Watch as Aria chunks and indexes the document
  4. Ask questions about the document content

Multi-Conversation

  1. Click "Thread ID" to see current thread
  2. Click "🔄" button to start new chat
  3. View past conversations in "Conversation History"
  4. Click on any past chat to resume it

Track Expenses

  1. Ask: "Add $50 on groceries on March 30, 2026"
  2. Ask: "What did I spend on"
  3. Ask: "Summarize my expenses this month"

Search the Web

  1. Ask: "Search for latest news on AI"
  2. Ask: "What's the current price of AAPL?"
  3. Ask: "Calculate 123 * 456"

Advanced Features

Agentic RAG in Detail

Example: Complex Query

User Query: "Based on my documents, find instances where the methodology aligns with recent AI trends"

Aria's Decision Process:

1. Parse Query
   ↓
2. Route Decision:
   - Needs RAG? Yes (document analysis)
   - Needs Web Search? Yes (recent trends)
   - Needs Calculation? No
   - Needs Expense Tracking? No
   ↓
3. Execute in Parallel:
   - RAG: Retrieve methodology sections
   - Search: Get latest AI trends
   - Wait for both results
   ↓
4. Reasoning Phase:
   - LLM receives: doc chunks + search results
   - LLM analyzes: alignment between them
   - LLM generates: coherent answer with sources
   ↓
5. Stream Response:
   "Based on your documents + recent trends..."

Tool Execution Model

Sequential vs Parallel:

# If tool A depends on tool B output: Sequential
tool_b_result = tool_b(params)
tool_a_result = tool_a(tool_b_result)

# If tools are independent: Parallel
results = await asyncio.gather(
    tool_a(params_a),
    tool_b(params_b),
    tool_c(params_c)
)

MCP Protocol Deep Dive

Why MCP matters for Aria:

  1. Extensibility: Add expense tracking, weather API, DB query tool, etc.
  2. Isolation: Tools crash independently, don't crash main app
  3. Security: Tools run in sandboxed processes
  4. Standardization: Same interface for local + remote tools

Example: Adding a New MCP Tool

# Create new MCP server (external process)
class WeatherMCPServer:
    def get_weather(self, city: str) -> str:
        return f"Weather in {city}: 72°F, Clear"

# Register in Aria
mcp_client.add_tool(
    name="weather",
    description="Get current weather",
    function=get_weather
)

# Now users can: "What's the weather in NYC?"

Performance Characteristics

Operation Time Notes
LLM Response 2-5s Streaming token-by-token
PDF Indexing (100 pages) 3-8s One-time, then instant retrieval
RAG Retrieval 50-200ms FAISS vector search
Tool Execution 500ms-2s Depends on tool type
Database Query <10ms SQLite in-process

Troubleshooting

Issue: "ModuleNotFoundError: langchain"

Solution:

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

Issue: "No module named 'torchvision'"

Solution: (Non-critical warning, doesn't affect functionality)

# This is from transformers library optional dependencies
# Safe to ignore - only needed for vision models

Issue: "GOOGLE_API_KEY not found"

Solution:

# Set environment variable
export GOOGLE_API_KEY="your-key"

# Or add to .env file
GOOGLE_API_KEY=your-key

Issue: Streamlit port 8505 already in use

Solution:

streamlit run frontend.py --server.port 8506

LangSmith Observability

Overview

LangSmith is integrated into Aria as the primary observability platform. It provides:

  • Real-time tracing of every chat interaction
  • Performance metrics and latency analysis
  • Tool usage analytics and routing decisions
  • Error tracking and debugging capabilities
  • Cost estimation via token counting

Getting Started with LangSmith

Step 1: Sign up at https://smith.langchain.com

Step 2: Create API Key

Settings → API Keys → Create New Key

Step 3: Add to .env

LANGCHAIN_TRACING_V2=true
LANGCHAIN_PROJECT=Advance LangGraph project
LANGCHAIN_API_KEY=<paste-your-api-key-here>
LANGCHAIN_ENDPOINT=https://api.smith.langchain.com

Step 4: Restart the app

streamlit run frontend.py

Step 5: Check connection In the Streamlit app, you should see: ✅ "LangSmith Tracing Active" in the main content area

Monitoring Interactions

View Real-time Traces:

  1. Open LangSmith dashboard: https://smith.langchain.com/projects
  2. Select project: "Advance LangGraph project"
  3. Click "Traces" tab
  4. You'll see traces appearing as users chat

Trace Anatomy:

Each trace contains:

Trace ID: unique-identifier
├─ Name: "Chat Turn"
├─ Input: {user_message, thread_id}
├─ Duration: 2.3 seconds
├─ Status: Success ✓
└─ Output: {response, tools_used, length}

Performance Analytics

Access Metrics:

  1. LangSmith Dashboard → Project → "Metrics" tab
  2. See aggregated data:
    • Total interactions
    • Average response time
    • Tool usage distribution
    • Error rates

Sample Metrics:

Today's Activity:
├─ Total Chat Turns: 42
├─ Avg Response Time: 2.1s
├─ Tools Used: {rag_tool: 15, search: 12, calculator: 8, stock_price: 7}
├─ Error Rate: 0.5% (1 failure)
└─ Total Tokens: ~18,500

Debugging Failed Interactions

When Something Goes Wrong:

  1. LangSmith shows error details:
Status: Error ❌
Error Message: "RAG tool - No document found"
Error Type: ValueError
Stack Trace: (full Python trace)
  1. Click on trace to see:

    • Exact prompts sent to LLM
    • Tool parameters
    • Error location in code
  2. Understand why it failed:

    • User didn't upload document
    • Document wasn't indexed
    • Query malformed
    • etc.

Use Cases

1. Performance Optimization

Q: "Which feature is slowest?"
A: Look at "Tool Execution" trace
   → RAG retrievals take 800ms on average
   → Consider caching or chunking optimization

2. Feature Adoption

Q: "Which tools do users rely on most?"
A: Check metrics tab
   → RAG tool: 60% of interactions
   → Calculator: 20%
   → Web search: 15%
   → Expense tracking: 5%

3. Cost Analysis

Q: "How much are we spending on LLM calls?"
A: Tokens per interaction × Model pricing
   → 1000 interactions × 1200 tokens avg
   → Cost estimate: ~$0.50/day with Gemini

4. Quality Assurance

Q: "Is the agent routing correctly?"
A: Look at tool decision patterns
   → Document questions → RAG tool 95% ✓
   → Math questions → Calculator 90% ✓
   → News questions → Web search 85% ✓

Troubleshooting LangSmith

Issue: "No traces appearing"

Check:

  1. API key is valid (test in LangSmith UI)
  2. .env file has correct key
  3. LANGCHAIN_TRACING_V2=true is set
  4. Restart Streamlit app after adding key
  5. Check browser console for errors

Issue: "Connection refused"

Check:

  1. Internet connectivity
  2. Firewall not blocking smith.langchain.com
  3. VPN not interfering
  4. API endpoint is correct

Issue: "Partial traces"

Possible causes:

  1. Tool execution taking too long (timeout)
  2. Large token outputs
  3. Streaming being interrupted

Solutions:

  • Check backend logs for exceptions
  • Verify tool implementations
  • Increase timeout if needed

Advanced: Custom Metrics

You can log custom metrics to LangSmith:

# In langgraph_backend.py
log_to_langsmith("custom_metric", {
    "value": 42,
    "category": "feature_usage"
}, tags={
    "user_id": thread_id,
    "feature": "my_feature"
})

These appear in LangSmith as custom data points.

Extending Tracing

Add tracing to new functions:

from langsmith import traceable

@traceable(name="My Feature", tags=["custom", "feature"])
def my_new_feature():
    # This function is now traced
    result = do_something()
    return result

Resources

For detailed LangSmith architecture and maintenance guide, see LANGSMITH_FIX.md.


Architecture Decisions

Why LangSmith for Observability?

  • ✅ Native integration with LangChain/LangGraph (zero setup)
  • ✅ Real-time trace visualization (see what LLM does)
  • ✅ Tool routing analysis (understand agent decisions)
  • ✅ Error capture and debugging
  • ✅ Cost estimation via token counting
  • ✅ Team collaboration features
  • ✅ Free tier available for development

Why SQLite instead of PostgreSQL?

  • ✅ Simpler deployment (no external DB)
  • ✅ Sufficient for single-machine use
  • ✅ Easy to migrate later
  • ✅ Built-in with LangGraph

Why FAISS instead of Pinecone?

  • ✅ Open source, no vendor lock-in
  • ✅ Free, no API costs
  • ✅ Fast local similarity search
  • ✅ Perfect for demo/MVP

Why Local MCP instead of Remote?

  • ✅ More reliable (no network issues)
  • ✅ Lower latency
  • ✅ No 401 auth issues
  • ✅ Data stays local

Future Enhancements

  • LangSmith Integration - Complete observability (IMPLEMENTED)
  • Web scraping tool for real-time data
  • Multi-document comparison across all uploaded PDFs
  • Conversation export (JSON, PDF)
  • User authentication & multi-user support
  • Custom model fine-tuning
  • Advanced caching for repeated queries
  • Vector store cloud sync to Pinecone
  • Webhook integrations (Slack, Discord)
  • LangSmith custom dashboards for team analytics

Contributing

Contributions are welcome! Areas:

  • New tool integrations (finance APIs, databases, etc.)
  • UI/UX improvements
  • Performance optimizations
  • Documentation enhancements
  • Bug fixes

License

MIT License - See LICENSE file


Credits

Built with:

  • LangGraph & LangChain by LangSmith
  • Streamlit by Streamlit Inc
  • Google Generative AI
  • Faiss by Facebook AI Research

Made with ❤️ by AI Enthusiasts

About

Multi-utility AI chatbot combining LangGraph, Gemini 2.5, agentic RAG, intelligent tool routing, persistent threads, MCP integration, and LangSmith observability for production-ready conversational AI.

Topics

Resources

License

Stars

1 star

Watchers

0 watching

Forks

Packages

 
 
 

Contributors