Start a run
const url = 'https://example.com/v1/runs';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"agent":"example","agentVersion":"example","projectId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","segments":[{"key":"example","value":"example"}],"input":"example","options":{"dryRun":true,"wait":true}}'};
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/runs \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "agent": "example", "agentVersion": "example", "projectId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "segments": [ { "key": "example", "value": "example" } ], "input": "example", "options": { "dryRun": true, "wait": true } }'One primitive, discriminated subject (agent XOR flow). When the deployment issues public run tokens, the response carries publicAccessToken: a read-only token for this run (15 minutes by default) to hand to a browser, which follows the run with it on GET /v1/runs/{runId}/progress and its stream.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Header Parameters
Section titled “Header Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”Responses
Section titled “Responses”Run finished, failed or suspended; or still running when a read failed part-way (it goes on at a later resume: poll GET /v1/runs/{runId}).
object
Example
{ "flowVersionVia": "explicit", "flowPinnedScope": { "kind": "tenant" }, "status": "pending", "agent": { "via": "explicit", "pinnedScope": { "kind": "tenant" } }, "waitingFor": { "approvals": [ { "approver": { "kind": "member" }, "connection": { "as": "company" } } ], "other": [ { "what": "child-run" } ] }, "trigger": { "kind": "schedule" }, "startedBy": "person"}Run started (options.wait: false); poll GET /v1/runs/{runId}.
object
Example
{ "flowVersionVia": "explicit", "flowPinnedScope": { "kind": "tenant" }, "status": "pending", "agent": { "via": "explicit", "pinnedScope": { "kind": "tenant" } }, "waitingFor": { "approvals": [ { "approver": { "kind": "member" }, "connection": { "as": "company" } } ], "other": [ { "what": "child-run" } ] }, "trigger": { "kind": "schedule" }, "startedBy": "person"}Malformed request body, or the body’s projectId isn’t a project id (a UUID). Or reference-out-of-scope: the agent or flow isn’t registered in the named projectId’s project, its org or the workspace (details.issues).
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 agent or flow; or, for one more than one project serves run in one of its projects (the one named, else the conversation’s, else a project-scoped key’s when it is one of them, else its first), no call there for an agent (caller or editor) or execute there for a flow (executor or editor), asked in place of its own execute and of write on a named project; otherwise, naming a projectId without write on it; or a turn run as a participant whose memory the caller may not read (participant-not-allowed; for a conversation’s stored participant, only to a caller who can read the conversation). A turn runs with its participant’s memory (the conversation’s stored participant, else input.participantId), so running as one takes being them (a person, by their user id) or write on the turn’s project, as reading their memory does. A turn into a conversation with no participant takes having opened it (the caller ?openedBy=me names) or write on its project (on its agent, for a conversation from before projects): permission-denied, with details.resource the conversation, to a caller who can read it. 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" }}Agent or flow not found; or projectId names no project of this workspace (project-not-found); or input.conversationId names no conversation of this workspace (conversation-not-found), answered before any turn starts, with options.wait: false too. A caller who can’t read the conversation gets the same answer, byte for byte, in place of the 409 for a turn naming another project, of the 403 for a turn into it they may not add (a conversation with no participant, or participant-not-allowed for its stored participant), or of the 409 for a closed conversation they may not add a turn to.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}Idempotency-Key was reused with a different body; or projectId names a project other than input.conversationId’s (conversation-project-mismatch, with details.projectId and details.conversationProjectId): a conversation belongs to one project, so name its own or omit projectId; or an erasure of the turn’s person (its conversation or its participantId) is in progress (erasure-in-progress): no new turn starts for them until it completes; or the run’s project is suspended (project-suspended): no run starts in it until it’s restored; or input.conversationId names a closed conversation (conversation-closed, with details.conversationId): it takes no new turns, so start a new one. It’s answered before a run is made, with options.wait: false too, and only once the caller may add the turn: the 404 and 403 rules come first. 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" }}Guardrail violation or budget exceeded.
object
Examplegenerated
{ "error": { "code": "example", "message": "example", "details": {}, "requestId": "example" }}A limit of the workspace’s (set by the runtime’s operator): past its limit on runs waiting to start, rate-limit-exceeded with details.limit: 'runs-pending', with the limit in details.runsPending; a turn whose gate asked for an approval past its limit on approvals waiting for a decision, approvals-pending-limit (details.approvalsPending), when the call waits for the run (with options.wait: false, the call answers 202 and the run fails with that code). On a server with budgets kept per workspace (Kindgi Cloud), also rate-limit-exceeded when work the agent’s turn needed was refused, because this workspace’s work of that kind took details.budgetMs in the last 60 seconds: details.limit names the budget, template-render-time (rendering instructions templates) or schema-compile-time (compiling schemas). The turn’s run failed with this error (details.runId); Retry-After says when to start the turn 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
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/runs: List runs- Security
- Operate a self-hosted runtime
- Ask before a tool runs
- Error code
approvals-pending-limit - Error code
authz-backend-unavailable - Error code
conversation-closed - Error code
conversation-not-found - Error code
conversation-project-mismatch - Error code
database-busy - Error code
erasure-in-progress - Error code
idempotency-key-in-flight - Error code
idempotency-store-unavailable - Error code
key-project-mismatch - Error code
participant-not-allowed - 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
tenant-state-unavailable - Every error code