Suggest a change to a block, for a project
const url = 'https://example.com/v1/suggested-changes';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"agentId":"example","projectId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","block":"example","values":{},"template":"example","why":"example","fixes":["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/suggested-changes \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "agentId": "example", "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "block": "example", "values": {}, "template": "example", "why": "example", "fixes": [ "example" ] }'New settings values or a new prompt template for one block, in what the project runs: its pin, or Latest. Checked as publishing that block version would be (its schema carries over; for the version’s model-settings block, as model settings), and refused when it equals the content the version pins. Then the block version is published, an agent version is derived from what the project runs with that one block changed (it serves nothing until it’s pinned or added as Latest), and the check starts on the project’s test set, frozen now: the new version and what the project runs replay the same cases. The same change on the same version for the same project is one suggested change: answered 200 with X-Suggested-Change-Deduped: true, unchecked again. Under kindgi dev, it’s for the whole workspace (the tenant scope), as an Improve run’s is, and checked in the project the version it’s built on was made in. Needs publish on the agent.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Caller-supplied idempotency key, scoped to the caller: the same key from someone else in the workspace is their own request (from 0.1.5). Retries with the same key return the original response byte-identical (per docs/API-ROUTE-CONVENTIONS.md §3.1). A retry sent while the first request still runs is answered 409 idempotency-key-in-flight with Retry-After, on a runtime whose store holds keys (from 0.1.5); retry after it, and you get the first request’s answer. An answer that carries a secret (a new API key or public run token, a session token, a generated signing secret) isn’t kept: a retry gets 409 idempotency-key-replay-withheld, with the first request’s status and when it succeeded (from 0.1.5). A request whose key store can’t be read before it runs is answered 503 idempotency-store-unavailable with Retry-After: nothing ran, so retry with the same key (from 0.3.0).
Request Bodyrequired
Section titled “Request Bodyrequired”A suggested change by hand: new settings values (values) or a new prompt template (template) for one block, in what the project runs (its pin, or Latest). The same change on the same version for the same project is one suggested change (answered with X-Suggested-Change-Deduped: true).
object
The project it’s for.
The block it changes: one the project’s version of the agent pins.
For a settings block: its new values. They must satisfy the block’s schema, and for the version’s model-settings block, be model settings.
object
For a prompt block: its new template.
The corrections it fixes, by id, at most 100. Each must be a correction in the suggested change’s project: an unknown id, or another project’s, is refused (400 validation-failed, the ids in details.fixes).
Examplegenerated
{ "agentId": "example", "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "block": "example", "values": {}, "template": "example", "why": "example", "fixes": [ "example" ]}Responses
Section titled “Responses”The same suggested change, made before.
A suggested change: one block changed in what a project runs, checked on the project’s test set, then pinned for the project or added as its Latest.
object
The project it’s for. On one made before suggested changes were for a project, its agent version’s project, when known: such a one can only be withdrawn (409 suggested-change-not-for-a-project).
The first line of why, cut at 60 characters, then the change: tone v2 → v3.
Who or what made the suggested change. improve-run: an Improve run (improveRunId, and scheduleId when a schedule started it). person: a person (userId). service: a service account (id). deploy: a deploy, for a project its new version reaches (deploymentId, and who deployed, by). offer: a change pinned in another project, offered to this one (fromProjectId, pinChangeId). One made before this was recorded reads it from its drafter.
object
Who pinned or unpinned: a user, or a service token.
object
The agent version it’s built on: what its project ran when it was made, or when it was last rebuilt (rebuiltAt).
object
Its agent version: what it is built on, with its changes. Absent until it made one. It serves nothing until it is pinned or added as Latest.
One change the suggested change makes. block: a new version of a block its project’s version pins (blockId). from is the block version what it’s built on pins, and to the one it published (absent until it made one). GET /v1/suggested-changes/{suggestedChangeId} adds from’s content as the change was drafted or last rebuilt (before) and the new content (after). code: a deploy’s new agent version, whole (deploymentId, and imageDigest when the deploy named its image by digest), with no content before and after.
object
{ values } for a settings block, { template } for a prompt block.
object
object
{ values } for a settings block, { template } for a prompt block.
object
object
What the change should fix, and why.
The corrections it fixes, by id: the first 100 at most. correctionCount says how many in all.
How many corrections it fixes in all, those fixes names and any past its first 100. Absent from older servers: there, take the length of fixes.
The suggested change’s check: its version (with) and the version it’s built on (now) run the same cases of its project’s test set, frozen when the check started. status: not-started (it never ran), running, done or failed. A check from before suggested changes were for a project compared its version with the recorded outputs only, so it has no now.
object
The test set version its runs ran. Absent until its version ran.
How one version did on the check’s cases: its test run, and once that finished, the corrections it passed (every repetition did) of those it was checked on.
object
What its replays cost in model calls per case, in US dollars, as a decimal string. Absent when the runtime reported no cost.
How one version did on the check’s cases: its test run, and once that finished, the corrections it passed (every repetition did) of those it was checked on.
object
What its replays cost in model calls per case, in US dollars, as a decimal string. Absent when the runtime reported no cost.
Once both runs finished: the corrections now passes and with fails, by id.
Where a suggested change stands, from its check, its pin and its own steps (never stored). checking: its check’s test runs are queued or running. check-failed: its check failed or was cancelled, or never ran (check.status: not-started). ready: its check finished; check says how it did. A pin the gate refused, a second person rejected, or whose approval expired leaves it ready, with a note. waiting-for-second-person: pinned, and the approval (approvalId) is open. pinned: its version was pinned for its project. added-as-latest: its version was added as its project’s Latest. withdrawn: withdrawn.
Why a ready suggested change’s pin didn’t go through: gate-refused, rejected (a second person), expired (the approval), or superseded (its project’s version or release gate changed before the approval). pinChangeId is that pin’s change in the pin history. Or, on a deploy’s suggested change, not-running: the version its project runs (version) isn’t running to be checked against, and has no finished run on the same cases, so its check has no now.
object
Once pinned: its version, who pinned it, and when.
object
Who pinned or unpinned: a user, or a service token.
object
While waiting-for-second-person: the approval the pin waits on.
Once added-as-latest: its version, who added it as its project’s Latest, when, and why when given.
object
Who pinned or unpinned: a user, or a service token.
object
object
Who pinned or unpinned: a user, or a service token.
object
Example
{ "madeBy": { "kind": "improve-run", "by": { "kind": "user" } }, "changes": [ { "kind": "block" } ], "check": { "status": "not-started" }, "status": "checking", "note": { "kind": "gate-refused" }, "pinned": { "by": { "kind": "user" } }, "addedAsLatest": { "by": { "kind": "user" } }, "withdrawn": { "by": { "kind": "user" } }}The suggested change, checking.
A suggested change: one block changed in what a project runs, checked on the project’s test set, then pinned for the project or added as its Latest.
object
The project it’s for. On one made before suggested changes were for a project, its agent version’s project, when known: such a one can only be withdrawn (409 suggested-change-not-for-a-project).
The first line of why, cut at 60 characters, then the change: tone v2 → v3.
Who or what made the suggested change. improve-run: an Improve run (improveRunId, and scheduleId when a schedule started it). person: a person (userId). service: a service account (id). deploy: a deploy, for a project its new version reaches (deploymentId, and who deployed, by). offer: a change pinned in another project, offered to this one (fromProjectId, pinChangeId). One made before this was recorded reads it from its drafter.
object
Who pinned or unpinned: a user, or a service token.
object
The agent version it’s built on: what its project ran when it was made, or when it was last rebuilt (rebuiltAt).
object
Its agent version: what it is built on, with its changes. Absent until it made one. It serves nothing until it is pinned or added as Latest.
One change the suggested change makes. block: a new version of a block its project’s version pins (blockId). from is the block version what it’s built on pins, and to the one it published (absent until it made one). GET /v1/suggested-changes/{suggestedChangeId} adds from’s content as the change was drafted or last rebuilt (before) and the new content (after). code: a deploy’s new agent version, whole (deploymentId, and imageDigest when the deploy named its image by digest), with no content before and after.
object
{ values } for a settings block, { template } for a prompt block.
object
object
{ values } for a settings block, { template } for a prompt block.
object
object
What the change should fix, and why.
The corrections it fixes, by id: the first 100 at most. correctionCount says how many in all.
How many corrections it fixes in all, those fixes names and any past its first 100. Absent from older servers: there, take the length of fixes.
The suggested change’s check: its version (with) and the version it’s built on (now) run the same cases of its project’s test set, frozen when the check started. status: not-started (it never ran), running, done or failed. A check from before suggested changes were for a project compared its version with the recorded outputs only, so it has no now.
object
The test set version its runs ran. Absent until its version ran.
How one version did on the check’s cases: its test run, and once that finished, the corrections it passed (every repetition did) of those it was checked on.
object
What its replays cost in model calls per case, in US dollars, as a decimal string. Absent when the runtime reported no cost.
How one version did on the check’s cases: its test run, and once that finished, the corrections it passed (every repetition did) of those it was checked on.
object
What its replays cost in model calls per case, in US dollars, as a decimal string. Absent when the runtime reported no cost.
Once both runs finished: the corrections now passes and with fails, by id.
Where a suggested change stands, from its check, its pin and its own steps (never stored). checking: its check’s test runs are queued or running. check-failed: its check failed or was cancelled, or never ran (check.status: not-started). ready: its check finished; check says how it did. A pin the gate refused, a second person rejected, or whose approval expired leaves it ready, with a note. waiting-for-second-person: pinned, and the approval (approvalId) is open. pinned: its version was pinned for its project. added-as-latest: its version was added as its project’s Latest. withdrawn: withdrawn.
Why a ready suggested change’s pin didn’t go through: gate-refused, rejected (a second person), expired (the approval), or superseded (its project’s version or release gate changed before the approval). pinChangeId is that pin’s change in the pin history. Or, on a deploy’s suggested change, not-running: the version its project runs (version) isn’t running to be checked against, and has no finished run on the same cases, so its check has no now.
object
Once pinned: its version, who pinned it, and when.
object
Who pinned or unpinned: a user, or a service token.
object
While waiting-for-second-person: the approval the pin waits on.
Once added-as-latest: its version, who added it as its project’s Latest, when, and why when given.
object
Who pinned or unpinned: a user, or a service token.
object
object
Who pinned or unpinned: a user, or a service token.
object
Example
{ "madeBy": { "kind": "improve-run", "by": { "kind": "user" } }, "changes": [ { "kind": "block" } ], "check": { "status": "not-started" }, "status": "checking", "note": { "kind": "gate-refused" }, "pinned": { "by": { "kind": "user" } }, "addedAsLatest": { "by": { "kind": "user" } }, "withdrawn": { "by": { "kind": "user" } }}Malformed request body, or the change fails validation: a block the project’s version doesn’t pin, values for a prompt block or template for a settings block (details.issues). Or reference-out-of-scope: the project doesn’t reach the agent, or the agent’s project doesn’t reach the block (details.issues). Or validation-failed when an id in fixes is no correction in the project: details.fixes lists those ids, and details.issues their places.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Missing / malformed / expired / revoked bearer token.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
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). Or the suggested change is made, but its check didn’t start (details.suggestedChangeId; check it again with POST /v1/suggested-changes/{suggestedChangeId}/check): plan-limit-reached: this adds flows or agents to production past the most this runtime’s license key runs, so none of them is added; what runs keeps running. details has projectId (on a reinstate, when its version records one); over, each count over (flows first) with its limit (flows or agents), the number it adds (adding), and the key’s plan, most and inUse when they count this workspace alone; the first of them again at the top (details.limit, …); newIds, the flows and agents it adds; and next, where a larger plan is, when the runtime names one. Here it’s the agent version a check makes that counts, in the project it’s made in. The suggested change and its edit’s block version are kept, as a failed check keeps them. 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
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}The version the project runs isn’t active (agent-version-not-found), the body’s projectId names no project of this workspace (project-not-found), or a check’s test run couldn’t start (test-set-not-found).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}nothing-runs-in-scope: the project runs no version of the agent. suggested-change-nothing-to-check: the project’s test set has no cases for the agent. environment-takes-promotions: the project is a later environment of its order, where new versions arrive only by promotion (details.position, and details.firstProjectId when you can read it). registry-read-only: the agent registry takes no writes, not even the version a suggested change makes; the message says why. 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
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
The request body is over the API’s limit (request-too-large; details.maxBytes says how much).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}rate-limit-exceeded with details.limit: "schema-compile-time", on a server with a compile budget (Kindgi Cloud): this workspace’s schemas spent details.budgetMs compiling in the last 60 seconds. Nothing was stored; Retry-After says when to send it again. Or 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
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
Server error (unmapped domain code or framework crash).
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}suggested-change-check-unsupported: this runtime doesn’t freeze a project’s test set, so it can’t check a suggested change.
object
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}plan-count-busy (with Retry-After): the suggested change and its edit’s block version are made (details.suggestedChangeId), but counting the flows and agents in production for its check took too long; check it again. Or idempotency-store-unavailable (with Retry-After): the Idempotency-Key store couldn’t be read before the request ran, so nothing was changed. Or the authorization store couldn’t be reached (authz-backend-unavailable, with Retry-After), or the database was too busy for the authorization check (database-busy, with Retry-After), so the request wasn’t run. 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
object
Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).
Optional, kind-specific.
object
Server-assigned request id; also echoed via X-Request-Id header.
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Headers
Section titled “Headers”Whole seconds to wait before sending the request again, at least 1. Sent with the codes the answer names as sending it, so it may be absent.
See also
GET /v1/suggested-changes: List suggested changes- Suggest a change, and test it
- Kindgi 0.4.0
- Error code
agent-version-not-found - Error code
authz-backend-unavailable - Error code
database-busy - Error code
environment-takes-promotions - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
key-project-mismatch - Error code
nothing-runs-in-scope - Error code
permission-denied - Error code
plan-count-busy - Error code
plan-limit-reached - Error code
project-not-found - Error code
rate-limit-exceeded - Error code
reference-out-of-scope - Error code
registry-read-only - Error code
request-too-large - Error code
suggested-change-check-unsupported - Error code
suggested-change-nothing-to-check - Error code
tenant-state-unavailable - Error code
test-set-not-found - Error code
validation-failed - Every error code