Deployment
When you are ready to deploy your LangGraph agent to production, choose a hosting model that fits your stack. LangSmith Cloud provides fully managed infrastructure for stateful, long-running agents with persistent state and background execution.
LangSmith offers multiple deployment options beyond Cloud, including hybrid, standalone servers, and self-hosted with control plane. For more information, see the LangSmith Deployment overview.
LangSmith Cloud
This section walks through deploying your agent to LangSmith Cloud from a GitHub repository. LangSmith handles infrastructure, scaling, and operational concerns.
Prerequisites
Before you begin, ensure you have the following:
- A GitHub account (opens in a new tab)
- A LangSmith account (opens in a new tab) (free to sign up)
Deploy your agent
1. Create a repository on GitHub
Your application's code must reside in a GitHub repository to be deployed on LangSmith. Both public and private repositories are supported. For this quickstart, first make sure your app is LangGraph-compatible by following the local server setup guide (opens in a new tab). Then, push your code to the repository.
2. Deploy to LangSmith
Log in to [LangSmith](https://smith.langchain.com). In the left sidebar, select **Deployments**.
Click the **+ New Deployment** button. A pane will open where you can fill in the required fields.
If you are a first time user or adding a private repository that has not been previously connected, click the **Add new account** button and follow the instructions to connect your GitHub account.
Select your application's repository. Click **Submit** to deploy. This may take about 15 minutes to complete. You can check the status in the **Deployment details** view.3. Test your application in Studio
Once your application is deployed:
- Select the deployment you just created to view more details.
- Click the Studio button in the top right corner. Studio will open to display your graph.
4. Get the API URL for your deployment
- In the Deployment details view in LangGraph, click the API URL to copy it to your clipboard.
- Click the
URLto copy it to the clipboard.
5. Test the API
You can now test the API:
Python
- Install LangGraph SDK:
pip install langgraph-sdk- Send a message to the agent:
from langgraph_sdk import get_sync_client # or get_client for async
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 agent. 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")Rest API
curl -s --request POST \
--url /runs/stream \
--header 'Content-Type: application/json' \
--header "X-Api-Key: \
--data "{
\"assistant_id\": \"agent\", `# Name of agent. Defined in langgraph.json.`
\"input\": {
\"messages\": [
{
\"role\": \"human\",
\"content\": \"What is LangGraph?\"
}
]
},
\"stream_mode\": \"updates\"
}"