Start a test run against a test set
const url = 'https://example.com/v1/test-sets/example/runs';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"projectId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","agentRef":{"agentId":"example","version":"example"},"flowRef":{"flowId":"example","version":"example"},"dryRun":true,"correlationId":"example","baseline":"recorded","reads":"recorded","repetitions":1,"k":1,"versions":{"tools":{"additionalProperty":"example"},"agents":{"additionalProperty":"example"}},"groupWeights":"as-recorded","overrides":{"settings":{"additionalProperty":{}},"prompts":{"additionalProperty":{"template":"example"}}},"sample":{"part":"search","seed":"example","holdOutShare":1}}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://example.com/v1/test-sets/example/runs \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "agentRef": { "agentId": "example", "version": "example" }, "flowRef": { "flowId": "example", "version": "example" }, "dryRun": true, "correlationId": "example", "baseline": "recorded", "reads": "recorded", "repetitions": 1, "k": 1, "versions": { "tools": { "additionalProperty": "example" }, "agents": { "additionalProperty": "example" } }, "groupWeights": "as-recorded", "overrides": { "settings": { "additionalProperty": {} }, "prompts": { "additionalProperty": { "template": "example" } } }, "sample": { "part": "search", "seed": "example", "holdOutShare": 1 } }'Dispatches a test run against the latest version of the test set. An agent’s own test set (agent.<agentId>.<projectId>, read at GET /v1/agents/{agentId}/test-set) is frozen first, as a suggested change’s check freezes it, and the run records the frozen version as testSetVersion; a dry run freezes it too; it runs only its agent, in its project. Exactly one of agentRef / flowRef is required — the subject the test set evaluates. Dispatch is per-kind: accuracy runs the subject once per case and grades via a configured judge; other kinds return 422 dispatcher-not-registered unless the deployment registers a dispatcher for them. Nothing starts in a suspended project (409 project-suspended), and a run going when its project or workspace stops taking new runs ends cancelled at the next case, with the reason in cancelReason. Idempotency-Key applies.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Exactly one of agentRef or flowRef MUST be supplied. dryRun: true returns a plan preview without invoking the subject. For a corrections test set (a test set), the run is a comparison: agentRef or flowRef with its version is the candidate, replayed on each case without doing anything the past run didn’t (a flow stops at a write the replay refuses); baseline (default 'recorded'), reads (default recorded), repetitions (default 1) and k (default 10) set how. With flowRef, versions runs the flow with some of its agents or tools at other versions; an id the flow doesn’t use, or a version that isn’t published, is refused (400 validation-failed, each under details.issues).
object
Responses
Section titled “Responses”Test run started.
object
Examplegenerated
{ "testRunId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "dryRunPreview": {}}Malformed body (both / neither of agentRef / flowRef, dispatcher-input-invalid); or projectId isn’t a project id (a UUID). Or reference-out-of-scope: the test set, the agent or flow, or an agent or tool a flow candidate’s versions names, isn’t registered in projectId’s project, its org or the workspace; or a version named (by agentRef, flowRef or versions.agents) isn’t one projectId’s project runs (details.issues, each at the path it was named, whose message names the version). Or bad-input for an agent’s own test set run with another agent, in another project, or with flowRef: the message names the test set this run’s agent and project have. Nothing runs.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No execute on the test set, or on the agent or flow it runs, or, for one more than one project serves, run in one of its projects, no execute there (call for an agent) in its place; or no write on projectId (permission-denied). Without an authorization store, key-project-mismatch (details.keyProjectId, details.projectId): the API key or session is limited to a project, and this starts work in another one, where the item is, where it runs, where its new versions are made, or where the conversation it continues is (with a store, that is permission-denied).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No test set with that id under this workspace; or projectId names no project of this workspace, or a deleted one (project-not-found).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}project-suspended: the project is suspended, so no test run starts in it. Or suggested-change-nothing-to-check: an agent’s own test set has no cases in the project (details.projectId), as a suggested change’s check answers. Or Idempotency-Key was reused with a different body. Or idempotency-key-in-flight (with Retry-After): a request with the same Idempotency-Key still runs, so this one wasn’t run; send it again after Retry-After to get that request’s answer.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}No dispatcher registered for the test set kind.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded with details.limit: "api-requests", on a runtime that sets workspace limits (Kindgi Cloud): this workspace’s limit on API requests a minute is reached, so the request wasn’t run; Retry-After says when to send it again.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Server error (unmapped domain code or framework crash).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}suggested-change-check-unsupported: an agent’s own test set, on a runtime that doesn’t freeze a project’s test set.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The Idempotency-Key store (idempotency-store-unavailable) or the authorization store (authz-backend-unavailable) couldn’t be reached before the request ran, or the database was too busy for its authorization check (database-busy), so nothing was changed; Retry-After (whole seconds) says when to try again with the same key. Or tenant-state-unavailable (with Retry-After), on a runtime serving many workspaces: the workspace’s state couldn’t be read, so nothing was changed.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”See also
GET /v1/test-sets/{testSetId}: Fetch a test set (latest version)GET /v1/test-sets/{testSetId}/versions: List versions of a test setGET /v1/test-sets/{testSetId}/versions/{version}: Fetch a specific test set versionGET /v1/test-sets/{testSetId}/versions/{version}/cases: List the cases of a corrections test set version- Kindgi 0.4.0
- Error code
authz-backend-unavailable - Error code
bad-input - Error code
database-busy - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
key-project-mismatch - Error code
permission-denied - Error code
project-not-found - Error code
project-suspended - Error code
rate-limit-exceeded - Error code
reference-out-of-scope - Error code
request-too-large - Error code
suggested-change-check-unsupported - Error code
suggested-change-nothing-to-check - Error code
tenant-state-unavailable - Every error code