Skip to content

Change a queue rule

View as Markdown
PATCH
/v1/projects/{projectId}/queue-rules/{ruleId}
curl --request PATCH \
--url https://example.com/v1/projects/example/queue-rules/example \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "name": "example", "when": { "agentIds": [ "example" ], "flowIds": [ "example" ], "versions": [ "example" ], "status": [ "completed" ], "includeDryRuns": true }, "sample": 1, "maxOpen": 1, "correctorGroupId": "example", "enabled": true }'

A new version with these fields changed (when is replaced whole). Earlier versions are kept: …/versions shows who changed what, when. Needs write on the project.

projectId
required
string

ProjectId — opaque branded string.

ruleId
required
string
Media typeapplication/json

The fields to change; when is replaced whole.

object
name
string
>= 1 characters <= 200 characters
when

Which of a project’s runs a rule matches as they end. Every field narrows; absent fields don’t. agentIds or flowIds, not both. Top-level runs only (an agent’s own runs, not its turns as a flow’s step); replays never match.

object
agentIds
Array<string>
>= 1 items <= 50 items
flowIds
Array<string>
>= 1 items <= 50 items
versions

These versions exactly, or pinned: runs that got the agent’s pinned version, not one the caller named. Runs from before the runtime recorded how their version was chosen never match pinned.

Array<string>
>= 1 items <= 50 items
status

How the run ended. Only completed today: a correction needs a completed run, so failed and cancelled are refused (400). Absent: completed.

Array<string>
>= 1 items
Allowed values: completed failed cancelled
includeDryRuns

Dry runs are left out unless true.

boolean
sample

The share of matching runs queued, decided by the run and rule ids: the same every time and across the rule’s versions, so raising it keeps the runs it took before. Default 1.

number
> 0 <= 1
maxOpen

Queue nothing while this rule has this many open items. null removes the cap.

integer | null
>= 1 <= 10000
correctorGroupId

Whose correction it wants: one of this group closes it. null: any correction does.

string | null
enabled

Default true.

boolean

The new version.

Media typeapplication/json

One version of a queue rule; the latest live one applies.

object
ruleId
required
string
projectId
required
string
version
required
integer
>= 1
name
required
string
>= 1 characters <= 200 characters
when
required

Which of a project’s runs a rule matches as they end. Every field narrows; absent fields don’t. agentIds or flowIds, not both. Top-level runs only (an agent’s own runs, not its turns as a flow’s step); replays never match.

object
agentIds
Array<string>
>= 1 items <= 50 items
flowIds
Array<string>
>= 1 items <= 50 items
versions

These versions exactly, or pinned: runs that got the agent’s pinned version, not one the caller named. Runs from before the runtime recorded how their version was chosen never match pinned.

Array<string>
>= 1 items <= 50 items
status

How the run ended. Only completed today: a correction needs a completed run, so failed and cancelled are refused (400). Absent: completed.

Array<string>
>= 1 items
Allowed values: completed failed cancelled
includeDryRuns

Dry runs are left out unless true.

boolean
sample
required
number
> 0 <= 1
maxOpen

Queue nothing while this rule has this many open items. Absent: no cap.

integer
>= 1 <= 10000
correctorGroupId

Whose correction it wants: one of this group closes it. Absent: any correction does.

string
enabled
required
boolean
createdBy

Who wrote this version.

string
createdAt
required
string format: date-time
unregisteredAt
string format: date-time
Example
{
"when": {
"status": [
"completed"
]
}
}

Malformed request body.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}

Missing / malformed / expired / revoked bearer token.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}

No such rule (queue-rule-not-found), or no live corrector group correctorGroupId (corrector-group-not-found).

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}

Idempotency-Key was reused with a different body, or resource-state conflict.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
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).

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
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.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}
Retry-After
integer
>= 1

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).

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
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.

Media typeapplication/json
object
error
required
object
code
required

Stable machine-readable discriminant. Values match domain error codes (see docs/API-ROUTE-CONVENTIONS.md §4.3).

string
message
required
string
details

Optional, kind-specific.

object
key
additional properties
any
requestId
required

Server-assigned request id; also echoed via X-Request-Id header.

string
Examplegenerated
{
"error": {
"code": "example",
"message": "example",
"details": {},
"requestId": "example"
}
}
Retry-After
integer
>= 1

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