https://github.com/langchain-ai/new-langgraphjs-project
Empty langgraph project template.
https://github.com/langchain-ai/new-langgraphjs-project
langgraph langgraph-js langgraph-template
Last synced: about 1 month ago
JSON representation
Empty langgraph project template.
- Host: GitHub
- URL: https://github.com/langchain-ai/new-langgraphjs-project
- Owner: langchain-ai
- License: mit
- Created: 2024-09-17T00:58:59.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-29T00:13:46.000Z (11 months ago)
- Last Synced: 2024-12-15T08:23:46.886Z (10 months ago)
- Topics: langgraph, langgraph-js, langgraph-template
- Language: TypeScript
- Homepage:
- Size: 699 KB
- Stars: 5
- Watchers: 3
- Forks: 5
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# New LangGraph.js Project
[](https://github.com/langchain-ai/new-langgraphjs-project/actions/workflows/unit-tests.yml)
[](https://github.com/langchain-ai/new-langgraphjs-project/actions/workflows/integration-tests.yml)This template demonstrates a simple chatbot implemented using [LangGraph.js](https://github.com/langchain-ai/langgraphjs), showing how to get started with [LangGraph Server](https://langchain-ai.github.io/langgraph/concepts/langgraph_server/#langgraph-server) and using [LangGraph Studio](https://langchain-ai.github.io/langgraph/concepts/langgraph_studio/), a visual debugging IDE.
![]()
The core logic, defined in `src/agent/graph.ts`, 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. Returns a placeholder response, updating the conversation historyThis template provides a foundation that can be easily customized and extended to create more complex conversational agents.
## Getting Started
1. Install the [LangGraph CLI](https://langchain-ai.github.io/langgraph/concepts/langgraph_cli/).
```bash
npx @langchain/langgraph-cli
```2. Create a `.env` file. While this starter app does not require any secrets, if you later decide to connect to LLM providers and other integrations, you will likely need to provide API keys.
```bash
cp .env.example .env
```3. If desired, add your LangSmith API key in your `.env` file.
```
LANGSMITH_API_KEY=lsv2...
```4. Install dependencies
```
yarn install
```5. Customize the code as needed.
6. Start the LangGraph Server.```bash
npx @langchain/langgraph-cli dev
```For more information on getting started with LangGraph Server, [see here](https://langchain-ai.github.io/langgraph/tutorials/langgraph-platform/local-server/).
## How to customize
1. **Add an LLM call**: You can select and install a chat model wrapper from [the LangChain.js ecosystem](https://js.langchain.com/docs/integrations/chat/), or use LangGraph.js without LangChain.js.
2. **Extend the graph**: The core logic of the chatbot is defined in [graph.ts](./src/agent/graph.ts). You can modify this file to add new nodes, edges, or change the flow of the conversation.You can also extend this template by:
- Adding [custom tools or functions](https://js.langchain.com/docs/how_to/tool_calling) to enhance the chatbot's capabilities.
- Implementing additional logic for handling specific types of user queries or tasks.
- Add retrieval-augmented generation (RAG) capabilities by integrating [external APIs or databases](https://langchain-ai.github.io/langgraphjs/tutorials/rag/langgraph_agentic_rag/) to provide more customized 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.js documentation](https://langchain-ai.github.io/langgraphjs/). 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.