curl --request POST \
--url https://api.lehar.ai/ca/api/v0/agent-test-suites/generate \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"agent_id": "agent_sales_hi",
"count": 8,
"judges": [
"task_completion",
"safety"
],
"hint": "Focus on price objections and callback scheduling."
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/agent-test-suites/generate"
payload = {
"agent_id": "agent_sales_hi",
"count": 8,
"judges": ["task_completion", "safety"],
"hint": "Focus on price objections and callback scheduling."
}
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',
count: 8,
judges: ['task_completion', 'safety'],
hint: 'Focus on price objections and callback scheduling.'
})
};
fetch('https://api.lehar.ai/ca/api/v0/agent-test-suites/generate', 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/generate",
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',
'count' => 8,
'judges' => [
'task_completion',
'safety'
],
'hint' => 'Focus on price objections and callback scheduling.'
]),
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/generate"
payload := strings.NewReader("{\n \"agent_id\": \"agent_sales_hi\",\n \"count\": 8,\n \"judges\": [\n \"task_completion\",\n \"safety\"\n ],\n \"hint\": \"Focus on price objections and callback scheduling.\"\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/generate")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"agent_sales_hi\",\n \"count\": 8,\n \"judges\": [\n \"task_completion\",\n \"safety\"\n ],\n \"hint\": \"Focus on price objections and callback scheduling.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/agent-test-suites/generate")
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 \"count\": 8,\n \"judges\": [\n \"task_completion\",\n \"safety\"\n ],\n \"hint\": \"Focus on price objections and callback scheduling.\"\n}"
response = http.request(request)
puts response.read_body{
"id": "test_suite_01hzya5f7g8h9j0k1m2n3p4q5r",
"agent_id": "agent_sales_hi",
"name": "Sales Agent — generated",
"scenarios": [
{
"label": "Price objection",
"instructions": "You think the renewal is overpriced and ask for a discount before committing.",
"runs": 1,
"max_turns": 8
},
{
"label": "Busy prospect",
"instructions": "You are short on time and want the agent to get to the point quickly.",
"runs": 1,
"max_turns": 8
}
],
"config": {
"judges": [
"task_completion",
"safety"
],
"variables": {
"callee_name": "",
"company": ""
}
},
"created_by_user_id": "user_01EXAMPLE",
"created_at": "2026-05-22T10:02:00Z",
"updated_at": "2026-05-22T10:02:00Z"
}{
"error": {
"code": "invalid_request",
"message": "agent_id is required"
}
}{
"error": {
"code": "insufficient_credits",
"message": "Workspace is out of credits. Add credits before generating a suite."
}
}{
"error": {
"code": "too_many_requests",
"message": "Scenario generation is rate-limited. Try again shortly."
}
}{
"error": {
"code": "bad_gateway",
"message": "The generator returned no usable scenarios. Try again in a moment."
}
}{
"error": {
"code": "service_unavailable",
"message": "The Test Runner is unreachable — is the test-serve process running?"
}
}{
"error": {
"code": "gateway_timeout",
"message": "Scenario generation timed out. Try again."
}
}Generate a test suite
Auto-generates a suite of persona scenarios for an agent by asking the Test Runner’s scenario generator (grounded in the agent’s prompt and the judge criteria), then persists it as a normal, editable suite. Backs the dashboard Test Runner’s “Generate scenarios” action and consumes credits (metered against the generator model). Scope sessions:write.
curl --request POST \
--url https://api.lehar.ai/ca/api/v0/agent-test-suites/generate \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--data '
{
"agent_id": "agent_sales_hi",
"count": 8,
"judges": [
"task_completion",
"safety"
],
"hint": "Focus on price objections and callback scheduling."
}
'import requests
url = "https://api.lehar.ai/ca/api/v0/agent-test-suites/generate"
payload = {
"agent_id": "agent_sales_hi",
"count": 8,
"judges": ["task_completion", "safety"],
"hint": "Focus on price objections and callback scheduling."
}
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',
count: 8,
judges: ['task_completion', 'safety'],
hint: 'Focus on price objections and callback scheduling.'
})
};
fetch('https://api.lehar.ai/ca/api/v0/agent-test-suites/generate', 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/generate",
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',
'count' => 8,
'judges' => [
'task_completion',
'safety'
],
'hint' => 'Focus on price objections and callback scheduling.'
]),
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/generate"
payload := strings.NewReader("{\n \"agent_id\": \"agent_sales_hi\",\n \"count\": 8,\n \"judges\": [\n \"task_completion\",\n \"safety\"\n ],\n \"hint\": \"Focus on price objections and callback scheduling.\"\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/generate")
.header("X-API-KEY", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"agent_id\": \"agent_sales_hi\",\n \"count\": 8,\n \"judges\": [\n \"task_completion\",\n \"safety\"\n ],\n \"hint\": \"Focus on price objections and callback scheduling.\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lehar.ai/ca/api/v0/agent-test-suites/generate")
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 \"count\": 8,\n \"judges\": [\n \"task_completion\",\n \"safety\"\n ],\n \"hint\": \"Focus on price objections and callback scheduling.\"\n}"
response = http.request(request)
puts response.read_body{
"id": "test_suite_01hzya5f7g8h9j0k1m2n3p4q5r",
"agent_id": "agent_sales_hi",
"name": "Sales Agent — generated",
"scenarios": [
{
"label": "Price objection",
"instructions": "You think the renewal is overpriced and ask for a discount before committing.",
"runs": 1,
"max_turns": 8
},
{
"label": "Busy prospect",
"instructions": "You are short on time and want the agent to get to the point quickly.",
"runs": 1,
"max_turns": 8
}
],
"config": {
"judges": [
"task_completion",
"safety"
],
"variables": {
"callee_name": "",
"company": ""
}
},
"created_by_user_id": "user_01EXAMPLE",
"created_at": "2026-05-22T10:02:00Z",
"updated_at": "2026-05-22T10:02:00Z"
}{
"error": {
"code": "invalid_request",
"message": "agent_id is required"
}
}{
"error": {
"code": "insufficient_credits",
"message": "Workspace is out of credits. Add credits before generating a suite."
}
}{
"error": {
"code": "too_many_requests",
"message": "Scenario generation is rate-limited. Try again shortly."
}
}{
"error": {
"code": "bad_gateway",
"message": "The generator returned no usable scenarios. Try again in a moment."
}
}{
"error": {
"code": "service_unavailable",
"message": "The Test Runner is unreachable — is the test-serve process running?"
}
}{
"error": {
"code": "gateway_timeout",
"message": "Scenario generation timed out. Try again."
}
}Authorizations
Body
Agent to generate scenarios for. Must exist in the workspace.
Judge criteria to ground generation and store on the suite. Defaults to ["task_completion", "tool_use", "safety", "accuracy", "relevancy"].
How many scenarios to generate (clamped to 1-100).
1 <= x <= 100Optional free-text steer for the generator (e.g. focus areas).
Optional suite name; defaults to " — generated" (auto-suffixed to avoid a name collision).
Response
Created (generated) test suite

