Skip to content

client.projects.queue_rules

View as Markdown

client.projects.queue_rules — the projects.queueRules operations.

On AsyncKindgi every method is the same, awaited.

list(
project_id: str | UUID,
/,
*,
limit: int | None = None,
cursor: str | None = None,
timeout: float | None = None,
) -> QueueRulePage
Signature

List a project's queue rules. GET /v1/projects/{projectId}/queue-rules

The live rules (their latest versions), oldest first. A rule says which of the project's runs to queue for a person's correction when they end. Needs read on the project.

create(
project_id: str | UUID,
body: QueueRuleSpec | Mapping[str, Any] | None = None,
/,
*,
idempotency_key: str | None = None,
timeout: float | None = None,
**fields: Any,
) -> QueueRule
Signature

Create a queue rule. POST /v1/projects/{projectId}/queue-rules

Version 1 of a rule. From then on, a top-level run of the project that matches when as it ends (and falls in sample, while the rule has fewer than maxOpen open items) is queued for a person's correction; replays never are. A rule only lists runs: it never starts a model. Needs write on the project.

preview(
project_id: str | UUID,
/,
*,
agent_ids: str | None = None,
flow_ids: str | None = None,
versions: str | None = None,
status: str | None = None,
include_dry_runs: bool | None = None,
sample: float | None = None,
last: int | None = None,
rule_id: str | UUID | None = None,
timeout: float | None = None,
) -> QueueRulePreview
Signature

What a rule would have queued. GET /v1/projects/{projectId}/queue-rules/preview

Among the project's last last top-level runs (not replays), how many a rule with these fields (and its sample) would have queued. The rule editor's "would have added N of the last 100". Lists are comma-separated. Needs read on the project.

get(
project_id: str | UUID,
rule_id: str | UUID,
/,
*,
timeout: float | None = None,
) -> QueueRule
Signature

Fetch a queue rule. GET /v1/projects/{projectId}/queue-rules/{ruleId}

Its latest version. Needs read on the project.

update(
project_id: str | UUID,
rule_id: str | UUID,
body: QueueRulePatch | Mapping[str, Any] | None = None,
/,
*,
timeout: float | None = None,
**fields: Any,
) -> QueueRule
Signature

Change a queue rule. PATCH /v1/projects/{projectId}/queue-rules/{ruleId}

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.

unregister(
project_id: str | UUID,
rule_id: str | UUID,
/,
*,
timeout: float | None = None,
) -> QueueRuleUnregisterResult
Signature

Stop a queue rule. POST /v1/projects/{projectId}/queue-rules/{ruleId}/unregister

It queues nothing more; its versions and the items it queued stay. unregistered: false when it was already stopped. Needs write on the project.

versions(
project_id: str | UUID,
rule_id: str | UUID,
/,
*,
limit: int | None = None,
cursor: str | None = None,
timeout: float | None = None,
) -> QueueRulePage
Signature

A queue rule's versions. GET /v1/projects/{projectId}/queue-rules/{ruleId}/versions

Every version, newest first: who wrote it, when, and what it said. Needs read on the project.

results(
project_id: str | UUID,
rule_id: str | UUID,
/,
*,
since: str | None = None,
timeout: float | None = None,
) -> QueueRuleResults
Signature

A queue rule's results. GET /v1/projects/{projectId}/queue-rules/{ruleId}/results

By the rule's version and the agent's: the runs it queued (open, corrected, dismissed, erased), the ones its maxOpen skipped, and the live corrections on them, with their group-weighted yes share and a count by group. Never pooled with another rule's, or across a rule's versions: each is a sample of its own when. Needs read on the project.

client.projects.queue_rules.queue_recent()

Section titled “client.projects.queue_rules.queue_recent()”
queue_recent(
project_id: str | UUID,
rule_id: str | UUID,
body: ExpertQueueRecentInput | Mapping[str, Any] | None = None,
/,
*,
timeout: float | None = None,
**fields: Any,
) -> ExpertQueueRecentQueued
Signature

Queue a rule's recent matches. POST /v1/projects/{projectId}/queue-rules/{ruleId}/queue-recent

Catch a rule up on runs that ended before it was there: among the project's recent runs — last of them (newest first) and/or those completed at or after since — queue the ones it matches, sampled as the rule samples, deduped per (rule, run) as run-end matching is. maxOpen isn't applied. The answer splits the matches into queued (newly added), alreadyQueued (this rule already had them) and alreadyReviewed (their run was already corrected or dismissed, so they're left as they are); an erased run is no longer a match. At least one of last, since is given. Needs write on the project.