https://github.com/langchain-ai/new-langgraph-project
https://github.com/langchain-ai/new-langgraph-project
langgraph langgraph-python langgraph-template
Last synced: 29 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/langchain-ai/new-langgraph-project
- Owner: langchain-ai
- License: mit
- Created: 2024-09-13T23:28:15.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2025-01-02T18:19:00.000Z (4 months ago)
- Last Synced: 2025-04-02T11:04:31.721Z (about 1 month ago)
- Topics: langgraph, langgraph-python, langgraph-template
- Language: Python
- Homepage:
- Size: 1.77 MB
- Stars: 39
- Watchers: 3
- Forks: 42
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-LangGraph - langchain-ai/new-langgraph-project - ai/new-langgraphjs-project](https://github.com/langchain-ai/new-langgraphjs-project) | (Official Resources / Starter Templates)
README
# New LangGraph Project
[](https://github.com/langchain-ai/new-langgraph-project/actions/workflows/unit-tests.yml)
[](https://github.com/langchain-ai/new-langgraph-project/actions/workflows/integration-tests.yml)
[](https://langgraph-studio.vercel.app/templates/open?githubUrl=https://github.com/langchain-ai/new-langgraph-project)This template demonstrates a simple chatbot implemented using [LangGraph](https://github.com/langchain-ai/langgraph), designed for [LangGraph Studio](https://github.com/langchain-ai/langgraph-studio). The chatbot maintains persistent chat memory, allowing for coherent conversations across multiple interactions.

The core logic, defined in `src/agent/graph.py`, showcases a straightforward chatbot that responds to user queries while maintaining context from previous messages.
## What it does
The simple chatbot:
1. Takes a user **message** as input
2. Maintains a history of the conversation
3. Generates a response based on the current message and conversation history
4. Updates the conversation history with the new interactionThis template provides a foundation that can be easily customized and extended to create more complex conversational agents.
## Getting Started
Assuming you have already [installed LangGraph Studio](https://github.com/langchain-ai/langgraph-studio?tab=readme-ov-file#download), to set up:
1. Create a `.env` file.
```bash
cp .env.example .env
```2. Define required API keys in your `.env` file.
3. Customize the code as needed.
4. Open the folder in LangGraph Studio!## How to customize
1. **Modify the system prompt**: The default system prompt is defined in [configuration.py](./src/agent/configuration.py). You can easily update this via configuration in the studio to change the chatbot's personality or behavior.
2. **Select a different model**: We default to Anthropic's Claude 3 Sonnet. You can select a compatible chat model using `provider/model-name` via configuration. Example: `openai/gpt-4-turbo-preview`.
3. **Extend the graph**: The core logic of the chatbot is defined in [graph.py](./src/agent/graph.py). You can modify this file to add new nodes, edges, or change the flow of the conversation.You can also quickly extend this template by:
- Adding custom tools or functions to enhance the chatbot's capabilities.
- Implementing additional logic for handling specific types of user queries or tasks.
- Integrating external APIs or databases to provide more dynamic responses.## Development
While iterating on your graph, you can edit past state and rerun your app from previous states to debug specific nodes. Local changes will be automatically applied via hot reload. Try experimenting with:
- Modifying the system prompt to give your chatbot a unique personality.
- Adding new nodes to the graph for more complex conversation flows.
- Implementing conditional logic to handle different types of user inputs.Follow-up requests will be appended to the same thread. You can create an entirely new thread, clearing previous history, using the `+` button in the top right.
For more advanced features and examples, refer to the [LangGraph documentation](https://github.com/langchain-ai/langgraph). These resources can help you adapt this template for your specific use case and build more sophisticated conversational agents.
LangGraph Studio also integrates with [LangSmith](https://smith.langchain.com/) for more in-depth tracing and collaboration with teammates, allowing you to analyze and optimize your chatbot's performance.