Python
# The Replayer reports the run for you and returns Niadra's verdict
run = Replayer(niadra, build_agent, build=BUILD).run(["sc_01J9..."], runs=5, vary=["prompts"])
print(run.verdict) # pass, flaky, regression, pin_mismatch or infrastructure_error// The Replayer reports the run for you and resolves with Niadra's verdict
const run = await new Replayer(niadra, buildAgent, { build: BUILD }).run(["sc_01J9..."], { runs: 5, vary: ["prompts"] });
console.log(run.verdict); // pass, flaky, regression, pin_mismatch or infrastructure_errorcurl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/scenario-runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"build": {
"adapter": "<string>",
"pins": {
"assembler": "<string>",
"corpus_digest": "<string>",
"model": "<string>",
"niadra": {
"compiler": "<string>",
"pack_hash": "<string>"
},
"prompts": {},
"tool_schemas": {}
},
"sdk": "<string>"
},
"results": [
{
"run": 50,
"scenario_id": "<string>",
"turn_id": "<string>",
"assertions": [
{
"id": "<string>",
"detail": "<string>"
}
],
"case_id": "<string>",
"divergent_calls": 0,
"error": "<string>",
"latency_ms": 1,
"paraphrase": false
}
],
"scenario_ids": [
"<string>"
],
"mode": "hermetic_turn",
"runs": 50,
"vary": []
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
build: {
adapter: '<string>',
pins: {
assembler: '<string>',
corpus_digest: '<string>',
model: '<string>',
niadra: {compiler: '<string>', pack_hash: '<string>'},
prompts: {},
tool_schemas: {}
},
sdk: '<string>'
},
results: [
{
run: 50,
scenario_id: '<string>',
turn_id: '<string>',
assertions: [{id: '<string>', detail: '<string>'}],
case_id: '<string>',
divergent_calls: 0,
error: '<string>',
latency_ms: 1,
paraphrase: false
}
],
scenario_ids: ['<string>'],
mode: 'hermetic_turn',
runs: 50,
vary: []
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/scenario-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://{space}.{region}.api.niadra.com/v1/scenario-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([
'build' => [
'adapter' => '<string>',
'pins' => [
'assembler' => '<string>',
'corpus_digest' => '<string>',
'model' => '<string>',
'niadra' => [
'compiler' => '<string>',
'pack_hash' => '<string>'
],
'prompts' => [
],
'tool_schemas' => [
]
],
'sdk' => '<string>'
],
'results' => [
[
'run' => 50,
'scenario_id' => '<string>',
'turn_id' => '<string>',
'assertions' => [
[
'id' => '<string>',
'detail' => '<string>'
]
],
'case_id' => '<string>',
'divergent_calls' => 0,
'error' => '<string>',
'latency_ms' => 1,
'paraphrase' => false
]
],
'scenario_ids' => [
'<string>'
],
'mode' => 'hermetic_turn',
'runs' => 50,
'vary' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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://{space}.{region}.api.niadra.com/v1/scenario-runs"
payload := strings.NewReader("{\n \"build\": {\n \"adapter\": \"<string>\",\n \"pins\": {\n \"assembler\": \"<string>\",\n \"corpus_digest\": \"<string>\",\n \"model\": \"<string>\",\n \"niadra\": {\n \"compiler\": \"<string>\",\n \"pack_hash\": \"<string>\"\n },\n \"prompts\": {},\n \"tool_schemas\": {}\n },\n \"sdk\": \"<string>\"\n },\n \"results\": [\n {\n \"run\": 50,\n \"scenario_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"assertions\": [\n {\n \"id\": \"<string>\",\n \"detail\": \"<string>\"\n }\n ],\n \"case_id\": \"<string>\",\n \"divergent_calls\": 0,\n \"error\": \"<string>\",\n \"latency_ms\": 1,\n \"paraphrase\": false\n }\n ],\n \"scenario_ids\": [\n \"<string>\"\n ],\n \"mode\": \"hermetic_turn\",\n \"runs\": 50,\n \"vary\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://{space}.{region}.api.niadra.com/v1/scenario-runs")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"build\": {\n \"adapter\": \"<string>\",\n \"pins\": {\n \"assembler\": \"<string>\",\n \"corpus_digest\": \"<string>\",\n \"model\": \"<string>\",\n \"niadra\": {\n \"compiler\": \"<string>\",\n \"pack_hash\": \"<string>\"\n },\n \"prompts\": {},\n \"tool_schemas\": {}\n },\n \"sdk\": \"<string>\"\n },\n \"results\": [\n {\n \"run\": 50,\n \"scenario_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"assertions\": [\n {\n \"id\": \"<string>\",\n \"detail\": \"<string>\"\n }\n ],\n \"case_id\": \"<string>\",\n \"divergent_calls\": 0,\n \"error\": \"<string>\",\n \"latency_ms\": 1,\n \"paraphrase\": false\n }\n ],\n \"scenario_ids\": [\n \"<string>\"\n ],\n \"mode\": \"hermetic_turn\",\n \"runs\": 50,\n \"vary\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/scenario-runs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"build\": {\n \"adapter\": \"<string>\",\n \"pins\": {\n \"assembler\": \"<string>\",\n \"corpus_digest\": \"<string>\",\n \"model\": \"<string>\",\n \"niadra\": {\n \"compiler\": \"<string>\",\n \"pack_hash\": \"<string>\"\n },\n \"prompts\": {},\n \"tool_schemas\": {}\n },\n \"sdk\": \"<string>\"\n },\n \"results\": [\n {\n \"run\": 50,\n \"scenario_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"assertions\": [\n {\n \"id\": \"<string>\",\n \"detail\": \"<string>\"\n }\n ],\n \"case_id\": \"<string>\",\n \"divergent_calls\": 0,\n \"error\": \"<string>\",\n \"latency_ms\": 1,\n \"paraphrase\": false\n }\n ],\n \"scenario_ids\": [\n \"<string>\"\n ],\n \"mode\": \"hermetic_turn\",\n \"runs\": 50,\n \"vary\": []\n}"
response = http.request(request)
puts response.read_body{
"build": {
"adapter": "<string>",
"pins": {
"assembler": "<string>",
"corpus_digest": "<string>",
"model": "<string>",
"niadra": {
"compiler": "<string>",
"pack_hash": "<string>"
},
"prompts": {},
"tool_schemas": {}
},
"sdk": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"mode": "hermetic_turn",
"run_id": "<string>",
"status": "pending",
"summary": {
"scenarios": [
{
"assertions": [
{
"baseline_failed": 123,
"baseline_passed": 123,
"drop": 123,
"failed": 123,
"flaky": true,
"id": "<string>",
"not_checked": 123,
"p_value": 123,
"passed": 123,
"regression": true
}
],
"completed": 123,
"infrastructure_errors": 123,
"needs_paraphrase": true,
"pin_mismatches": 123,
"scenario_id": "<string>",
"verdict": "pass",
"baseline_run_id": "<string>"
}
]
},
"vary": [
"prompts"
],
"verdict": "pass"
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Turn records and replay
Report a run
The executions your CI ran; the answer carries the statistical verdict already decided: pass, flaky, regression, pin_mismatch or infrastructure_error.
POST
/
v1
/
scenario-runs
Python
# The Replayer reports the run for you and returns Niadra's verdict
run = Replayer(niadra, build_agent, build=BUILD).run(["sc_01J9..."], runs=5, vary=["prompts"])
print(run.verdict) # pass, flaky, regression, pin_mismatch or infrastructure_error// The Replayer reports the run for you and resolves with Niadra's verdict
const run = await new Replayer(niadra, buildAgent, { build: BUILD }).run(["sc_01J9..."], { runs: 5, vary: ["prompts"] });
console.log(run.verdict); // pass, flaky, regression, pin_mismatch or infrastructure_errorcurl --request POST \
--url https://{space}.{region}.api.niadra.com/v1/scenario-runs \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"build": {
"adapter": "<string>",
"pins": {
"assembler": "<string>",
"corpus_digest": "<string>",
"model": "<string>",
"niadra": {
"compiler": "<string>",
"pack_hash": "<string>"
},
"prompts": {},
"tool_schemas": {}
},
"sdk": "<string>"
},
"results": [
{
"run": 50,
"scenario_id": "<string>",
"turn_id": "<string>",
"assertions": [
{
"id": "<string>",
"detail": "<string>"
}
],
"case_id": "<string>",
"divergent_calls": 0,
"error": "<string>",
"latency_ms": 1,
"paraphrase": false
}
],
"scenario_ids": [
"<string>"
],
"mode": "hermetic_turn",
"runs": 50,
"vary": []
}
'const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
build: {
adapter: '<string>',
pins: {
assembler: '<string>',
corpus_digest: '<string>',
model: '<string>',
niadra: {compiler: '<string>', pack_hash: '<string>'},
prompts: {},
tool_schemas: {}
},
sdk: '<string>'
},
results: [
{
run: 50,
scenario_id: '<string>',
turn_id: '<string>',
assertions: [{id: '<string>', detail: '<string>'}],
case_id: '<string>',
divergent_calls: 0,
error: '<string>',
latency_ms: 1,
paraphrase: false
}
],
scenario_ids: ['<string>'],
mode: 'hermetic_turn',
runs: 50,
vary: []
})
};
fetch('https://{space}.{region}.api.niadra.com/v1/scenario-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://{space}.{region}.api.niadra.com/v1/scenario-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([
'build' => [
'adapter' => '<string>',
'pins' => [
'assembler' => '<string>',
'corpus_digest' => '<string>',
'model' => '<string>',
'niadra' => [
'compiler' => '<string>',
'pack_hash' => '<string>'
],
'prompts' => [
],
'tool_schemas' => [
]
],
'sdk' => '<string>'
],
'results' => [
[
'run' => 50,
'scenario_id' => '<string>',
'turn_id' => '<string>',
'assertions' => [
[
'id' => '<string>',
'detail' => '<string>'
]
],
'case_id' => '<string>',
'divergent_calls' => 0,
'error' => '<string>',
'latency_ms' => 1,
'paraphrase' => false
]
],
'scenario_ids' => [
'<string>'
],
'mode' => 'hermetic_turn',
'runs' => 50,
'vary' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$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://{space}.{region}.api.niadra.com/v1/scenario-runs"
payload := strings.NewReader("{\n \"build\": {\n \"adapter\": \"<string>\",\n \"pins\": {\n \"assembler\": \"<string>\",\n \"corpus_digest\": \"<string>\",\n \"model\": \"<string>\",\n \"niadra\": {\n \"compiler\": \"<string>\",\n \"pack_hash\": \"<string>\"\n },\n \"prompts\": {},\n \"tool_schemas\": {}\n },\n \"sdk\": \"<string>\"\n },\n \"results\": [\n {\n \"run\": 50,\n \"scenario_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"assertions\": [\n {\n \"id\": \"<string>\",\n \"detail\": \"<string>\"\n }\n ],\n \"case_id\": \"<string>\",\n \"divergent_calls\": 0,\n \"error\": \"<string>\",\n \"latency_ms\": 1,\n \"paraphrase\": false\n }\n ],\n \"scenario_ids\": [\n \"<string>\"\n ],\n \"mode\": \"hermetic_turn\",\n \"runs\": 50,\n \"vary\": []\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
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://{space}.{region}.api.niadra.com/v1/scenario-runs")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"build\": {\n \"adapter\": \"<string>\",\n \"pins\": {\n \"assembler\": \"<string>\",\n \"corpus_digest\": \"<string>\",\n \"model\": \"<string>\",\n \"niadra\": {\n \"compiler\": \"<string>\",\n \"pack_hash\": \"<string>\"\n },\n \"prompts\": {},\n \"tool_schemas\": {}\n },\n \"sdk\": \"<string>\"\n },\n \"results\": [\n {\n \"run\": 50,\n \"scenario_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"assertions\": [\n {\n \"id\": \"<string>\",\n \"detail\": \"<string>\"\n }\n ],\n \"case_id\": \"<string>\",\n \"divergent_calls\": 0,\n \"error\": \"<string>\",\n \"latency_ms\": 1,\n \"paraphrase\": false\n }\n ],\n \"scenario_ids\": [\n \"<string>\"\n ],\n \"mode\": \"hermetic_turn\",\n \"runs\": 50,\n \"vary\": []\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{space}.{region}.api.niadra.com/v1/scenario-runs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"build\": {\n \"adapter\": \"<string>\",\n \"pins\": {\n \"assembler\": \"<string>\",\n \"corpus_digest\": \"<string>\",\n \"model\": \"<string>\",\n \"niadra\": {\n \"compiler\": \"<string>\",\n \"pack_hash\": \"<string>\"\n },\n \"prompts\": {},\n \"tool_schemas\": {}\n },\n \"sdk\": \"<string>\"\n },\n \"results\": [\n {\n \"run\": 50,\n \"scenario_id\": \"<string>\",\n \"turn_id\": \"<string>\",\n \"assertions\": [\n {\n \"id\": \"<string>\",\n \"detail\": \"<string>\"\n }\n ],\n \"case_id\": \"<string>\",\n \"divergent_calls\": 0,\n \"error\": \"<string>\",\n \"latency_ms\": 1,\n \"paraphrase\": false\n }\n ],\n \"scenario_ids\": [\n \"<string>\"\n ],\n \"mode\": \"hermetic_turn\",\n \"runs\": 50,\n \"vary\": []\n}"
response = http.request(request)
puts response.read_body{
"build": {
"adapter": "<string>",
"pins": {
"assembler": "<string>",
"corpus_digest": "<string>",
"model": "<string>",
"niadra": {
"compiler": "<string>",
"pack_hash": "<string>"
},
"prompts": {},
"tool_schemas": {}
},
"sdk": "<string>"
},
"created_at": "2023-11-07T05:31:56Z",
"mode": "hermetic_turn",
"run_id": "<string>",
"status": "pending",
"summary": {
"scenarios": [
{
"assertions": [
{
"baseline_failed": 123,
"baseline_passed": 123,
"drop": 123,
"failed": 123,
"flaky": true,
"id": "<string>",
"not_checked": 123,
"p_value": 123,
"passed": 123,
"regression": true
}
],
"completed": 123,
"infrastructure_errors": 123,
"needs_paraphrase": true,
"pin_mismatches": 123,
"scenario_id": "<string>",
"verdict": "pass",
"baseline_run_id": "<string>"
}
]
},
"vary": [
"prompts"
],
"verdict": "pass"
}{
"code": "<string>",
"status": 123,
"title": "<string>",
"detail": "<string>",
"request_id": "<string>",
"type": "about:blank"
}Authorizations
sourceKeypersonToken
nia_sk_...
Headers
Required. Kept 24 hours with the hash of the body: a retry with the same key returns the first answer, and the same key with a different body returns 409 conflict.
Required string length:
1 - 256Body
application/json
What the company's CI reports after running the scenarios N times: the statistics stay with Niadra.
Every pin the recording requires must match each scenario's recorded build, except those in vary.
Show child attributes
Show child attributes
Required array length:
1 - 5000 elementsShow child attributes
Show child attributes
Required array length:
1 - 200 elementsRequired string length:
1 - 512Available options:
hermetic_turn, hermetic_conversation, era_memory Required range:
1 <= x <= 100Maximum array length:
5Available options:
prompts, corpus_digest, model, assembler, tool_schemas Response
The run, with its verdict decided.
Show child attributes
Show child attributes
Available options:
hermetic_turn, hermetic_conversation, era_memory Required string length:
1 - 512Available options:
pending, done Show child attributes
Show child attributes
Available options:
prompts, corpus_digest, model, assembler, tool_schemas The worst of the scenarios' verdicts.
Available options:
pass, flaky, infrastructure_error, pin_mismatch, regression 
