Skip to content

cayu.approvals.tools

Public Cayu API. Definitions are grouped by their public source module, and definitions from private implementation modules appear on their package’s page; adding a symbol does not move existing links. The import shown at each entry is a supported public namespace. Read the Python API overview and install the required extra.

from cayu.approvals import PendingToolApproval

Durable checkpoint state for a tool call waiting on caller approval.

max_steps, limits, budget_limits, and retry_policy persist the original run’s configuration across the approval pause so resolving the approval resumes with the same config instead of fresh defaults. A resolution request may restate those values only when they preserve the invocation’s frozen execution profile. They are optional so checkpoints written before this state existed still load. Loop policies are runtime callables and cannot be checkpointed; they must be re-supplied on the resolution request when needed.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
approval_id str required
tool_round_id str required
model_step_id str required
model_attempt_id str required
tool_call_id str required
tool_name str required
arguments dict[str, Any] Field(default_factory=dict)
agent_name str required
environment_name str | None None
workspace_id str | None None
task_id str | None None
execution_profile_fingerprint str | None Field(default=None, min_length=64, max_length=64, pattern='^[0-9a-f]{64}$')
publish_arguments SkipJsonSchema[StrictBool] required
secret_resolution_scope Literal['static', 'dynamic', 'unknown'] 'unknown'
reason str | None None
metadata dict[str, Any] Field(default_factory=dict)
tool_calls list[PendingToolCallApproval] required
structured_output StructuredOutputSpec | None None
thinking ThinkingConfig | None None
max_steps StrictInt | None Field(default=None, ge=1, le=MAX_STEPS)
limits RunLimits | None None
run_limit_accounting RunLimitAccountingContext | None None
budget_limits tuple[BudgetLimit, ...] | None None
retry_policy RetryPolicy | None None
expires_at datetime | None None
PendingToolApproval.validate_expires_at(value: datetime | None) -> datetime | None
PendingToolApproval.from_event(event: Event) -> PendingToolApproval

Parse a legacy approval event that retains complete arguments.

Current quarantined events must be parsed as PendingToolApprovalEventView; they cannot produce executable checkpoint state with fabricated empty arguments.

PendingToolApproval.validate_nonblank_fields(value: str, info) -> str
PendingToolApproval.validate_tool_round_identity() -> PendingToolApproval

validate_optional_nonblank_fields (method)

Section titled “validate_optional_nonblank_fields (method)”
PendingToolApproval.validate_optional_nonblank_fields(value: str | None, info) -> str | None
PendingToolApproval.copy_json_fields(value: dict[str, Any], info) -> dict[str, Any]
PendingToolApproval.copy_structured_output(value: StructuredOutputSpec | None) -> StructuredOutputSpec | None
PendingToolApproval.copy_tool_calls(value: list[PendingToolCallApproval]) -> list[PendingToolCallApproval]
PendingToolApproval.copy_limits(value: RunLimits | None) -> RunLimits | None
PendingToolApproval.copy_budget_limits(value) -> tuple[BudgetLimit, ...] | None
PendingToolApproval.copy_retry(value: RetryPolicy | None) -> RetryPolicy | None

Release source · Runtime guarantees · Capability guides

from cayu.approvals import PendingToolApprovalEventView

Typed approval-event projection with explicit argument availability.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
approval_id str required
tool_round_id str required
model_step_id str required
model_attempt_id str required
tool_call_id str required
tool_name str required
arguments_state Literal['finalized', 'quarantined'] required
arguments dict[str, Any] | None required
agent_name str required
environment_name str | None None
workspace_id str | None None
task_id str | None None
execution_profile_fingerprint str | None Field(default=None, min_length=64, max_length=64, pattern='^[0-9a-f]{64}$')
reason str | None None
metadata dict[str, Any] Field(default_factory=dict)
tool_calls list[PendingToolCallApprovalEventView] required
structured_output StructuredOutputSpec | None None
thinking ThinkingConfig | None None
max_steps StrictInt | None Field(default=None, ge=1, le=MAX_STEPS)
limits RunLimits | None None
budget_limits tuple[BudgetLimit, ...] | None None
retry_policy RetryPolicy | None None
expires_at datetime | None None
PendingToolApprovalEventView.copy_json_fields(value: dict[str, Any] | None, info)
PendingToolApprovalEventView.copy_tool_calls(value: list[PendingToolCallApprovalEventView]) -> list[PendingToolCallApprovalEventView]
PendingToolApprovalEventView.copy_structured_output(value: StructuredOutputSpec | None) -> StructuredOutputSpec | None
PendingToolApprovalEventView.copy_limits(value: RunLimits | None) -> RunLimits | None
PendingToolApprovalEventView.copy_budget_limits(value) -> tuple[BudgetLimit, ...] | None
PendingToolApprovalEventView.copy_thinking(value: ThinkingConfig | None) -> ThinkingConfig | None
PendingToolApprovalEventView.copy_retry(value: RetryPolicy | None) -> RetryPolicy | None
PendingToolApprovalEventView.validate_argument_projection() -> PendingToolApprovalEventView
PendingToolApprovalEventView.from_event(event: Event) -> PendingToolApprovalEventView

Parse a complete legacy or quarantined current approval event.

Release source · Runtime guarantees · Capability guides

from cayu.approvals import PendingToolCallApproval

One tool call captured inside a pending approval round.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
tool_call_id str required
tool_name str required
arguments dict[str, Any] Field(default_factory=dict)
targeted_tool_grant_id str | None Field(default=None, pattern=TARGETED_TOOL_DIGEST_PATTERN, exclude_if=lambda value: value is None)
model_tool_name str | None Field(default=None, exclude_if=lambda value: value is None)
targeted_tool_invocation ResolvedTargetedToolInvocation | None Field(default=None, exclude_if=lambda value: value is None)
targeted_tool_rejection RejectedTargetedToolInvocation | None Field(default=None, exclude_if=lambda value: value is None)
policy_evidence ToolPolicyEvidence | None None
policy_decision str | None None
command_denial_code CommandDenialCode | None Field(default=None, exclude_if=lambda value: value is None)
reason str | None None
metadata dict[str, Any] Field(default_factory=dict)
active_taint_labels list[str] Field(default_factory=list)
PendingToolCallApproval.validate_nonblank_fields(value: str, info) -> str
PendingToolCallApproval.validate_model_tool_name(value: str | None) -> str | None
PendingToolCallApproval.copy_targeted_tool_invocation(value: object) -> object
PendingToolCallApproval.copy_targeted_tool_rejection(value: object) -> object
PendingToolCallApproval.validate_active_taint_labels(value: Any) -> list[str]

validate_optional_nonblank_fields (method)

Section titled “validate_optional_nonblank_fields (method)”
PendingToolCallApproval.validate_optional_nonblank_fields(value: str | None, info) -> str | None
PendingToolCallApproval.copy_json_fields(value: dict[str, Any], info) -> dict[str, Any]
PendingToolCallApproval.validate_policy_evidence() -> PendingToolCallApproval
PendingToolCallApproval.transcript_arguments() -> dict[str, Any]

Return the non-authoritative provider-history argument projection.

Release source · Runtime guarantees · Capability guides

from cayu.approvals import PendingToolCallApprovalEventView

Non-executable projection of one call in an approval event.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
tool_call_id str required
tool_name str required
arguments_state Literal['finalized', 'quarantined'] required
arguments dict[str, Any] | None required
policy_evidence ToolPolicyEvidence | None None
policy_decision str | None None
reason str | None None
metadata dict[str, Any] Field(default_factory=dict)
active_taint_labels list[str] Field(default_factory=list)
PendingToolCallApprovalEventView.copy_json_fields(value: dict[str, Any] | None, info)
PendingToolCallApprovalEventView.copy_active_taint_labels(value: list[str]) -> list[str]
PendingToolCallApprovalEventView.validate_argument_projection() -> PendingToolCallApprovalEventView

Release source · Runtime guarantees · Capability guides

from cayu.approvals import ToolApprovalDecision

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
APPROVE class attribute 'approve'
DENY class attribute 'deny'

Release source · Runtime guarantees · Capability guides

from cayu.approvals import ToolApprovalRecoveryOutcome

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
COMPLETED class attribute 'completed'
FAILED class attribute 'failed'

Release source · Runtime guarantees · Capability guides

from cayu.approvals import ToolApprovalRecoveryRequest

Caller-supplied terminal outcome for an approved tool with unknown result.

max_steps, limits, budget_limits, and retry_policy default to None, which means “inherit the original run’s configuration” as persisted on the pending approval checkpoint. An explicit value is accepted only when it preserves the invocation’s frozen execution profile.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
review_reference HumanReviewReference | None Field(default=None, repr=False, exclude_if=lambda value: value is None)
session_id str required
task_worker_id str | None None
task_handoff_id str | None None
approval_id str required
tool_round_id str required
tool_call_id str required
outcome ToolApprovalRecoveryOutcome required
message str required
structured dict[str, Any] | None None
artifacts list[dict[str, Any]] Field(default_factory=list)
reason str | None None
metadata dict[str, Any] Field(default_factory=dict)
resolved_by ResolutionActor | None None
max_steps StrictInt | None Field(default=None, ge=1, le=MAX_STEPS)
limits RunLimits | None None
budget_limits tuple[BudgetLimit, ...] | None None
retry_policy RetryPolicy | None None
structured_output StructuredOutputSpec | None None
thinking ThinkingConfig | None None
loop_policies SkipJsonSchema[tuple[LoopPolicy, ...]] Field(default_factory=tuple, exclude=True)
ToolApprovalRecoveryRequest.validate_nonblank_ids(value: str, info) -> str
ToolApprovalRecoveryRequest.validate_task_worker_id(value: str | None) -> str | None
ToolApprovalRecoveryRequest.validate_task_handoff_authority() -> ToolApprovalRecoveryRequest
ToolApprovalRecoveryRequest.validate_message(value: str, info) -> str
ToolApprovalRecoveryRequest.validate_optional_reason(value: str | None, info) -> str | None
ToolApprovalRecoveryRequest.copy_json_fields(value, info)
ToolApprovalRecoveryRequest.copy_resolved_by(value: ResolutionActor | None) -> ResolutionActor | None
ToolApprovalRecoveryRequest.copy_structured_output(value: StructuredOutputSpec | None) -> StructuredOutputSpec | None
ToolApprovalRecoveryRequest.copy_limits(value: RunLimits | None) -> RunLimits | None
ToolApprovalRecoveryRequest.copy_budget_limits(value) -> tuple[BudgetLimit, ...] | None
ToolApprovalRecoveryRequest.copy_loop_policies(value) -> tuple[LoopPolicy, ...]

Release source · Runtime guarantees · Capability guides

from cayu.approvals import ToolApprovalRequest

Caller decision for a pending tool approval.

max_steps, limits, budget_limits, and retry_policy default to None, which means “inherit the original run’s configuration” as persisted on the pending approval checkpoint. An explicit value is accepted only when it preserves the invocation’s frozen execution profile.

Bases: BaseModel.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
review_reference HumanReviewReference | None Field(default=None, repr=False, exclude_if=lambda value: value is None)
session_id str required
task_worker_id str | None None
task_handoff_id str | None None
approval_id str required
tool_round_id str required
tool_call_id str required
decision ToolApprovalDecision required
reason str | None None
metadata dict[str, Any] Field(default_factory=dict)
resolved_by ResolutionActor | None None
max_steps StrictInt | None Field(default=None, ge=1, le=MAX_STEPS)
limits RunLimits | None None
budget_limits tuple[BudgetLimit, ...] | None None
retry_policy RetryPolicy | None None
structured_output StructuredOutputSpec | None None
thinking ThinkingConfig | None None
loop_policies SkipJsonSchema[tuple[LoopPolicy, ...]] Field(default_factory=tuple, exclude=True)
ToolApprovalRequest.validate_nonblank_ids(value: str, info) -> str
ToolApprovalRequest.validate_task_worker_id(value: str | None) -> str | None
ToolApprovalRequest.validate_task_handoff_authority() -> ToolApprovalRequest
ToolApprovalRequest.validate_optional_reason(value: str | None, info) -> str | None
ToolApprovalRequest.copy_metadata(value: dict[str, Any]) -> dict[str, Any]
ToolApprovalRequest.copy_resolved_by(value: ResolutionActor | None) -> ResolutionActor | None
ToolApprovalRequest.copy_structured_output(value: StructuredOutputSpec | None) -> StructuredOutputSpec | None
ToolApprovalRequest.copy_limits(value: RunLimits | None) -> RunLimits | None
ToolApprovalRequest.copy_budget_limits(value) -> tuple[BudgetLimit, ...] | None
ToolApprovalRequest.copy_loop_policies(value) -> tuple[LoopPolicy, ...]

Release source · Runtime guarantees · Capability guides

from cayu.approvals import ToolPolicyEvidence

Durable authority state for one policy-planned tool call.

AUTHORITATIVE is the only state that may carry an executable policy decision. AMBIGUOUS means evaluation may have happened but its result was not durably published; operator acknowledgement cannot turn that missing evidence into authorization.

Bases: StrEnum.

Defaults below are source expressions; Field(...) includes schema/validation settings and default_factory creates a fresh value. Inherited declarations are included. Constructor behavior follows the model or dataclass shown in the bases/decorators.

Name Type Default
UNPLANNED class attribute 'unplanned'
AUTHORITATIVE class attribute 'authoritative'
UNREGISTERED class attribute 'unregistered'
UNEXPOSED class attribute 'unexposed'
AMBIGUOUS class attribute 'ambiguous'

Release source · Runtime guarantees · Capability guides