Streaming runtime
POST
/v1/agents/sessions/{sessionId}/turns/streamPOST
/v1/agents/sessions/{sessionId}/turns/streamYour instance endpoint, shown on the instance page in the dashboard. Each instance has its own host; there is no shared API host.
Parameters
| Name | In | Type | Required | Description |
|---|---|---|---|---|
sessionId | path | string | Yes |
Request Body
| Property | Type | Required | Description |
|---|---|---|---|
tenantId | string | No | |
userInput | string | No | |
enableStreaming | boolean | No | |
enableWebSearch | boolean | No |
Responses
200 Run a turn with streaming events
| Property | Type | Description |
|---|---|---|
result | object | |
error | object |
default An unexpected error response.
| Property | Type | Description |
|---|---|---|
code | integer | |
message | string | |
details | object[] |
Request
curl -X POST "http://localhost:8089/v1/agents/sessions/{sessionId}/turns/stream" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"tenantId":"string","userInput":"string","enableStreaming":true,"enableWebSearch":true}'const response = await fetch("http://localhost:8089/v1/agents/sessions/{sessionId}/turns/stream", {
method: "POST",
headers: {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
body: JSON.stringify({
"tenantId": "string",
"userInput": "string",
"enableStreaming": true,
"enableWebSearch": true
}),
});
const data = await response.json();import requests
response = requests.post(
"http://localhost:8089/v1/agents/sessions/{sessionId}/turns/stream",
headers={
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json",
},
json={
"tenantId": "string",
"userInput": "string",
"enableStreaming": true,
"enableWebSearch": true
},
)
data = response.json()Response
{
"result": {
"type": "string",
"sessionId": "string",
"turnNumber": 0,
"textDelta": "string",
"toolCallId": "string",
"toolName": "string",
"toolArgs": "string",
"toolResult": "string",
"toolSuccess": true,
"toolDurationMs": "string",
"finishReason": "string",
"error": "string",
"promptTokens": 0,
"completionTokens": 0,
"totalTokens": 0,
"turn": {
"id": "string",
"sessionId": "string",
"turnNumber": 0,
"status": "TURN_STATUS_UNSPECIFIED",
"userInput": "string",
"assistantOutput": "string",
"toolCalls": "string",
"promptTokens": 0,
"completionTokens": 0,
"totalTokens": 0,
"latencyMs": "string",
"error": "string",
"createdAt": "2024-01-01T00:00:00Z",
"completedAt": "2024-01-01T00:00:00Z"
},
"reviewId": "string",
"pendingToolCalls": [
{
"toolCallId": "string",
"toolName": "string",
"toolArgs": "string"
}
],
"approvalAction": "string",
"sandboxId": "string",
"sandboxExitCode": 0,
"sandboxDurationMs": "string",
"fallbackFromModel": "string",
"fallbackToModel": "string",
"fallbackAttempt": 0,
"userInputId": "string"
},
"error": {
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}
}{
"code": 0,
"message": "string",
"details": [
{
"@type": "string"
}
]
}
