Create Run
curl --request POST \
--url https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"functional_count": 1,
"adversarial_count": 1,
"caller_persona_id": 123,
"max_call_duration_minutes": 3,
"selected_eval_ids": [
123
],
"selected_intent_ids": [
123
],
"simulation_profile_id": 1
}
'import requests
url = "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs"
payload = {
"functional_count": 1,
"adversarial_count": 1,
"caller_persona_id": 123,
"max_call_duration_minutes": 3,
"selected_eval_ids": [123],
"selected_intent_ids": [123],
"simulation_profile_id": 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({
functional_count: 1,
adversarial_count: 1,
caller_persona_id: 123,
max_call_duration_minutes: 3,
selected_eval_ids: [123],
selected_intent_ids: [123],
simulation_profile_id: 1
})
};
fetch('https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs', 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 => "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs",
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([
'functional_count' => 1,
'adversarial_count' => 1,
'caller_persona_id' => 123,
'max_call_duration_minutes' => 3,
'selected_eval_ids' => [
123
],
'selected_intent_ids' => [
123
],
'simulation_profile_id' => 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 := "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs"
payload := strings.NewReader("{\n \"functional_count\": 1,\n \"adversarial_count\": 1,\n \"caller_persona_id\": 123,\n \"max_call_duration_minutes\": 3,\n \"selected_eval_ids\": [\n 123\n ],\n \"selected_intent_ids\": [\n 123\n ],\n \"simulation_profile_id\": 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("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"functional_count\": 1,\n \"adversarial_count\": 1,\n \"caller_persona_id\": 123,\n \"max_call_duration_minutes\": 3,\n \"selected_eval_ids\": [\n 123\n ],\n \"selected_intent_ids\": [\n 123\n ],\n \"simulation_profile_id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs")
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 \"functional_count\": 1,\n \"adversarial_count\": 1,\n \"caller_persona_id\": 123,\n \"max_call_duration_minutes\": 3,\n \"selected_eval_ids\": [\n 123\n ],\n \"selected_intent_ids\": [\n 123\n ],\n \"simulation_profile_id\": 1\n}"
response = http.request(request)
puts response.read_body{
"simulation_run_id": 123,
"generated_count": 123,
"success": true,
"caller_persona_id": 123,
"caller_persona": {
"id": 123,
"name": "<string>",
"language": "<string>",
"language_code": "<string>",
"accent": "<string>",
"label": "<string>",
"country_code": "<string>"
},
"simulation_profile_id": 123,
"simulation_profile_name": "<string>",
"simulation_profile_snapshot": {}
}{
"detail": "Invalid simulation_profile_id or profile does not belong to this agent"
}{
"detail": "Not authenticated"
}{
"detail": "You have no credits remaining."
}{
"detail": "User does not have access to workspace 42"
}{
"detail": "Agent with ID 17 not found"
}{
"detail": "You have a simulation run in progress. Come back later."
}{
"detail": "Agent has no boolean (PASS_FAIL) evals. Add at least one before running a simulation."
}Simulation
Create Run
Start a simulation run for an agent.
Simulations generate synthetic test calls against the agent’s current
configuration and grade them using its PASS_FAIL evals. The agent needs at
least one PASS_FAIL eval configured before a run can start.
Returns immediately with the run in pending state and generated_count of
zero — scenario generation runs asynchronously. Poll List Runs for progress.
POST
/
api
/
v1
/
workspaces
/
{workspace_id}
/
agents
/
{agent_id}
/
simulation-runs
Create Run
curl --request POST \
--url https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"functional_count": 1,
"adversarial_count": 1,
"caller_persona_id": 123,
"max_call_duration_minutes": 3,
"selected_eval_ids": [
123
],
"selected_intent_ids": [
123
],
"simulation_profile_id": 1
}
'import requests
url = "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs"
payload = {
"functional_count": 1,
"adversarial_count": 1,
"caller_persona_id": 123,
"max_call_duration_minutes": 3,
"selected_eval_ids": [123],
"selected_intent_ids": [123],
"simulation_profile_id": 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({
functional_count: 1,
adversarial_count: 1,
caller_persona_id: 123,
max_call_duration_minutes: 3,
selected_eval_ids: [123],
selected_intent_ids: [123],
simulation_profile_id: 1
})
};
fetch('https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs', 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 => "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs",
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([
'functional_count' => 1,
'adversarial_count' => 1,
'caller_persona_id' => 123,
'max_call_duration_minutes' => 3,
'selected_eval_ids' => [
123
],
'selected_intent_ids' => [
123
],
'simulation_profile_id' => 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 := "https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs"
payload := strings.NewReader("{\n \"functional_count\": 1,\n \"adversarial_count\": 1,\n \"caller_persona_id\": 123,\n \"max_call_duration_minutes\": 3,\n \"selected_eval_ids\": [\n 123\n ],\n \"selected_intent_ids\": [\n 123\n ],\n \"simulation_profile_id\": 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("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"functional_count\": 1,\n \"adversarial_count\": 1,\n \"caller_persona_id\": 123,\n \"max_call_duration_minutes\": 3,\n \"selected_eval_ids\": [\n 123\n ],\n \"selected_intent_ids\": [\n 123\n ],\n \"simulation_profile_id\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.usetuner.ai/api/v1/workspaces/{workspace_id}/agents/{agent_id}/simulation-runs")
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 \"functional_count\": 1,\n \"adversarial_count\": 1,\n \"caller_persona_id\": 123,\n \"max_call_duration_minutes\": 3,\n \"selected_eval_ids\": [\n 123\n ],\n \"selected_intent_ids\": [\n 123\n ],\n \"simulation_profile_id\": 1\n}"
response = http.request(request)
puts response.read_body{
"simulation_run_id": 123,
"generated_count": 123,
"success": true,
"caller_persona_id": 123,
"caller_persona": {
"id": 123,
"name": "<string>",
"language": "<string>",
"language_code": "<string>",
"accent": "<string>",
"label": "<string>",
"country_code": "<string>"
},
"simulation_profile_id": 123,
"simulation_profile_name": "<string>",
"simulation_profile_snapshot": {}
}{
"detail": "Invalid simulation_profile_id or profile does not belong to this agent"
}{
"detail": "Not authenticated"
}{
"detail": "You have no credits remaining."
}{
"detail": "User does not have access to workspace 42"
}{
"detail": "Agent with ID 17 not found"
}{
"detail": "You have a simulation run in progress. Come back later."
}{
"detail": "Agent has no boolean (PASS_FAIL) evals. Add at least one before running a simulation."
}Authorizations
Use Tuner API key (tr_api_...) or user session token. Find your API key in Workspace Settings > API Keys.
Path Parameters
Tuner's internal numeric ID for the agent.
Workspace ID. Find this in Workspace > General Settings.
Body
application/json
Required range:
x >= 0Required range:
x >= 0Required range:
1 <= x <= 12Required range:
x > 0Response
Successful Response
Show child attributes
Show child attributes
⌘I