Check an Improve run
const url = 'https://example.com/v1/improve-runs/check';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"agentId":"example","projectId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","tiers":["settings"],"model":{"providerId":"example","model":"example"},"candidates":1,"groupWeights":"as-recorded","objective":"passRate","budget":{"maxCostUsd":1,"maxCandidates":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/improve-runs/check \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "agentId": "example", "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "tiers": [ "settings" ], "model": { "providerId": "example", "model": "example" }, "candidates": 1, "groupWeights": "as-recorded", "objective": "passRate", "budget": { "maxCostUsd": 1, "maxCandidates": 1 } }'Whether the Improve run this input would start is ready, and what it’s estimated to cost, before you start it. The body is the start body of POST /v1/improve-runs. items lists everything an Improve run needs, in a fixed order, missing or not; each missing one says where it’s fixed (repo: in the agent’s code, then a deploy; kindgi: in Kindgi) and how. estimate.costUsd prices each replay at the version’s mean cost over its recent completed runs: the search’s replays at most budget.maxCostUsd, plus the proof’s (estimate.basis.proofReplays), which the budget doesn’t cap. It’s absent when the version has no cost history; estimate.basis gives the inputs. The estimate prices every replay at that one mean, so a candidate whose prompt or settings cost more or less per run isn’t captured, and it leaves out a prompt Improve run’s one-off drafting of its templates: an Improve run can cost more than the estimate. The Improve run checks its cost before each comparison, so the one already running can take it a little over, and its search starts no more once the cost reaches budget.maxCostUsd. It proves its best change after that, uncapped. With an Improve schedule on the agent and project, month is this UTC month’s spend on their Improve runs against the schedule’s monthly cap; only the schedule stops at the cap. It changes nothing (no Improve run starts) and takes no Idempotency-Key. Needs publish on the agent; for an agent more than one project serves, write where its versions are made. Without Improve runs in this runtime, 501 improve-unsupported.
Authorizations
Section titled “Authorizations”Request Bodyrequired
Section titled “Request Bodyrequired”Start an Improve run for an agent in a project, or check one first. It starts from the version the project runs, learns from the project’s corrections, and searches and proves on the project’s test set. A field not listed here is refused (400 bad-input, naming it).
object
Responses
Section titled “Responses”Its readiness, and the estimate.
Whether the Improve run this input would start is ready, and what it’s estimated to cost. It’s ready when no item it needs is missing: with no tiers named, wording or settings is enough; a named tier needs its own.
object
Example
{ "startsFrom": { "follows": "pin" }, "items": [ { "key": "wording", "fix": { "where": "repo" } } ]}Malformed request body (bad-input): no projectId, or a field the body doesn’t have (scope, testSetId and fromVersion among them), named in the message.
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 publish on the agent, or, for an agent more than one project serves, no write on the project its new versions are made in (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" }}The body’s projectId names no project of this workspace, or a deleted one (project-not-found).
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}registry-read-only: the agent registry is read-only and takes no versions an Improve run makes; the message says why.
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”improve-unsupported: this runtime runs no Improve runs.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The authorization store couldn’t be reached (authz-backend-unavailable), or the database was too busy for the authorization check (database-busy), so the request wasn’t run; Retry-After (whole seconds) says when to try again. 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
- Improve an agent
- Kindgi 0.4.0
- Error code
authz-backend-unavailable - Error code
bad-input - Error code
database-busy - Error code
improve-unsupported - Error code
key-project-mismatch - Error code
permission-denied - Error code
project-not-found - Error code
rate-limit-exceeded - Error code
registry-read-only - Error code
request-too-large - Error code
tenant-state-unavailable - Every error code