This guide shows you how to set up and use LangGraph Platform for a cloud deployment.
Prerequisites¶Before you begin, ensure you have the following:
To deploy an application to LangGraph Platform, your application code must reside in a GitHub repository. Both public and private repositories are supported. For this quickstart, use the new-langgraph-project
template for your application:
new-langgraph-project
repository or new-langgraphjs-project
template.Fork
button in the top right corner to fork the repository to your GitHub account.Click Submit to deploy.
This may take about 15 minutes to complete. You can check the status in the Deployment details view.
Once your application is deployed:
Click the LangGraph Studio button in the top right corner.
LangGraph Studio will open to display your graph.
Sample graph run in LangGraph Studio.URL
to copy it to the clipboard.You can now test the API:
Python SDK (Async)Python SDK (Sync)JavaScript SDKRest API
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>/runs/stream \
--header 'Content-Type: application/json' \
--header "X-Api-Key: <LANGSMITH API KEY> \
--data "{
\"assistant_id\": \"agent\",
\"input\": {
\"messages\": [
{
\"role\": \"human\",
\"content\": \"What is LangGraph?\"
}
]
},
\"stream_mode\": \"updates\"
}"
Next steps¶
Congratulations! You have deployed an application using LangGraph Platform.
Here are some other resources to check out:
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4