Add a case to an agent's test set
const url = 'https://example.com/v1/agents/example/test-set/cases';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"runId":"example","decisions":"right","shouldCall":[{"tool":"example","args":{}}],"mustNotCall":["example"],"answer":"right","shouldSay":"example","why":"example","items":[{"key":"example","pointer":"example","rank":1,"verdict":"right"}]}'};
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/agents/example/test-set/cases \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "runId": "example", "decisions": "right", "shouldCall": [ { "tool": "example", "args": {} } ], "mustNotCall": [ "example" ], "answer": "right", "shouldSay": "example", "why": "example", "items": [ { "key": "example", "pointer": "example", "rank": 1, "verdict": "right" } ] }'A case by hand, from a correction’s body on one of the agent’s runs that completed with an output. It has no status, isn’t sorted, and nothing that counts corrections counts it (Improve’s trigger, the expert queue’s progress, a rule’s yes-rate). The run’s first correction or case stores a copy of its input and output. A comparison’s replay can’t be a case. Needs publish on the agent and read on the case’s project; for an agent more than one project serves, write on the case’s project.
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”A correction’s body on one of the agent’s runs. At least one of decisions, answer and items. decisions: "wrong" needs an entry in shouldCall or mustNotCall; answer: "wrong" needs shouldSay or why. A text of only spaces counts as not given.
object
Responses
Section titled “Responses”Case added.
object
Example
{ "kind": "correction", "expect": { "decisions": { "verdict": "right" }, "answer": { "verdict": "right" }, "items": [ { "verdict": "right" } ] }, "addedBy": { "kind": "user" }, "retired": { "by": { "kind": "user" } }, "expert": true}Malformed body; the run isn’t one of the agent’s, or is a comparison’s replay; or item-not-found (an item’s pointer resolves to nothing in the output).
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" }}permission-denied: the caller may not make this change. Without an authorization store, key-project-mismatch (details.keyProjectId): the API key or session is limited to a project, and the change reaches another one the item is in or runs in (details.projectId), or an item of the workspace’s or an org’s (with a store, that is permission-denied).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}run-not-found.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}run-not-finished: the run has no output. It is still going, or it ended without one (failed, cancelled, or completed with none). 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”run-erased: an erasure cleared the run’s content.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}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" }}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" }}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/agents/{agentId}/test-set/cases: List a project's cases of an agent's test setGET /v1/agents/{agentId}: Fetch the highest version of an agentGET /v1/agents/{agentId}/projects: List the projects an agent runs in, and what runs in eachGET /v1/agents/{agentId}/versions: List versions of an agent- Kindgi 0.6.0
- Error code
authz-backend-unavailable - Error code
database-busy - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
item-not-found - Error code
key-project-mismatch - Error code
permission-denied - Error code
rate-limit-exceeded - Error code
request-too-large - Error code
run-erased - Error code
run-not-finished - Error code
run-not-found - Error code
tenant-state-unavailable - Every error code