This project delivers a complete, LLM-powered, context-aware support agent. It features a full Retrieval Augmented Generation (RAG) pipeline, an integrated observability stack with LangSmith, a user-friendly web interface built with Streamlit, and is fully containerized with Docker for easy deployment.
The application follows a modern RAG architecture, orchestrated by LangChain and deployed as a self-contained service.
Flow Diagram:
User -> [Streamlit UI] -> [Docker Container] -> [LangChain Agent] -> [LangSmith (Observability)]
|
V
+--------------------------------+
| RAG Pipeline |
| |
| 1. Retrieve relevant docs |
| from Chroma Vector Store |
| |
| 2. Augment prompt with context |
| |
| 3. Reason with LLM (OpenAI) |
+--------------------------------+
|
V
[Response with Citations]
- Uses LangChain for robust agent orchestration
- Loads and processes text documents from a local
documentsfolder - Stores document embeddings in a persistent ChromaDB vector store
- The agent retrieves relevant context before answering a query, providing accurate, source-based answers
- Integrated with LangSmith out-of-the-box
- Automatically logs every user query, the retrieved documents, the final LLM-generated answer, and performance metrics like latency and token usage
- Provides a full trace of the agent's reasoning process for easy debugging and monitoring
- Uses
docker-composeto run the entire application with a single command - Ensures a consistent, reproducible environment for both development and production
- The ChromaDB database is persisted to the host machine via a Docker volume, so your vectorized data is not lost on restart
- A clean, interactive chat interface built with Streamlit
- Features an input box for user queries, a real-time display of responses, and a persistent chat history for the session
- Displays citations for each response, showing the source document chunks used to generate the answer
intelligent-agent-chatbot/
βββ .env # Stores API keys and environment variables
βββ app/
β βββ main.py # Core application: Streamlit UI + LangChain agent logic
β βββ documents/
β βββ project_docs.txt # Sample documents for the agent to learn from
βββ Dockerfile # Instructions to build the application container
βββ docker-compose.yml # Defines and runs the multi-container application
βββ requirements.txt # Python dependencies
βββ README.md # This file
Follow these steps to get the chatbot running on your local machine.
- Docker and Docker Compose
- Git
- An OpenAI API Key
- A LangSmith API Key (create an account and an API key)
Although the code is provided below, for a real setup you would clone a repository. For now, create the project folder structure as shown above.
mkdir -p intelligent-agent-chatbot/app/documents
cd intelligent-agent-chatbotCreate a file named .env in the root of the project directory (intelligent-agent-chatbot/) and add your API keys.
File: .env
# OpenAI API Configuration
OPENAI_API_KEY="sk-..."
# LangSmith Observability Configuration
LANGCHAIN_TRACING_V2="true"
LANGCHAIN_API_KEY="ls__..."
LANGCHAIN_PROJECT="Intelligent Agent - RAG Demo"
LANGCHAIN_TRACING_V2="true": Enables LangSmith tracing.LANGCHAIN_PROJECT: Groups all your runs under this project name in the LangSmith dashboard.
From the root of the project directory (intelligent-agent-chatbot/), run the following command:
docker-compose up --buildThis command will: Build the Docker image based on the Dockerfile.
Start the service defined in docker-compose.yml.
The first time it runs, the Python script will load project_docs.txt, create embeddings, and save them to the chroma_db directory.
Chatbot UI: Open your web browser and go to http://localhost:8501
Observability Dashboard: Go to LangSmith and log in. You will see your project "Intelligent Agent - RAG Demo" with detailed traces for every query.
UI in Action
A screenshot would show the Streamlit interface. On the left, a chat history. On the right, the current conversation. A user asks "What is the pricing model?", and the agent responds with information from the documents, followed by an expandable "Citations" section showing the exact text snippets used.
Few of screenshots attached below would show the LangSmith dashboard. A table lists recent runs, with columns for Name, Latency, Feedback, and Tokens. Clicking on a run would open a detailed trace view, showing the flow from ChatInput to Retriever to LLM and the final Output, with inputs and outputs for each step clearly visible.