Skip to Content
Next — You're reading the unreleased preview docs. APIs and pages may change before the next release.Switch to the current docs →
REST APIInvocation API

Invocation API

API working on the invocations of agents

List the invocations of one agent

PathMethodProtected
/v1/runtime/envs/{environment_id}/invocationsGETYes

Newest change first, with the invocation ID as tie-breaker. Pass nextCursor of a page as cursor to get the next one; an invocation that changes while paging appears at most once. since and until are inclusive bounds on the last change.

Query Parameters

NameTypeRequiredDescription
agentstringYesThe agent ID
operationstringNoOnly invocations of this method name or tool:<tool>/<command path>
statearrayNoOnly invocations in one of these states
kind#/components/schemas/InvocationKindNo-
sincestringNo-
untilstringNo-
pageSizeintegerNoAt most 1000; the default is 100
cursorstringNo-

Example Response JSON

{ "invocations": [ { "invocationId": "string", "agentId": "bc309ecf-5f66-4057-93c5-6611cc9cb7b2", "environmentId": "19f5cc2e-7657-437a-9268-83cd3d563563", "state": "scheduled", "kind": "method", "operation": "string", "acceptedAt": "2019-08-24T14:15:22Z", "changedAt": "2019-08-24T14:15:22Z" } ], "nextCursor": "string" }

Find the invocations that the caller started on an agent with an idempotency key

PathMethodProtected
/v1/runtime/envs/{environment_id}/invocations/lookupGETYes

The key is matched in the caller’s own idempotency scope, against every method and tool command the agent ran, including those a later revision removed. A removed method is found only while one of its invocations has the method name outside an external payload; otherwise pass operation. A caller without a scope, and a key used through an HTTP route, find nothing. No match is 404.

Query Parameters

NameTypeRequiredDescription
agentstringYesThe agent ID
operationstringNoOnly the invocation of this method name or tool:<tool>/<command path>

Example Response JSON

{ "invocations": [ { "invocationId": "string", "agentId": "bc309ecf-5f66-4057-93c5-6611cc9cb7b2", "environmentId": "19f5cc2e-7657-437a-9268-83cd3d563563", "state": "scheduled", "kind": "method", "operation": "string", "acceptedAt": "2019-08-24T14:15:22Z", "changedAt": "2019-08-24T14:15:22Z" } ] }

Get an invocation, with its result once it is terminal

PathMethodProtected
/v1/runtime/envs/{environment_id}/invocations/{invocation_id}GETYes

Example Response JSON

{ "summary": { "invocationId": "string", "agentId": "bc309ecf-5f66-4057-93c5-6611cc9cb7b2", "environmentId": "19f5cc2e-7657-437a-9268-83cd3d563563", "state": "scheduled", "kind": "method", "operation": "string", "acceptedAt": "2019-08-24T14:15:22Z", "changedAt": "2019-08-24T14:15:22Z" }, "result": { "type": "Method", "value": { "graph": { "defs": [ { "id": "string", "name": "string", "body": { "kind": "ref", "value": { "id": "string", "metadata": { "doc": "string", "aliases": [ "string" ], "examples": [ "string" ], "deprecated": "string", "role": { "tag": "multimodal" } } } } } ], "root": { "kind": "ref", "value": { "id": "string", "metadata": { "doc": "string", "aliases": [ "string" ], "examples": [ "string" ], "deprecated": "string", "role": { "tag": "multimodal" } } } } }, "value": { "kind": "bool", "value": true } } } }

Cancel an invocation

PathMethodProtected
/v1/runtime/envs/{environment_id}/invocations/{invocation_id}/cancelPOSTYes

A pending or scheduled invocation becomes cancelled at once and never runs. A terminal invocation keeps its state. Both answer 200 with the invocation’s state. Cancelling an invocation that already started is not supported yet and answers 409 with the code CANNOT_CANCEL_RUNNING_INVOCATION.

Example Response JSON

{ "invocationId": "string", "agentId": "bc309ecf-5f66-4057-93c5-6611cc9cb7b2", "environmentId": "19f5cc2e-7657-437a-9268-83cd3d563563", "state": "scheduled", "kind": "method", "operation": "string", "acceptedAt": "2019-08-24T14:15:22Z", "changedAt": "2019-08-24T14:15:22Z" }

Invocation API Errors

Status CodeDescriptionBody
400{"code":"string","errors":["string"]}
401{"code":"string","error":"string"}
403{"code":"string","error":"string"}
404{"code":"string","error":"string"}
409{"code":"string","error":"string"}
413{"code":"string","error":"string"}
415{"code":"string","error":"string"}
422A limit was exceeded, or the idempotency key was already used for a different request.{"code":"string","error":"string"}
500{"code":"string","error":"string","workerError":{"cause":"string","stderr":"string"}}