Skip to main content
This guide shows you how to run a LangGraph application locally.

Prerequisites

Before you begin, ensure you have the following:

1. Install the LangGraph CLI

2. Create a LangGraph app

Create a new app from the new-langgraph-project-js template. This template demonstrates a single-node application you can extend with your own logic.
If you have an existing project with LangGraph agents, you can automatically generate a langgraph.json configuration file using the config command:
This command scans your project for LangGraph agents (such as createAgent(), StateGraph.compile(), or workflow.compile() patterns) and generates a configuration file with all exported agents.Example output:
Only exported agents are included in the configuration. If an agent is not exported, the command will warn you so you can add the export keyword.

3. Install dependencies

In the root of your new LangGraph app, install the dependencies in edit mode so your local changes are used by the server:

4. Create a .env file

You will find a .env.example in the root of your new LangGraph app. Create a .env file in the root of your new LangGraph app and copy the contents of the .env.example file into it, filling in the necessary API keys:

5. Launch Agent server

Start the LangGraph API server locally:
Sample output:
The langgraph dev command starts Agent Server in an in-memory mode. This mode is suitable for development and testing purposes. For production use, deploy Agent Server with access to a persistent storage backend. For more information, see the Platform setup overview.

6. Test your application in Studio

Studio is a specialized UI that you can connect to LangGraph API server to visualize, interact with, and debug your application locally. Test your graph in Studio by visiting the URL provided in the output of the langgraph dev command:
For an Agent Server running on a custom host/port, update the baseUrl query parameter in the URL. For example, if your server is running on http://myhost:3000:
Use the --tunnel flag with your command to create a secure tunnel, as Safari has limitations when connecting to localhost servers:

7. Test the API

  1. Install the LangGraph JS SDK:
  2. Send a message to the assistant (threadless run):

Next steps

Now that you have a LangGraph app running locally, take your journey further by exploring deployment and advanced features: