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.agentConfig.resolve('x');
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.agent_config.resolve(
key="x",
)
print(response.data)curl --request POST \
--url https://api.roark.ai/v1/agent-config/{key}/resolve \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"defaults": {
"systemPrompt": "You are a helpful receptionist.",
"model": "gpt-4.1",
"temperature": 0.4
},
"session": {
"sessionId": "<string>",
"callerNumber": "+15551230000",
"calledNumber": "+15559870000"
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/agent-config/{key}/resolve",
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([
'defaults' => [
'systemPrompt' => 'You are a helpful receptionist.',
'model' => 'gpt-4.1',
'temperature' => 0.4
],
'session' => [
'sessionId' => '<string>',
'callerNumber' => '+15551230000',
'calledNumber' => '+15559870000'
]
]),
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/agent-config/{key}/resolve"
payload := strings.NewReader("{\n \"defaults\": {\n \"systemPrompt\": \"You are a helpful receptionist.\",\n \"model\": \"gpt-4.1\",\n \"temperature\": 0.4\n },\n \"session\": {\n \"sessionId\": \"<string>\",\n \"callerNumber\": \"+15551230000\",\n \"calledNumber\": \"+15559870000\"\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/agent-config/{key}/resolve")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"defaults\": {\n \"systemPrompt\": \"You are a helpful receptionist.\",\n \"model\": \"gpt-4.1\",\n \"temperature\": 0.4\n },\n \"session\": {\n \"sessionId\": \"<string>\",\n \"callerNumber\": \"+15551230000\",\n \"calledNumber\": \"+15559870000\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/agent-config/{key}/resolve")
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 \"defaults\": {\n \"systemPrompt\": \"You are a helpful receptionist.\",\n \"model\": \"gpt-4.1\",\n \"temperature\": 0.4\n },\n \"session\": {\n \"sessionId\": \"<string>\",\n \"callerNumber\": \"+15551230000\",\n \"calledNumber\": \"+15559870000\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"key": "<string>",
"channel": "production",
"revisionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document": {},
"simulationJobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"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"
}Resolve config for a session
The call your agent makes at session start. Returns the config JSON for this session, with per-session simulation recognition built in: when the session was originated by a Roark simulation (matched by caller number against the calls Roark has in flight), the STAGING revision is served for that session only, so Autoimprove candidates are tested on your real deployment. Real traffic always resolves to production; any recognition miss degrades to production too.
On the first fetch of an unknown key, pass defaults (your baked-in config): the key is registered and the defaults become revision 1. That makes integration a single call.
Cache the response per session; do not fetch per turn.
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.agentConfig.resolve('x');
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.agent_config.resolve(
key="x",
)
print(response.data)curl --request POST \
--url https://api.roark.ai/v1/agent-config/{key}/resolve \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"defaults": {
"systemPrompt": "You are a helpful receptionist.",
"model": "gpt-4.1",
"temperature": 0.4
},
"session": {
"sessionId": "<string>",
"callerNumber": "+15551230000",
"calledNumber": "+15559870000"
}
}
'<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.roark.ai/v1/agent-config/{key}/resolve",
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([
'defaults' => [
'systemPrompt' => 'You are a helpful receptionist.',
'model' => 'gpt-4.1',
'temperature' => 0.4
],
'session' => [
'sessionId' => '<string>',
'callerNumber' => '+15551230000',
'calledNumber' => '+15559870000'
]
]),
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/agent-config/{key}/resolve"
payload := strings.NewReader("{\n \"defaults\": {\n \"systemPrompt\": \"You are a helpful receptionist.\",\n \"model\": \"gpt-4.1\",\n \"temperature\": 0.4\n },\n \"session\": {\n \"sessionId\": \"<string>\",\n \"callerNumber\": \"+15551230000\",\n \"calledNumber\": \"+15559870000\"\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/agent-config/{key}/resolve")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"defaults\": {\n \"systemPrompt\": \"You are a helpful receptionist.\",\n \"model\": \"gpt-4.1\",\n \"temperature\": 0.4\n },\n \"session\": {\n \"sessionId\": \"<string>\",\n \"callerNumber\": \"+15551230000\",\n \"calledNumber\": \"+15559870000\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.roark.ai/v1/agent-config/{key}/resolve")
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 \"defaults\": {\n \"systemPrompt\": \"You are a helpful receptionist.\",\n \"model\": \"gpt-4.1\",\n \"temperature\": 0.4\n },\n \"session\": {\n \"sessionId\": \"<string>\",\n \"callerNumber\": \"+15551230000\",\n \"calledNumber\": \"+15559870000\"\n }\n}"
response = http.request(request)
puts response.read_body{
"data": {
"key": "<string>",
"channel": "production",
"revisionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"document": {},
"simulationJobId": "3c90c3cc-0d44-4b50-8888-8dd25736052a"
}
}{
"type": "validation",
"code": "invalid_parameter",
"message": "The request was invalid",
"param": "email"
}{
"type": "authentication",
"code": "unauthorized",
"message": "Authentication required"
}{
"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
1 - 120^[A-Za-z0-9][A-Za-z0-9_.-]*$Body
Your baked-in config. On the first fetch of an unknown key this registers the config and becomes revision 1, so integration is a single call. Ignored once the key exists.
Show child attributes
Show child attributes
{ "systemPrompt": "You are a helpful receptionist.", "model": "gpt-4.1", "temperature": 0.4 }
Session context. When the call was originated by a Roark simulation, Roark recognizes it here and serves the staging revision for this session only; real traffic always gets production.
Show child attributes
Show child attributes
Response
The resolved config for this session.
Show child attributes
Show child attributes