Subscribe to a running turn
curl --request POST \
--url {scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"after_sequence_number": 1
}
'import requests
url = "{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe"
payload = { "after_sequence_number": 1 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({after_sequence_number: 1})
};
fetch('{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe', 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 => "{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe",
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([
'after_sequence_number' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe"
payload := strings.NewReader("{\n \"after_sequence_number\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"after_sequence_number\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"after_sequence_number\": 1\n}"
response = http.request(request)
puts response.read_body{
"type": "model.message",
"id": "<string>",
"thread_id": "<string>",
"created_at": "<string>",
"content": "<string>",
"name": "<string>",
"refusal": "<string>",
"reasoning_content": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
},
"tool_info": {
"type": "truefoundry-system",
"name": "<string>"
},
"provider_specific_fields": {}
}
],
"usage": {
"input_tokens": 1,
"output_tokens": 1,
"input_tokens_breakdown": {
"harness": 1,
"skills": 1,
"instructions": 1,
"tool_definitions": 1,
"messages": 1
},
"cache_read_tokens": 1,
"cache_write_tokens": 1
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Agent Harness
Subscribe to a running turn
Subscribe to the live SSE stream for a turn. Pass after_sequence_number to resume after disconnect or server timeout, or send Last-Event-Id when after_sequence_number is omitted.
POST
/
v1
/
agents
/
sessions
/
{sessionId}
/
turns
/
{turnId}
/
subscribe
Subscribe to a running turn
curl --request POST \
--url {scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"after_sequence_number": 1
}
'import requests
url = "{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe"
payload = { "after_sequence_number": 1 }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({after_sequence_number: 1})
};
fetch('{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe', 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 => "{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe",
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([
'after_sequence_number' => 1
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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 := "{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe"
payload := strings.NewReader("{\n \"after_sequence_number\": 1\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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("{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"after_sequence_number\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("{scheme}://{gatewayBaseURL}/{tenantName}/v1/agents/sessions/{sessionId}/turns/{turnId}/subscribe")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"after_sequence_number\": 1\n}"
response = http.request(request)
puts response.read_body{
"type": "model.message",
"id": "<string>",
"thread_id": "<string>",
"created_at": "<string>",
"content": "<string>",
"name": "<string>",
"refusal": "<string>",
"reasoning_content": "<string>",
"tool_calls": [
{
"id": "<string>",
"type": "function",
"function": {
"name": "<string>",
"arguments": "<string>"
},
"tool_info": {
"type": "truefoundry-system",
"name": "<string>"
},
"provider_specific_fields": {}
}
],
"usage": {
"input_tokens": 1,
"output_tokens": 1,
"input_tokens_breakdown": {
"harness": 1,
"skills": 1,
"instructions": 1,
"tool_definitions": 1,
"messages": 1
},
"cache_read_tokens": 1,
"cache_write_tokens": 1
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "<string>",
"param": "<string>"
}
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Session identifier (.).
Minimum string length:
1Example:
"01arz3ndektsv4rrffq69g5fav.g"
Turn identifier (..).
Minimum string length:
1Example:
"01arz3ndektsv4rrffq69g5fav.g.ab12cd"
Body
application/json
Optional after_sequence_number to resume from (exclusive — events after this sequence_number). When omitted, Last-Event-Id is used if present.
Required range:
x >= 0Response
Server-Sent Events stream of turn events (deltas and lifecycle).
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
Available options:
model.message Unique identifier for the event
Show child attributes
Show child attributes
Available options:
stop, length, tool_calls, content_filter, function_call Show child attributes
Show child attributes
Was this page helpful?
⌘I