Run a test suite
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"agent_id": "agent_sales_hi"
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs"
payload = { "agent_id": "agent_sales_hi" }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({agent_id: 'agent_sales_hi'})
};
fetch('https://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/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.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/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([
'agent_id' => 'agent_sales_hi'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-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://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs"
payload := strings.NewReader("{\n \"agent_id\": \"agent_sales_hi\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"agent_sales_hi\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"agent_sales_hi\"\n}"
response = http.request(request)
puts response.read_body{
"id": "test_run_01hzyb3c5d6e7f8g9h0j1k2l3m",
"suite_id": "test_suite_01hzy8x2m4q7r8s9t0v1w2x3y4",
"agent_id": "agent_sales_hi",
"status": "pending",
"prompt_fingerprint": "9f2c1a7b4e6d8f0a1b2c3d4e5f607182",
"total_scenarios": 3,
"passed_scenarios": 0,
"pass_rate": null,
"cost_credits": 0,
"temporal_workflow_id": null,
"error": null,
"created_at": "2026-05-22T10:05:00Z",
"updated_at": "2026-05-22T10:05:00Z"
}{
"error": {
"code": "invalid_request",
"message": "Add a persona to scenario 2 before running the suite."
}
}{
"error": {
"code": "insufficient_credits",
"message": "Workspace is out of credits. Add credits before running a test."
}
}{
"error": {
"code": "not_found",
"message": "Test suite not found"
}
}{
"error": {
"code": "service_unavailable",
"message": "Test orchestration is temporarily unavailable. Please try again."
}
}Agent Testing
Run a test suite
Starts a run of the suite against a chosen agent_id and returns immediately with a pending run; the Test Runner executes each scenario in the background (a durable Temporal workflow, or an in-process task when Temporal is disabled) and the dashboard Test Runner polls GET /agent-test-runs/{run_id} for progress and results. Every scenario must have a persona and the workspace must have credits. Scope sessions:write.
POST
/
agent-test-suites
/
{suite_id}
/
runs
Run a test suite
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"agent_id": "agent_sales_hi"
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs"
payload = { "agent_id": "agent_sales_hi" }
headers = {
"X-API-KEY": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-KEY': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({agent_id: 'agent_sales_hi'})
};
fetch('https://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/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.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/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([
'agent_id' => 'agent_sales_hi'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-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://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs"
payload := strings.NewReader("{\n \"agent_id\": \"agent_sales_hi\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-KEY", "<api-key>")
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.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"agent_sales_hi\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/agent-test-suites/{suite_id}/runs")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-KEY"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"agent_id\": \"agent_sales_hi\"\n}"
response = http.request(request)
puts response.read_body{
"id": "test_run_01hzyb3c5d6e7f8g9h0j1k2l3m",
"suite_id": "test_suite_01hzy8x2m4q7r8s9t0v1w2x3y4",
"agent_id": "agent_sales_hi",
"status": "pending",
"prompt_fingerprint": "9f2c1a7b4e6d8f0a1b2c3d4e5f607182",
"total_scenarios": 3,
"passed_scenarios": 0,
"pass_rate": null,
"cost_credits": 0,
"temporal_workflow_id": null,
"error": null,
"created_at": "2026-05-22T10:05:00Z",
"updated_at": "2026-05-22T10:05:00Z"
}{
"error": {
"code": "invalid_request",
"message": "Add a persona to scenario 2 before running the suite."
}
}{
"error": {
"code": "insufficient_credits",
"message": "Workspace is out of credits. Add credits before running a test."
}
}{
"error": {
"code": "not_found",
"message": "Test suite not found"
}
}{
"error": {
"code": "service_unavailable",
"message": "Test orchestration is temporarily unavailable. Please try again."
}
}Authorizations
ApiKeyAuthBearerAuth
Path Parameters
Body
application/json
The agent to run the suite against. Chosen at run time (suites are agent-agnostic); must exist in the workspace.
Response
Run accepted; starts as pending and transitions to running then passed/failed/error. Poll the run to watch progress.

