A web-based chatbot application powered by LangGraph with memory functionality. This chatbot maintains conversation history within threads (short-term memory) and can store user information across conversations (long-term memory).
- Interactive web interface with real-time responses
- Thread-based conversation management with unique thread IDs
- Short-term memory using InMemorySaver to maintain conversation history
- Long-term memory using InMemoryStore for user information
- System message context injection based on stored user information
- Markdown support in chat responses
- Python 3.8+
- Flask
- LangGraph
- LangChain
- OpenAI API key (or other supported LLM provider)
- Clone the repository
- Install dependencies:
pip install -r requirements.txt
- Set up your API key in the environment or update
chatbot.py
python app.py
The application will be available at http://localhost:5001
This application can be deployed to various platforms. Here are some options:
- Create a new account on Render if you don't have one
- Click "New" and select "Blueprint" (or "Web Service" if you prefer manual setup)
- Connect your GitHub repository
- Render will automatically detect the
render.yaml
configuration - Add your
OPENAI_API_KEY
as an environment variable in the Render dashboard - Deploy the application
- Create a new app on Heroku
- Connect your GitHub repository or use the Heroku CLI
- Add your
OPENAI_API_KEY
as a config var in the Heroku dashboard - Deploy the application
- Create an account on PythonAnywhere
- Upload your code or clone from GitHub
- Set up a web app with Flask
- Add your
OPENAI_API_KEY
as an environment variable - Configure the WSGI file to point to your app.py
This application can also be deployed to other platforms that support Python web applications. Please refer to the respective platform's documentation for deployment instructions.
app.py
: Flask web serverchatbot.py
: LangGraph chatbot implementation with memorytemplates/
: HTML templatesstatic/
: CSS and JavaScript filesvisualize_graph.py
: Utility for visualizing the LangGraph