Skip to content

Quickstart: Deploy on LangGraph Cloud

Prerequisites

Before you begin, ensure you have the following:

Create a repository on GitHub

To deploy a LangGraph application to LangGraph Cloud, your application code must reside in a GitHub repository. Both public and private repositories are supported.

You can deploy any LangGraph Application to LangGraph Cloud.

For this guide, we'll use the pre-built Python ReAct Agent template.

Get Required API Keys for the ReAct Agent template

This ReAct Agent application requires an API key from Anthropic and Tavily. You can get these API keys by signing up on their respective websites.

Alternative: If you'd prefer a scaffold application that doesn't require API keys, use the New LangGraph Project template instead of the ReAct Agent template.

  1. Go to the ReAct Agent repository.
  2. Fork the repository to your GitHub account by clicking the Fork button in the top right corner.

Deploy to LangGraph Cloud

1. Log in to LangSmith

Login to LangSmith
Go to LangSmith and log in. If you don't have an account, you can sign up for free.

2. Click on LangGraph Platform (the left sidebar)

Login to LangSmith
Select LangGraph Platform from the left sidebar.

3. Click on + New Deployment (top right corner)

Login to LangSmith
Click on + New Deployment to create a new deployment. This button is located in the top right corner. It'll open a new modal where you can fill out the required fields.

4. Click on Import from GitHub (first time users)

image
Click on Import from GitHub and follow the instructions to connect your GitHub account. This step is needed for first-time users or to add private repositories that haven't been connected before.

5. Select the repository, configure ENV vars etc

image
Select the repository, add env variables and secrets, and set other configuration options.

  • Repository: Select the repository you forked earlier (or any other repository you want to deploy).
  • Set the secrets and environment variables required by your application. For the ReAct Agent template, you need to set the following secrets:
6. Click Submit to Deploy!

image
Please note that this step may ~15 minutes to complete. You can check the status of your deployment in the Deployments view. Click the Submit button at the top right corner to deploy your application.

Lagraph Studio Web UI

Once your application is deployed, you can test it in LangGraph Studio.

1. Click on an existing deployment

image
Click on the deployment you just created to view more details.

2. Click on LangGraph Studio

image
Click on the LangGraph Studio button to open LangGraph Studio.

image

Sample graph run in LangGraph Studio.

Test the API

Note

The API calls below are for the ReAct Agent template. If you're deploying a different application, you may need to adjust the API calls accordingly.

Before using, you need to get the URL of your LangGraph deployment. You can find this in the Deployment view. Click the URL to copy it to the clipboard.

You also need to make sure you have set up your API key properly, so you can authenticate with LangGraph Cloud.

export LANGSMITH_API_KEY=...

Install the LangGraph Python SDK

pip install langgraph-sdk

Send a message to the assistant (threadless run)

from langgraph_sdk import get_client

client = get_client(url="your-deployment-url", api_key="your-langsmith-api-key")

async for chunk in client.runs.stream(
    None,  # Threadless run
    "agent", # Name of assistant. Defined in langgraph.json.
    input={
        "messages": [{
            "role": "human",
            "content": "What is LangGraph?",
        }],
    },
    stream_mode="updates",
):
    print(f"Receiving new event of type: {chunk.event}...")
    print(chunk.data)
    print("\n\n")

Install the LangGraph Python SDK

pip install langgraph-sdk

Send a message to the assistant (threadless run)

from langgraph_sdk import get_sync_client

client = get_sync_client(url="your-deployment-url", api_key="your-langsmith-api-key")

for chunk in client.runs.stream(
    None,  # Threadless run
    "agent", # Name of assistant. Defined in langgraph.json.
    input={
        "messages": [{
            "role": "human",
            "content": "What is LangGraph?",
        }],
    },
    stream_mode="updates",
):
    print(f"Receiving new event of type: {chunk.event}...")
    print(chunk.data)
    print("\n\n")

Install the LangGraph JS SDK

npm install @langchain/langgraph-sdk

Send a message to the assistant (threadless run)

const { Client } = await import("@langchain/langgraph-sdk");

const client = new Client({ apiUrl: "your-deployment-url", apiKey: "your-langsmith-api-key" });

const streamResponse = client.runs.stream(
    null, // Threadless run
    "agent", // Assistant ID
    {
        input: {
            "messages": [
                { "role": "user", "content": "What is LangGraph?"}
            ]
        },
        streamMode: "messages",
    }
);

for await (const chunk of streamResponse) {
    console.log(`Receiving new event of type: ${chunk.event}...`);
    console.log(JSON.stringify(chunk.data));
    console.log("\n\n");
}
curl -s --request POST \
    --url <DEPLOYMENT_URL> \
    --header 'Content-Type: application/json' \
    --data "{
        \"assistant_id\": \"agent\",
        \"input\": {
            \"messages\": [
                {
                    \"role\": \"human\",
                    \"content\": \"What is LangGraph?\"
                }
            ]
        },
        \"stream_mode\": \"updates\"
    }" 

Next Steps

Congratulations! If you've worked your way through this tutorial you are well on your way to becoming a LangGraph Cloud expert. Here are some other resources to check out to help you out on the path to expertise:

LangGraph Framework

📚 Learn More about LangGraph Platform

Expand your knowledge with these resources:

Comments