# LangGraph Chatbot
A conversational AI chatbot built with LangGraph, Streamlit, and Google Gemini.
## Features
- Multi-tool support (Calculator, Stock prices, Web search)
- Conversation history with thread management
- Persistent storage with SQLite
- Real-time streaming responses
## Setup
1. Clone the repository
2. Install dependencies: `pip install -r requirements.txt`
3. Create `.env` file with your `GOOGLE_API_KEY`
4. Run: `streamlit run app.py`
## Deployment
See deployment guide for instructions on deploying to Streamlit Cloud, Render, or Railway.mkdir langgraph-chatbot
cd langgraph-chatbotCreate all the files listed above with their respective content.
# Create virtual environment (recommended)
python -m venv venv
# Activate virtual environment
# On Windows:
venv\Scripts\activate
# On Mac/Linux:
source venv/bin/activate
# Install packages
pip install -r requirements.txt- Get a Google API key from: https://makersuite.google.com/app/apikey
- Create
.envfile and add:GOOGLE_API_KEY=your_actual_api_key_here
streamlit run app.pyThe app will open at http://localhost:8501
-
Push to GitHub
git init git add . git commit -m "Initial commit" git remote add origin https://github.com/yourusername/langgraph-chatbot.git git push -u origin main
-
Deploy on Streamlit Cloud
- Go to https://share.streamlit.io/
- Click "New app"
- Connect your GitHub repository
- Select the repository and branch
- Set main file path:
app.py - Click "Advanced settings" → Add secrets:
GOOGLE_API_KEY = "your_api_key_here" - Click "Deploy"
-
Your app will be live at:
https://yourusername-langgraph-chatbot.streamlit.app
-
Push to GitHub (same as above)
-
Deploy on Render
- Go to https://render.com/
- Click "New +" → "Web Service"
- Connect your GitHub repository
- Configure:
- Name: langgraph-chatbot
- Environment: Python 3
- Build Command:
pip install -r requirements.txt - Start Command:
streamlit run app.py --server.port=$PORT --server.address=0.0.0.0
- Add Environment Variable:
- Key:
GOOGLE_API_KEY - Value: your_api_key
- Key:
- Click "Create Web Service"
-
Your app will be live at:
https://langgraph-chatbot.onrender.com
-
Push to GitHub (same as above)
-
Deploy on Railway
- Go to https://railway.app/
- Click "New Project" → "Deploy from GitHub repo"
- Select your repository
- Railway will auto-detect it's a Python app
- Add Environment Variable:
- Key:
GOOGLE_API_KEY - Value: your_api_key
- Key:
- Click "Deploy"
-
Your app will be live at: Railway will provide a URL
- Go to https://huggingface.co/spaces
- Click "Create new Space"
- Choose "Streamlit" as SDK
- Upload all your files
- Add your
GOOGLE_API_KEYin Settings → Repository secrets - Your app will be live!
-
"No module named 'streamlit'"
- Solution:
pip install -r requirements.txt
- Solution:
-
"GOOGLE_API_KEY not found"
- Solution: Create
.envfile with your API key
- Solution: Create
-
Database locked error
- Solution: Delete
chatbot.dband restart
- Solution: Delete
-
Port already in use
- Solution:
streamlit run app.py --server.port=8502
- Solution:
After deployment, test these features:
- ✅ Send a message
- ✅ Ask for a calculation: "What is 25 * 4?"
- ✅ Ask for stock price: "What's the price of AAPL?"
- ✅ Ask to search web: "Latest news about AI"
- ✅ Create a new chat
- ✅ Switch between conversations
Your chatbot is now deployed and accessible worldwide! Share the URL with anyone.
Need help? Check the respective platform's documentation:
- Streamlit Cloud: https://docs.streamlit.io/streamlit-community-cloud
- Render: https://render.com/docs
- Railway: https://docs.railway.app/
Happy chatting! 🚀