π§ A production-grade, agentic AI backend that combines LangGraph, Retrieval-Augmented Generation (RAG), persistent memory via Redis, and secure FastAPI endpoints. Designed for full-scale deployment on Docker and Kubernetes with monitoring and API key security.
This project provides a modular boilerplate to build and deploy end-to-end agentic AI applications using LangGraph and RAG. It is production-ready, scalable, and extensible, enabling multi-turn conversations, external document integration, persistent memory, and comprehensive monitoring.
+------------------+ +-------------------+ +------------------+
| Streamlit UI | <---> | FastAPI Backend | <---> | LangGraph Agent |
+------------------+ +-------------------+ +------------------+
|
+--------+--------+
| Redis Memory |
+--------+--------+
|
+-------+--------+
| Vector Store |
| (Chroma) |
+----------------+
/enterprise-rag-agent
β
βββ app/
β βββ main.py # FastAPI entrypoint
β βββ config.py # App-wide config (env vars, secrets)
β βββ tools.py # Tool functions used in LangGraph
β βββ graph_manager.py # LangGraph graph and flow logic
β βββ vector_store/
β β βββ loader.py # Load PDFs, markdown, etc.
β β βββ embedder.py # Embedding logic using OpenAI or others
β β βββ vectordb.py # Vector DB logic (FAISS/Chroma)
β βββ node_pool/
β β βββ retrieve_node.py
β β βββ generate_node.py
β β βββ fallback_node.py
β βββ state_manager/
β β βββ memory_state.py # Redis chat history threading
β βββ integration/
β β βββ confluence_api.py # Placeholder for API integrations
β βββ security/
β β βββ auth.py # API key validation
β βββ monitoring/
β β βββ metrics.py # Prometheus-ready metrics
β βββ error_handler.py # Global exception handling
β
βββ streamlit_ui/
β βββ ui.py # Multi-tab UI for user interaction
β
βββ data/
β βββ sample_docs/ # PDFs, Markdown, CSVs for ingestion
β
βββ docker/
β βββ Dockerfile # Backend Docker setup
β
βββ k8/
β βββ deployment.yaml # Kubernetes deployment
β βββ service.yaml # Kubernetes service
β
βββ .env # Secrets like API keys
βββ .gitignore # Ignored files
βββ requirements.txt # Python dependencies
βββ README.md # Youβre reading it
git clone https://github.com/your-org/enterprise-rag-agent.git
cd enterprise-rag-agent
AZURE_ENDPOINT =
AZURE_API_KEY =
OPENAI_API_TYPE =
AZURE_DEPLOYMENT =
AZURE_API_VERSION =
AZURE_MODEL=
GEMINI_API_KEY=
LANGSMITH_TRACING=true
LANGSMITH_ENDPOINT=
LANGSMITH_API_KEY=
LANGSMITH_PROJECT=
SERPER_API_KEY=
RAG_API_KEY=
pip install -r requirements.txt
docker run -d -p 6379:6379 redis
uvicorn app.main:app --reload
streamlit run streamlit_ui/ui.py
- β
API key validation via
X-API-Key
- β
Secure loading from
.env
usingpython-dotenv
- β
Centralized
auth.py
logic
- π Redis-based persistent state across sessions
- π§΅ Threaded conversations
- πΎ State autosaved before/after LangGraph execution
- Nodes:
- π₯ Retrieve Node β RAG doc search
- βοΈ Generate Node β LLM reasoning
- π§― Fallback Node β edge case handler
- Built using LangGraphβs composable workflows
Ask a question to the agent.
POST /ask
Headers:
X-API-Key: your_api_key
Body:
{
"question": "What is the sales trend for Q1?"
}
Response
{
"final_answer": "The sales trend for Q1 was an upward growth of 18%."
}
- π
/metrics
endpoint exposes Prometheus counters - Tracks:
- β‘ Request duration
- π’ Total requests
- β Response status codes
- π RAG operation metrics
docker network create rag-net
docker run -d --name redis --network rag-network redis:latest
docker network connect rag-net redis
docker run -d --name rag-backend --network rag-net -p 8000:8000 rag-backend:latest
docker run -d --name rag-frontend --network rag-net -p 8501:8501 rag-frontend:latest<img width="902" height="189" alt="image" src="https://github.com/user-attachments/assets/66ef1b9e-081d-4c5c-9b61-93f61d7576c5" />
kubectl apply -f deployment/
- π Secure API layer
- π Vector Search with FAISS/Chroma
- π Persistent Redis memory
- π§ LangGraph agent orchestration
- π§ͺ Monitoring with Prometheus
- π₯οΈ Multi-tab Streamlit UI
- π³ Docker-ready
- βΈοΈ Kubernetes-ready
- π CI/CD via GitHub Actions
- βοΈ Azure Blob, SharePoint, Confluence integrations
- π¬ Slack & Teams notifications
- π§Ύ Session transcripts and summaries
Pradeep P. β Software Professional | AI & Cloud Engineer
Feel free to fork, contribute, or raise issues!