Read the provider-neutral state of an accepted channel turn
curl --request POST \
--url http://localhost:3000/api/v1/channels/backend/runtime/readback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "<string>",
"request": {
"binding": {
"agentId": "<string>",
"channelInstanceId": "<string>",
"chatId": "<string>",
"messageId": "<string>",
"sessionId": "<string>",
"turnId": "<string>"
},
"protocol": "ravi.channel.runtime-events",
"requestId": "<string>",
"schemaVersion": 1
}
}
'import requests
url = "http://localhost:3000/api/v1/channels/backend/runtime/readback"
payload = {
"agentId": "<string>",
"request": {
"binding": {
"agentId": "<string>",
"channelInstanceId": "<string>",
"chatId": "<string>",
"messageId": "<string>",
"sessionId": "<string>",
"turnId": "<string>"
},
"protocol": "ravi.channel.runtime-events",
"requestId": "<string>",
"schemaVersion": 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({
agentId: '<string>',
request: {
binding: {
agentId: '<string>',
channelInstanceId: '<string>',
chatId: '<string>',
messageId: '<string>',
sessionId: '<string>',
turnId: '<string>'
},
protocol: 'ravi.channel.runtime-events',
requestId: '<string>',
schemaVersion: 1
}
})
};
fetch('http://localhost:3000/api/v1/channels/backend/runtime/readback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/v1/channels/backend/runtime/readback",
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([
'agentId' => '<string>',
'request' => [
'binding' => [
'agentId' => '<string>',
'channelInstanceId' => '<string>',
'chatId' => '<string>',
'messageId' => '<string>',
'sessionId' => '<string>',
'turnId' => '<string>'
],
'protocol' => 'ravi.channel.runtime-events',
'requestId' => '<string>',
'schemaVersion' => 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 := "http://localhost:3000/api/v1/channels/backend/runtime/readback"
payload := strings.NewReader("{\n \"agentId\": \"<string>\",\n \"request\": {\n \"binding\": {\n \"agentId\": \"<string>\",\n \"channelInstanceId\": \"<string>\",\n \"chatId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"turnId\": \"<string>\"\n },\n \"protocol\": \"ravi.channel.runtime-events\",\n \"requestId\": \"<string>\",\n \"schemaVersion\": 1\n }\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("http://localhost:3000/api/v1/channels/backend/runtime/readback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"<string>\",\n \"request\": {\n \"binding\": {\n \"agentId\": \"<string>\",\n \"channelInstanceId\": \"<string>\",\n \"chatId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"turnId\": \"<string>\"\n },\n \"protocol\": \"ravi.channel.runtime-events\",\n \"requestId\": \"<string>\",\n \"schemaVersion\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/channels/backend/runtime/readback")
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 \"agentId\": \"<string>\",\n \"request\": {\n \"binding\": {\n \"agentId\": \"<string>\",\n \"channelInstanceId\": \"<string>\",\n \"chatId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"turnId\": \"<string>\"\n },\n \"protocol\": \"ravi.channel.runtime-events\",\n \"requestId\": \"<string>\",\n \"schemaVersion\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"binding": {
"agentId": "<string>",
"channelInstanceId": "<string>",
"chatId": "<string>",
"messageId": "<string>",
"sessionId": "<string>",
"turnId": "<string>"
},
"lastSequence": 4503599627370495,
"observedAt": "2023-11-07T05:31:56Z",
"protocol": "ravi.channel.runtime-events",
"requestId": "<string>",
"schemaVersion": 1,
"state": "accepted",
"assistantMessageId": "<string>",
"lastEventRuntimeGenerationId": "<string>",
"runtimeGenerationId": "<string>",
"terminalEvent": {
"correlation": {
"binding": {
"agentId": "<string>",
"channelInstanceId": "<string>",
"chatId": "<string>",
"messageId": "<string>",
"sessionId": "<string>",
"turnId": "<string>"
},
"correlationId": "<string>",
"ingressRequestId": "<string>",
"causationId": "<string>"
},
"eventId": "<string>",
"kind": "turn.terminal_output",
"occurredAt": "2023-11-07T05:31:56Z",
"payload": {
"state": "completed",
"assistantMessageId": "<string>",
"content": [
{
"text": "<string>",
"type": "text"
}
],
"error": {
"category": "validation",
"code": "INVALID_REQUEST",
"retryable": true,
"correlationId": "<string>",
"retryAfterMs": 123
}
},
"protocol": "ravi.channel.runtime-events",
"schemaVersion": 1,
"sequence": 4503599627370495
}
}channels
Read the provider-neutral state of an accepted channel turn
POST
/
api
/
v1
/
channels
/
backend
/
runtime
/
readback
Read the provider-neutral state of an accepted channel turn
curl --request POST \
--url http://localhost:3000/api/v1/channels/backend/runtime/readback \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"agentId": "<string>",
"request": {
"binding": {
"agentId": "<string>",
"channelInstanceId": "<string>",
"chatId": "<string>",
"messageId": "<string>",
"sessionId": "<string>",
"turnId": "<string>"
},
"protocol": "ravi.channel.runtime-events",
"requestId": "<string>",
"schemaVersion": 1
}
}
'import requests
url = "http://localhost:3000/api/v1/channels/backend/runtime/readback"
payload = {
"agentId": "<string>",
"request": {
"binding": {
"agentId": "<string>",
"channelInstanceId": "<string>",
"chatId": "<string>",
"messageId": "<string>",
"sessionId": "<string>",
"turnId": "<string>"
},
"protocol": "ravi.channel.runtime-events",
"requestId": "<string>",
"schemaVersion": 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({
agentId: '<string>',
request: {
binding: {
agentId: '<string>',
channelInstanceId: '<string>',
chatId: '<string>',
messageId: '<string>',
sessionId: '<string>',
turnId: '<string>'
},
protocol: 'ravi.channel.runtime-events',
requestId: '<string>',
schemaVersion: 1
}
})
};
fetch('http://localhost:3000/api/v1/channels/backend/runtime/readback', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_PORT => "3000",
CURLOPT_URL => "http://localhost:3000/api/v1/channels/backend/runtime/readback",
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([
'agentId' => '<string>',
'request' => [
'binding' => [
'agentId' => '<string>',
'channelInstanceId' => '<string>',
'chatId' => '<string>',
'messageId' => '<string>',
'sessionId' => '<string>',
'turnId' => '<string>'
],
'protocol' => 'ravi.channel.runtime-events',
'requestId' => '<string>',
'schemaVersion' => 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 := "http://localhost:3000/api/v1/channels/backend/runtime/readback"
payload := strings.NewReader("{\n \"agentId\": \"<string>\",\n \"request\": {\n \"binding\": {\n \"agentId\": \"<string>\",\n \"channelInstanceId\": \"<string>\",\n \"chatId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"turnId\": \"<string>\"\n },\n \"protocol\": \"ravi.channel.runtime-events\",\n \"requestId\": \"<string>\",\n \"schemaVersion\": 1\n }\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("http://localhost:3000/api/v1/channels/backend/runtime/readback")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"agentId\": \"<string>\",\n \"request\": {\n \"binding\": {\n \"agentId\": \"<string>\",\n \"channelInstanceId\": \"<string>\",\n \"chatId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"turnId\": \"<string>\"\n },\n \"protocol\": \"ravi.channel.runtime-events\",\n \"requestId\": \"<string>\",\n \"schemaVersion\": 1\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("http://localhost:3000/api/v1/channels/backend/runtime/readback")
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 \"agentId\": \"<string>\",\n \"request\": {\n \"binding\": {\n \"agentId\": \"<string>\",\n \"channelInstanceId\": \"<string>\",\n \"chatId\": \"<string>\",\n \"messageId\": \"<string>\",\n \"sessionId\": \"<string>\",\n \"turnId\": \"<string>\"\n },\n \"protocol\": \"ravi.channel.runtime-events\",\n \"requestId\": \"<string>\",\n \"schemaVersion\": 1\n }\n}"
response = http.request(request)
puts response.read_body{
"binding": {
"agentId": "<string>",
"channelInstanceId": "<string>",
"chatId": "<string>",
"messageId": "<string>",
"sessionId": "<string>",
"turnId": "<string>"
},
"lastSequence": 4503599627370495,
"observedAt": "2023-11-07T05:31:56Z",
"protocol": "ravi.channel.runtime-events",
"requestId": "<string>",
"schemaVersion": 1,
"state": "accepted",
"assistantMessageId": "<string>",
"lastEventRuntimeGenerationId": "<string>",
"runtimeGenerationId": "<string>",
"terminalEvent": {
"correlation": {
"binding": {
"agentId": "<string>",
"channelInstanceId": "<string>",
"chatId": "<string>",
"messageId": "<string>",
"sessionId": "<string>",
"turnId": "<string>"
},
"correlationId": "<string>",
"ingressRequestId": "<string>",
"causationId": "<string>"
},
"eventId": "<string>",
"kind": "turn.terminal_output",
"occurredAt": "2023-11-07T05:31:56Z",
"payload": {
"state": "completed",
"assistantMessageId": "<string>",
"content": [
{
"text": "<string>",
"type": "text"
}
],
"error": {
"category": "validation",
"code": "INVALID_REQUEST",
"retryable": true,
"correlationId": "<string>",
"retryAfterMs": 123
}
},
"protocol": "ravi.channel.runtime-events",
"schemaVersion": 1,
"sequence": 4503599627370495
}
}Authorizations
Runtime context-key (rctx_*) issued by the Ravi gateway. Required for every non-open scope. Bootstrap the first key with ravi daemon init-admin-key; rotate, derive, and revoke via the ravi context family. Specs: runtime/context-keys, sdk/auth.
Body
application/json
Response
Success — body conforms to the @Returns schema.
Show child attributes
Show child attributes
Required range:
0 <= x <= 9007199254740991Pattern:
^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z|([+-](?:[01]\d|2[0-3]):[0-5]\d)))$Allowed value:
"ravi.channel.runtime-events"Pattern:
^[A-Za-z0-9][A-Za-z0-9._~-]*$Available options:
accepted, running, waiting_approval, completed, failed, interrupted Pattern:
^[A-Za-z0-9][A-Za-z0-9._~-]*$Pattern:
^[A-Za-z0-9][A-Za-z0-9._~-]*$Pattern:
^[A-Za-z0-9][A-Za-z0-9._~-]*$Show child attributes
Show child attributes