Correct a run
const url = 'https://example.com/v1/corrections';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"}],"correctorGroupId":"example","participantId":"example"}'};
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/corrections \ --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" } ], "correctorGroupId": "example", "participantId": "example" }'Records whether the decisions and answer of a run that completed with an output were right, and what was right instead, optionally under a corrector group that applies to the run’s project or agent (unclassified corrections count with weight 1). Each item’s pointer (a JSON Pointer) must resolve in the run’s output. It’s sorted at save: an end user’s correction stays open and unsorted; decisions: "wrong" goes to the agent’s owner (with-owner); a wrong answer goes to Improve (open); nothing wrong is fixed as recorded-right. The first correction of a run also stores a copy of the run’s input and output. madeBy is the authenticated caller, never the body. A second correction by the same caller for the same run and participantId supersedes the earlier one. Needs write on the run’s project.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”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”Correction recorded.
A person’s correction of one run: whether its decisions (the tool calls) and its answer were right, and what was right instead. It says at least one of decisions, answer and items.
object
Example
{ "subject": { "kind": "agent" }, "decisions": "right", "answer": "right", "items": [ { "verdict": "right" } ], "expert": true, "madeBy": { "kind": "user" }, "status": "open", "sortedTo": "improve", "sorted": { "by": { "kind": "fix-job" } }, "link": { "kind": "improve-run" }, "fixedIn": { "how": "pin", "by": { "kind": "user" } }, "reopenedIn": { "how": "pin", "by": { "kind": "user" } }, "statusNote": { "by": { "kind": "user" } }}Malformed body, or item-not-found (an item’s pointer resolves to nothing in the output), or corrector-group-not-applicable.
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: not allowed to correct this run. corrector-group-not-allowed: the corrector group is restricted (assertableBy) and the caller may not assert it. Without an authorization store, key-project-mismatch (details.keyProjectId, details.projectId): the API key or session is limited to a project, and this acts in another one, the record’s or its agent’s or test set’s (with a store, that is permission-denied, or the record isn’t found).
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 (a person’s words were removed); there’s nothing to correct.
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/corrections: List corrections- Kindgi 0.4.0
- Kindgi 0.6.0
- Error code
authz-backend-unavailable - Error code
corrector-group-not-allowed - Error code
corrector-group-not-applicable - 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