curl --request POST \
--url https://api.example.com/threads/{thread_id}/runs/stream \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkpoint": {
"thread_id": "<string>",
"checkpoint_ns": "<string>",
"checkpoint_id": "<string>",
"checkpoint_map": {}
},
"input": {},
"command": {
"update": {},
"resume": {},
"goto": {
"node": "<string>",
"input": {}
}
},
"metadata": {},
"config": {
"tags": [
"<string>"
],
"recursion_limit": 123,
"configurable": {}
},
"context": {},
"webhook": "<string>",
"interrupt_before": "*",
"interrupt_after": "*",
"stream_mode": [
"values"
],
"stream_subgraphs": false,
"stream_resumable": false,
"on_disconnect": "cancel",
"feedback_keys": [
"<string>"
],
"multitask_strategy": "enqueue",
"if_not_exists": "reject",
"after_seconds": 123,
"checkpoint_during": false,
"durability": "async"
}
'import requests
url = "https://api.example.com/threads/{thread_id}/runs/stream"
payload = {
"assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkpoint": {
"thread_id": "<string>",
"checkpoint_ns": "<string>",
"checkpoint_id": "<string>",
"checkpoint_map": {}
},
"input": {},
"command": {
"update": {},
"resume": {},
"goto": {
"node": "<string>",
"input": {}
}
},
"metadata": {},
"config": {
"tags": ["<string>"],
"recursion_limit": 123,
"configurable": {}
},
"context": {},
"webhook": "<string>",
"interrupt_before": "*",
"interrupt_after": "*",
"stream_mode": ["values"],
"stream_subgraphs": False,
"stream_resumable": False,
"on_disconnect": "cancel",
"feedback_keys": ["<string>"],
"multitask_strategy": "enqueue",
"if_not_exists": "reject",
"after_seconds": 123,
"checkpoint_during": False,
"durability": "async"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
assistant_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
checkpoint: {
thread_id: '<string>',
checkpoint_ns: '<string>',
checkpoint_id: '<string>',
checkpoint_map: {}
},
input: {},
command: {update: {}, resume: {}, goto: {node: '<string>', input: {}}},
metadata: {},
config: {tags: ['<string>'], recursion_limit: 123, configurable: {}},
context: {},
webhook: '<string>',
interrupt_before: '*',
interrupt_after: '*',
stream_mode: ['values'],
stream_subgraphs: false,
stream_resumable: false,
on_disconnect: 'cancel',
feedback_keys: ['<string>'],
multitask_strategy: 'enqueue',
if_not_exists: 'reject',
after_seconds: 123,
checkpoint_during: false,
durability: 'async'
})
};
fetch('https://api.example.com/threads/{thread_id}/runs/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/threads/{thread_id}/runs/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'assistant_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'checkpoint' => [
'thread_id' => '<string>',
'checkpoint_ns' => '<string>',
'checkpoint_id' => '<string>',
'checkpoint_map' => [
]
],
'input' => [
],
'command' => [
'update' => [
],
'resume' => [
],
'goto' => [
'node' => '<string>',
'input' => [
]
]
],
'metadata' => [
],
'config' => [
'tags' => [
'<string>'
],
'recursion_limit' => 123,
'configurable' => [
]
],
'context' => [
],
'webhook' => '<string>',
'interrupt_before' => '*',
'interrupt_after' => '*',
'stream_mode' => [
'values'
],
'stream_subgraphs' => false,
'stream_resumable' => false,
'on_disconnect' => 'cancel',
'feedback_keys' => [
'<string>'
],
'multitask_strategy' => 'enqueue',
'if_not_exists' => 'reject',
'after_seconds' => 123,
'checkpoint_during' => false,
'durability' => 'async'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/threads/{thread_id}/runs/stream"
payload := strings.NewReader("{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"checkpoint\": {\n \"thread_id\": \"<string>\",\n \"checkpoint_ns\": \"<string>\",\n \"checkpoint_id\": \"<string>\",\n \"checkpoint_map\": {}\n },\n \"input\": {},\n \"command\": {\n \"update\": {},\n \"resume\": {},\n \"goto\": {\n \"node\": \"<string>\",\n \"input\": {}\n }\n },\n \"metadata\": {},\n \"config\": {\n \"tags\": [\n \"<string>\"\n ],\n \"recursion_limit\": 123,\n \"configurable\": {}\n },\n \"context\": {},\n \"webhook\": \"<string>\",\n \"interrupt_before\": \"*\",\n \"interrupt_after\": \"*\",\n \"stream_mode\": [\n \"values\"\n ],\n \"stream_subgraphs\": false,\n \"stream_resumable\": false,\n \"on_disconnect\": \"cancel\",\n \"feedback_keys\": [\n \"<string>\"\n ],\n \"multitask_strategy\": \"enqueue\",\n \"if_not_exists\": \"reject\",\n \"after_seconds\": 123,\n \"checkpoint_during\": false,\n \"durability\": \"async\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/threads/{thread_id}/runs/stream")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"checkpoint\": {\n \"thread_id\": \"<string>\",\n \"checkpoint_ns\": \"<string>\",\n \"checkpoint_id\": \"<string>\",\n \"checkpoint_map\": {}\n },\n \"input\": {},\n \"command\": {\n \"update\": {},\n \"resume\": {},\n \"goto\": {\n \"node\": \"<string>\",\n \"input\": {}\n }\n },\n \"metadata\": {},\n \"config\": {\n \"tags\": [\n \"<string>\"\n ],\n \"recursion_limit\": 123,\n \"configurable\": {}\n },\n \"context\": {},\n \"webhook\": \"<string>\",\n \"interrupt_before\": \"*\",\n \"interrupt_after\": \"*\",\n \"stream_mode\": [\n \"values\"\n ],\n \"stream_subgraphs\": false,\n \"stream_resumable\": false,\n \"on_disconnect\": \"cancel\",\n \"feedback_keys\": [\n \"<string>\"\n ],\n \"multitask_strategy\": \"enqueue\",\n \"if_not_exists\": \"reject\",\n \"after_seconds\": 123,\n \"checkpoint_during\": false,\n \"durability\": \"async\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/threads/{thread_id}/runs/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"checkpoint\": {\n \"thread_id\": \"<string>\",\n \"checkpoint_ns\": \"<string>\",\n \"checkpoint_id\": \"<string>\",\n \"checkpoint_map\": {}\n },\n \"input\": {},\n \"command\": {\n \"update\": {},\n \"resume\": {},\n \"goto\": {\n \"node\": \"<string>\",\n \"input\": {}\n }\n },\n \"metadata\": {},\n \"config\": {\n \"tags\": [\n \"<string>\"\n ],\n \"recursion_limit\": 123,\n \"configurable\": {}\n },\n \"context\": {},\n \"webhook\": \"<string>\",\n \"interrupt_before\": \"*\",\n \"interrupt_after\": \"*\",\n \"stream_mode\": [\n \"values\"\n ],\n \"stream_subgraphs\": false,\n \"stream_resumable\": false,\n \"on_disconnect\": \"cancel\",\n \"feedback_keys\": [\n \"<string>\"\n ],\n \"multitask_strategy\": \"enqueue\",\n \"if_not_exists\": \"reject\",\n \"after_seconds\": 123,\n \"checkpoint_during\": false,\n \"durability\": \"async\"\n}"
response = http.request(request)
puts response.read_body"<string>""<string>""<string>""<string>"Create Run, Stream Output
Create a run in existing thread. Stream the output.
curl --request POST \
--url https://api.example.com/threads/{thread_id}/runs/stream \
--header 'Content-Type: application/json' \
--data '
{
"assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkpoint": {
"thread_id": "<string>",
"checkpoint_ns": "<string>",
"checkpoint_id": "<string>",
"checkpoint_map": {}
},
"input": {},
"command": {
"update": {},
"resume": {},
"goto": {
"node": "<string>",
"input": {}
}
},
"metadata": {},
"config": {
"tags": [
"<string>"
],
"recursion_limit": 123,
"configurable": {}
},
"context": {},
"webhook": "<string>",
"interrupt_before": "*",
"interrupt_after": "*",
"stream_mode": [
"values"
],
"stream_subgraphs": false,
"stream_resumable": false,
"on_disconnect": "cancel",
"feedback_keys": [
"<string>"
],
"multitask_strategy": "enqueue",
"if_not_exists": "reject",
"after_seconds": 123,
"checkpoint_during": false,
"durability": "async"
}
'import requests
url = "https://api.example.com/threads/{thread_id}/runs/stream"
payload = {
"assistant_id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"checkpoint": {
"thread_id": "<string>",
"checkpoint_ns": "<string>",
"checkpoint_id": "<string>",
"checkpoint_map": {}
},
"input": {},
"command": {
"update": {},
"resume": {},
"goto": {
"node": "<string>",
"input": {}
}
},
"metadata": {},
"config": {
"tags": ["<string>"],
"recursion_limit": 123,
"configurable": {}
},
"context": {},
"webhook": "<string>",
"interrupt_before": "*",
"interrupt_after": "*",
"stream_mode": ["values"],
"stream_subgraphs": False,
"stream_resumable": False,
"on_disconnect": "cancel",
"feedback_keys": ["<string>"],
"multitask_strategy": "enqueue",
"if_not_exists": "reject",
"after_seconds": 123,
"checkpoint_during": False,
"durability": "async"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
assistant_id: '3c90c3cc-0d44-4b50-8888-8dd25736052a',
checkpoint: {
thread_id: '<string>',
checkpoint_ns: '<string>',
checkpoint_id: '<string>',
checkpoint_map: {}
},
input: {},
command: {update: {}, resume: {}, goto: {node: '<string>', input: {}}},
metadata: {},
config: {tags: ['<string>'], recursion_limit: 123, configurable: {}},
context: {},
webhook: '<string>',
interrupt_before: '*',
interrupt_after: '*',
stream_mode: ['values'],
stream_subgraphs: false,
stream_resumable: false,
on_disconnect: 'cancel',
feedback_keys: ['<string>'],
multitask_strategy: 'enqueue',
if_not_exists: 'reject',
after_seconds: 123,
checkpoint_during: false,
durability: 'async'
})
};
fetch('https://api.example.com/threads/{thread_id}/runs/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.example.com/threads/{thread_id}/runs/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'assistant_id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'checkpoint' => [
'thread_id' => '<string>',
'checkpoint_ns' => '<string>',
'checkpoint_id' => '<string>',
'checkpoint_map' => [
]
],
'input' => [
],
'command' => [
'update' => [
],
'resume' => [
],
'goto' => [
'node' => '<string>',
'input' => [
]
]
],
'metadata' => [
],
'config' => [
'tags' => [
'<string>'
],
'recursion_limit' => 123,
'configurable' => [
]
],
'context' => [
],
'webhook' => '<string>',
'interrupt_before' => '*',
'interrupt_after' => '*',
'stream_mode' => [
'values'
],
'stream_subgraphs' => false,
'stream_resumable' => false,
'on_disconnect' => 'cancel',
'feedback_keys' => [
'<string>'
],
'multitask_strategy' => 'enqueue',
'if_not_exists' => 'reject',
'after_seconds' => 123,
'checkpoint_during' => false,
'durability' => 'async'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.example.com/threads/{thread_id}/runs/stream"
payload := strings.NewReader("{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"checkpoint\": {\n \"thread_id\": \"<string>\",\n \"checkpoint_ns\": \"<string>\",\n \"checkpoint_id\": \"<string>\",\n \"checkpoint_map\": {}\n },\n \"input\": {},\n \"command\": {\n \"update\": {},\n \"resume\": {},\n \"goto\": {\n \"node\": \"<string>\",\n \"input\": {}\n }\n },\n \"metadata\": {},\n \"config\": {\n \"tags\": [\n \"<string>\"\n ],\n \"recursion_limit\": 123,\n \"configurable\": {}\n },\n \"context\": {},\n \"webhook\": \"<string>\",\n \"interrupt_before\": \"*\",\n \"interrupt_after\": \"*\",\n \"stream_mode\": [\n \"values\"\n ],\n \"stream_subgraphs\": false,\n \"stream_resumable\": false,\n \"on_disconnect\": \"cancel\",\n \"feedback_keys\": [\n \"<string>\"\n ],\n \"multitask_strategy\": \"enqueue\",\n \"if_not_exists\": \"reject\",\n \"after_seconds\": 123,\n \"checkpoint_during\": false,\n \"durability\": \"async\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.example.com/threads/{thread_id}/runs/stream")
.header("Content-Type", "application/json")
.body("{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"checkpoint\": {\n \"thread_id\": \"<string>\",\n \"checkpoint_ns\": \"<string>\",\n \"checkpoint_id\": \"<string>\",\n \"checkpoint_map\": {}\n },\n \"input\": {},\n \"command\": {\n \"update\": {},\n \"resume\": {},\n \"goto\": {\n \"node\": \"<string>\",\n \"input\": {}\n }\n },\n \"metadata\": {},\n \"config\": {\n \"tags\": [\n \"<string>\"\n ],\n \"recursion_limit\": 123,\n \"configurable\": {}\n },\n \"context\": {},\n \"webhook\": \"<string>\",\n \"interrupt_before\": \"*\",\n \"interrupt_after\": \"*\",\n \"stream_mode\": [\n \"values\"\n ],\n \"stream_subgraphs\": false,\n \"stream_resumable\": false,\n \"on_disconnect\": \"cancel\",\n \"feedback_keys\": [\n \"<string>\"\n ],\n \"multitask_strategy\": \"enqueue\",\n \"if_not_exists\": \"reject\",\n \"after_seconds\": 123,\n \"checkpoint_during\": false,\n \"durability\": \"async\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/threads/{thread_id}/runs/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"assistant_id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"checkpoint\": {\n \"thread_id\": \"<string>\",\n \"checkpoint_ns\": \"<string>\",\n \"checkpoint_id\": \"<string>\",\n \"checkpoint_map\": {}\n },\n \"input\": {},\n \"command\": {\n \"update\": {},\n \"resume\": {},\n \"goto\": {\n \"node\": \"<string>\",\n \"input\": {}\n }\n },\n \"metadata\": {},\n \"config\": {\n \"tags\": [\n \"<string>\"\n ],\n \"recursion_limit\": 123,\n \"configurable\": {}\n },\n \"context\": {},\n \"webhook\": \"<string>\",\n \"interrupt_before\": \"*\",\n \"interrupt_after\": \"*\",\n \"stream_mode\": [\n \"values\"\n ],\n \"stream_subgraphs\": false,\n \"stream_resumable\": false,\n \"on_disconnect\": \"cancel\",\n \"feedback_keys\": [\n \"<string>\"\n ],\n \"multitask_strategy\": \"enqueue\",\n \"if_not_exists\": \"reject\",\n \"after_seconds\": 123,\n \"checkpoint_during\": false,\n \"durability\": \"async\"\n}"
response = http.request(request)
puts response.read_body"<string>""<string>""<string>""<string>"Path Parameters
The ID of the thread.
Body
Payload for creating a run.
The assistant ID or graph name to run. If using graph name, will default to first assistant created from that graph.
The checkpoint to resume from.
Show child attributes
Show child attributes
The input to the graph.
The command to run.
Show child attributes
Show child attributes
Metadata to assign to the run.
The configuration for the assistant.
Show child attributes
Show child attributes
Static context added to the assistant.
Webhook to call after LangGraph API call is done.
1 - 65536Nodes to interrupt immediately before they get executed.
* Nodes to interrupt immediately after they get executed.
* The stream mode(s) to use.
values, messages, messages-tuple, tasks, checkpoints, updates, events, debug, custom Whether to stream output from subgraphs.
Whether to persist the stream chunks in order to resume the stream later.
The disconnect mode to use. Must be one of 'cancel' or 'continue'.
cancel, continue Feedback keys to assign to run.
Multitask strategy to use. Must be one of 'reject', 'interrupt', 'rollback', or 'enqueue'.
reject, rollback, interrupt, enqueue How to handle missing thread. Must be either 'reject' (raise error if missing), or 'create' (create new thread).
create, reject The number of seconds to wait before starting the run. Use to schedule future runs.
Whether to checkpoint during the run.
Durability level for the run. Must be one of 'sync', 'async', or 'exit'.
sync, async, exit Response
Success
The server will send a stream of events in SSE format.
Example event:
id: 1
event: message
data: {}
Was this page helpful?