import Roark from '@roarkanalytics/sdk';
const client = new Roark({
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});
const response = await client.call.appendToolInvocations('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
toolInvocations: [
{ name: 'name', parameters: { foo: 'string' }, result: 'string', startOffsetMs: 0 },
],
});
console.log(response.data);import os
from roark_analytics import Roark
client = Roark(
bearer_token=os.environ.get("ROARK_API_BEARER_TOKEN"), # This is the default and can be omitted
)
response = client.call.append_tool_invocations(
call_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
tool_invocations=[{
"name": "name",
"parameters": {
"foo": "string",
},
"result": "string",
"start_offset_ms": 0,
}],
)
print(response.data)curl --request POST \
--url https://api.roark.ai/v1/call/{callId}/tool-invocations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"toolInvocations": [
{
"name": "<string>",
"parameters": {},
"result": "<string>",
"startOffsetMs": 1073741823,
"description": "<string>",
"endOffsetMs": 1073741823,
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"metrics": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/call/{callId}/tool-invocations",
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([
'toolInvocations' => [
[
'name' => '<string>',
'parameters' => [
],
'result' => '<string>',
'startOffsetMs' => 1073741823,
'description' => '<string>',
'endOffsetMs' => 1073741823,
'agent' => [
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'customId' => '<string>'
]
]
],
'metrics' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
]),
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 := "https://api.roark.ai/v1/call/{callId}/tool-invocations"
payload := strings.NewReader("{\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startOffsetMs\": 1073741823,\n \"description\": \"<string>\",\n \"endOffsetMs\": 1073741823,\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"metrics\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\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("https://api.roark.ai/v1/call/{callId}/tool-invocations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startOffsetMs\": 1073741823,\n \"description\": \"<string>\",\n \"endOffsetMs\": 1073741823,\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"metrics\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/call/{callId}/tool-invocations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startOffsetMs\": 1073741823,\n \"description\": \"<string>\",\n \"endOffsetMs\": 1073741823,\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"metrics\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"callId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"added": 123,
"skipped": 123,
"metricCollectionJob": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "PENDING",
"triggeredBy": "USER_MANUAL",
"totalItems": 123,
"completedItems": 123,
"failedItems": 123,
"startedAt": "<string>",
"completedAt": "<string>",
"errorMessage": "<string>",
"policyIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "<string>",
"updatedAt": "<string>"
},
"metricCollectionError": "<string>"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"type": "payment_required",
"code": "insufficient_credits",
"message": "Not enough credit to start this work. Add credit and try again."
}{
"type": "forbidden",
"code": "permission_denied",
"message": "You do not have permission to access this resource"
}{
"type": "not_found",
"code": "resource_not_found",
"message": "The requested resource could not be found"
}{
"type": "rate_limit",
"code": "too_many_requests",
"message": "Rate limit exceeded"
}{
"type": "internal",
"code": "internal_error",
"message": "Internal server error"
}Append tool invocations to a call
Attach tool invocations that fired during a call to an already-existing call, asynchronously after the call was created. Use this when the tool-call data becomes available later than the call itself (e.g. a Roark simulation, or a call submitted via POST /v1/call before its tools were ready). Writes are idempotent: re-sending an invocation already present on the call (same tool name and timing) is skipped, so retries converge instead of double-counting. Optionally pass metrics to (re)score metrics over the newly attached tools, which triggers a billed metric collection job and requires the metric:create permission.
import Roark from '@roarkanalytics/sdk';
const client = new Roark({
bearerToken: process.env['ROARK_API_BEARER_TOKEN'], // This is the default and can be omitted
});
const response = await client.call.appendToolInvocations('182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e', {
toolInvocations: [
{ name: 'name', parameters: { foo: 'string' }, result: 'string', startOffsetMs: 0 },
],
});
console.log(response.data);import os
from roark_analytics import Roark
client = Roark(
bearer_token=os.environ.get("ROARK_API_BEARER_TOKEN"), # This is the default and can be omitted
)
response = client.call.append_tool_invocations(
call_id="182bd5e5-6e1a-4fe4-a799-aa6d9a6ab26e",
tool_invocations=[{
"name": "name",
"parameters": {
"foo": "string",
},
"result": "string",
"start_offset_ms": 0,
}],
)
print(response.data)curl --request POST \
--url https://api.roark.ai/v1/call/{callId}/tool-invocations \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"toolInvocations": [
{
"name": "<string>",
"parameters": {},
"result": "<string>",
"startOffsetMs": 1073741823,
"description": "<string>",
"endOffsetMs": 1073741823,
"agent": {
"roarkId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"customId": "<string>"
}
}
],
"metrics": [
{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
]
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/call/{callId}/tool-invocations",
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([
'toolInvocations' => [
[
'name' => '<string>',
'parameters' => [
],
'result' => '<string>',
'startOffsetMs' => 1073741823,
'description' => '<string>',
'endOffsetMs' => 1073741823,
'agent' => [
'roarkId' => '3c90c3cc-0d44-4b50-8888-8dd25736052a',
'customId' => '<string>'
]
]
],
'metrics' => [
[
'id' => '3c90c3cc-0d44-4b50-8888-8dd25736052a'
]
]
]),
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 := "https://api.roark.ai/v1/call/{callId}/tool-invocations"
payload := strings.NewReader("{\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startOffsetMs\": 1073741823,\n \"description\": \"<string>\",\n \"endOffsetMs\": 1073741823,\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"metrics\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\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("https://api.roark.ai/v1/call/{callId}/tool-invocations")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startOffsetMs\": 1073741823,\n \"description\": \"<string>\",\n \"endOffsetMs\": 1073741823,\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"metrics\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/call/{callId}/tool-invocations")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"toolInvocations\": [\n {\n \"name\": \"<string>\",\n \"parameters\": {},\n \"result\": \"<string>\",\n \"startOffsetMs\": 1073741823,\n \"description\": \"<string>\",\n \"endOffsetMs\": 1073741823,\n \"agent\": {\n \"roarkId\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\",\n \"customId\": \"<string>\"\n }\n }\n ],\n \"metrics\": [\n {\n \"id\": \"3c90c3cc-0d44-4b50-8888-8dd25736052a\"\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"data": {
"callId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"added": 123,
"skipped": 123,
"metricCollectionJob": {
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"status": "PENDING",
"triggeredBy": "USER_MANUAL",
"totalItems": 123,
"completedItems": 123,
"failedItems": 123,
"startedAt": "<string>",
"completedAt": "<string>",
"errorMessage": "<string>",
"policyIds": [
"3c90c3cc-0d44-4b50-8888-8dd25736052a"
],
"createdAt": "<string>",
"updatedAt": "<string>"
},
"metricCollectionError": "<string>"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"type": "payment_required",
"code": "insufficient_credits",
"message": "Not enough credit to start this work. Add credit and try again."
}{
"type": "forbidden",
"code": "permission_denied",
"message": "You do not have permission to access this resource"
}{
"type": "not_found",
"code": "resource_not_found",
"message": "The requested resource could not be found"
}{
"type": "rate_limit",
"code": "too_many_requests",
"message": "Rate limit exceeded"
}{
"type": "internal",
"code": "internal_error",
"message": "Internal server error"
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Path Parameters
Body
Attach tool invocations to an existing call, optionally (re)scoring metrics over them.
Tool invocations that fired during the call, to attach to it. Max 500 per request. Re-sending an invocation already present on the call (same tool name and timing) is skipped, so retries are safe.
1 - 500 elementsShow child attributes
Show child attributes
Optional. Metric definitions to (re)score on this call after the tool invocations are attached, e.g. the Tool Invocation Analysis metrics. Triggers a metric collection job (billed, credit-gated) and requires the 'metric:create' permission. Omit to attach tools without scoring. Max 20.
1 - 20 elementsShow child attributes
Show child attributes
Response
Tool invocations attached to the call
Result of appending tool invocations to a call.
Show child attributes
Show child attributes