cayu.runtime definitions
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.
ContinuationDiscoveryPage
Section titled “ContinuationDiscoveryPage”from cayu.collaboration import ContinuationDiscoveryPageDecorators: @dataclass(frozen=True, slots=True).
Fields and attributes
Section titled “Fields and attributes”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 |
|---|---|---|
items |
tuple[ContinuationRecovery, ...] |
required |
next_cursor |
str | None |
required |
Release source · Runtime guarantees · Capability guides
ContinuationRecovery
Section titled “ContinuationRecovery”from cayu.collaboration import ContinuationRecoveryBases: ContractValue.
Fields and attributes
Section titled “Fields and attributes”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 |
|---|---|---|
session |
ParticipantSessionReference |
required |
registration_key |
Identifier |
required |
ticket_key |
StrictStr |
Field(pattern='^session-continuation:[0-9a-f]{64}$') |
preparation_digest |
StrictStr |
Field(pattern='^[0-9a-f]{64}$') |
bounded_input (method)
Section titled “bounded_input (method)”ContinuationRecovery.bounded_input(value: object) -> Anyimmutable_fields (method)
Section titled “immutable_fields (method)”ContinuationRecovery.immutable_fields() -> ContractValueRelease source · Runtime guarantees · Capability guides
CostAccountingCursor
Section titled “CostAccountingCursor”from cayu import CostAccountingCursorBind a refresh to the exact scope, price book, and prior window membership.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”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 |
|---|---|---|
scope_digest |
str |
required |
pricing_digest |
str |
required |
generation |
StrictInt |
Field(default=0, ge=0, le=MAX_DURABLE_JSON_INTEGER) |
signature |
str |
'' |
since |
datetime | None |
None |
until |
datetime | None |
None |
Release source · Runtime guarantees · Capability guides
CostAccountingOutputTooLarge
Section titled “CostAccountingOutputTooLarge”from cayu import CostAccountingOutputTooLargeRequested detailed output exceeds the caller’s explicit byte bound.
Bases: ValueError.
This type’s implementation and inherited behavior are available in the linked release source.
Release source · Runtime guarantees · Capability guides
CostAccountingSnapshot
Section titled “CostAccountingSnapshot”from cayu import CostAccountingSnapshotBases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”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 |
|---|---|---|
through_sequence |
StrictInt |
Field(ge=0, le=MAX_DURABLE_JSON_INTEGER) |
totals |
SessionCostTotals |
required |
session_totals |
tuple[SessionCostTotals, ...] |
() |
details |
SessionCostSummary | None |
None |
session_details |
tuple[SessionCostSummary, ...] |
() |
durable_totals |
SessionCostTotals | None |
None |
cursor |
CostAccountingCursor | None |
None |
Release source · Runtime guarantees · Capability guides
DurableWorkerMetrics
Section titled “DurableWorkerMetrics”from cayu import DurableWorkerMetricsBounded, process-local metrics shared by one worker cohort.
init (method)
Section titled “init (method)”DurableWorkerMetrics.__init__(*, configured_handler_capacity: int=1) -> Nonesnapshot (method)
Section titled “snapshot (method)”DurableWorkerMetrics.snapshot(*, active_pollers: int | None=None) -> DurableWorkerMetricsSnapshothandler_started (method)
Section titled “handler_started (method)”DurableWorkerMetrics.handler_started() -> Nonehandler_finished (method)
Section titled “handler_finished (method)”DurableWorkerMetrics.handler_finished() -> Noneclaim_completed (method)
Section titled “claim_completed (method)”DurableWorkerMetrics.claim_completed(*, claimed: bool) -> Noneclaim_failed (method)
Section titled “claim_failed (method)”DurableWorkerMetrics.claim_failed(*, store_failure: bool) -> Noneclaim_cancelled (method)
Section titled “claim_cancelled (method)”DurableWorkerMetrics.claim_cancelled() -> Nonewake_hint_received (method)
Section titled “wake_hint_received (method)”DurableWorkerMetrics.wake_hint_received() -> Nonewake_hint_accepted (method)
Section titled “wake_hint_accepted (method)”DurableWorkerMetrics.wake_hint_accepted() -> Nonewake_hint_ignored (method)
Section titled “wake_hint_ignored (method)”DurableWorkerMetrics.wake_hint_ignored() -> Nonewake_hint_followed_by_successful_claim (method)
Section titled “wake_hint_followed_by_successful_claim (method)”DurableWorkerMetrics.wake_hint_followed_by_successful_claim() -> Nonewake_hint (method)
Section titled “wake_hint (method)”DurableWorkerMetrics.wake_hint(*, accepted: bool) -> NoneRecord one externally classified hint for API compatibility.
fallback_poll (method)
Section titled “fallback_poll (method)”DurableWorkerMetrics.fallback_poll() -> Nonemaintenance (method)
Section titled “maintenance (method)”DurableWorkerMetrics.maintenance(*, reclaim: bool=False, recovery: bool=False) -> Nonestore_failure (method)
Section titled “store_failure (method)”DurableWorkerMetrics.store_failure() -> Nonehint_to_claim_latency (method)
Section titled “hint_to_claim_latency (method)”DurableWorkerMetrics.hint_to_claim_latency(seconds: float) -> Noneadmission_to_claim_latency (method)
Section titled “admission_to_claim_latency (method)”DurableWorkerMetrics.admission_to_claim_latency(seconds: float) -> Noneidle_backoff (method)
Section titled “idle_backoff (method)”DurableWorkerMetrics.idle_backoff(seconds: float) -> Noneactive_pollers (method)
Section titled “active_pollers (method)”DurableWorkerMetrics.active_pollers(count: int) -> NoneRelease source · Runtime guarantees · Capability guides
DurableWorkerMetricsSnapshot
Section titled “DurableWorkerMetricsSnapshot”from cayu import DurableWorkerMetricsSnapshotContent-free operational measurements for one worker cohort.
Decorators: @dataclass(frozen=True).
Fields and attributes
Section titled “Fields and attributes”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 |
|---|---|---|
configured_handler_capacity |
int |
required |
active_handlers |
int |
required |
maximum_active_handlers |
int |
required |
active_pollers |
int |
required |
maximum_active_pollers |
int |
required |
claim_attempts |
int |
required |
empty_claims |
int |
required |
successful_claims |
int |
required |
failed_claims |
int |
required |
cancelled_claims |
int |
required |
wake_hints_received |
int |
required |
wake_hints_accepted |
int |
required |
wake_hints_ignored |
int |
required |
wake_hints_followed_by_successful_claims |
int |
required |
fallback_poll_activations |
int |
required |
reclaim_operations |
int |
required |
recovery_operations |
int |
required |
store_failures |
int |
required |
hint_to_claim_latency_samples |
int |
required |
hint_to_claim_latency_total_s |
float |
required |
hint_to_claim_latency_max_s |
float |
required |
admission_to_claim_latency_samples |
int |
required |
admission_to_claim_latency_total_s |
float |
required |
admission_to_claim_latency_max_s |
float |
required |
current_idle_backoff_s |
float |
required |
maximum_idle_backoff_s |
float |
required |
Release source · Runtime guarantees · Capability guides
EnvironmentCapacityError
Section titled “EnvironmentCapacityError”from cayu import EnvironmentCapacityErrorRaised before provisioning when process-local lifecycle capacity is full.
Bases: RuntimeError.
This type’s implementation and inherited behavior are available in the linked release source.
Release source · Runtime guarantees · Capability guides
InvocationContext
Section titled “InvocationContext”from cayu.runtime import InvocationContextOne immutable live authority bundle for an invocation.
Registered collaborators are retained by identity. The context is an in-process value and intentionally has no serialization API.
init (method)
Section titled “init (method)”InvocationContext.__init__(*, active_profile: ActiveInvocationExecutionProfile, binding: InvocationBinding, registered_agent: runtime_records.RegisteredAgentState, registered_provider: runtime_records.RegisteredProvider, registered_environment: runtime_records.RegisteredEnvironment | None, runtime_hooks: tuple[runtime_records.RegisteredRuntimeHook, ...], loop_policies: tuple[LoopPolicy, ...], request_loop_policies: tuple[LoopPolicy, ...], budget_policy: BudgetPolicy | None, tool_capability_ceiling: ToolCapabilityCeiling, targeted_tool_grants: tuple[PreparedTargetedToolGrant, ...]=(), _recovery_claim_id: str | None=None, _validated_profile: ExecutionProfileIdentity | None=None, _authority_token: object=None, _work_attempt: WorkAttemptInvocationAuthority | None=None) -> Nonerequire_runtime_authority (method)
Section titled “require_runtime_authority (method)”InvocationContext.require_runtime_authority() -> NoneRevalidate the runtime seal without granting authority to copied fields.
profile (property)
Section titled “profile (property)”InvocationContext.profile() -> ExecutionProfileIdentityReturn the sole validated profile object owned by this context.
active_profile (property)
Section titled “active_profile (property)”InvocationContext.active_profile() -> ActiveInvocationExecutionProfilebinding (property)
Section titled “binding (property)”InvocationContext.binding() -> InvocationBindingregistered_agent (property)
Section titled “registered_agent (property)”InvocationContext.registered_agent() -> runtime_records.RegisteredAgentStateregistered_provider (property)
Section titled “registered_provider (property)”InvocationContext.registered_provider() -> runtime_records.RegisteredProviderregistered_environment (property)
Section titled “registered_environment (property)”InvocationContext.registered_environment() -> runtime_records.RegisteredEnvironment | Noneruntime_hooks (property)
Section titled “runtime_hooks (property)”InvocationContext.runtime_hooks() -> tuple[runtime_records.RegisteredRuntimeHook, ...]loop_policies (property)
Section titled “loop_policies (property)”InvocationContext.loop_policies() -> tuple[LoopPolicy, ...]request_loop_policies (property)
Section titled “request_loop_policies (property)”InvocationContext.request_loop_policies() -> tuple[LoopPolicy, ...]budget_policy (property)
Section titled “budget_policy (property)”InvocationContext.budget_policy() -> BudgetPolicy | Nonetool_capability_ceiling (property)
Section titled “tool_capability_ceiling (property)”InvocationContext.tool_capability_ceiling() -> ToolCapabilityCeilingtargeted_tool_grants (property)
Section titled “targeted_tool_grants (property)”InvocationContext.targeted_tool_grants() -> tuple[PreparedTargetedToolGrant, ...]recovery_claim_id (property)
Section titled “recovery_claim_id (property)”InvocationContext.recovery_claim_id() -> str | NoneReturn runtime-authenticated terminal-recovery ownership, if any.
work_attempt (property)
Section titled “work_attempt (property)”InvocationContext.work_attempt() -> WorkAttemptInvocationAuthority | NoneReturn the runtime-only task owner, never caller-supplied metadata.
with_admitted_session (method)
Section titled “with_admitted_session (method)”InvocationContext.with_admitted_session(session: Session) -> InvocationContextAttach the durable admission result without replacing live authority.
with_registered_environment (method)
Section titled “with_registered_environment (method)”InvocationContext.with_registered_environment(registered_environment: runtime_records.RegisteredEnvironment, *, validated_profile: ExecutionProfileIdentity) -> InvocationContextTransfer one post-admission materialized environment into the context.
with_rebound_session (method)
Section titled “with_rebound_session (method)”InvocationContext.with_rebound_session(session: Session, *, active_profile: ActiveInvocationExecutionProfile) -> InvocationContextCarry the same live authority through one authenticated epoch rebind.
with_queued_interaction (method)
Section titled “with_queued_interaction (method)”InvocationContext.with_queued_interaction(session: Session, *, active_profile: ActiveInvocationExecutionProfile) -> InvocationContextTransfer this exact same-epoch authority to an atomically started turn.
without_recovery_claim (method)
Section titled “without_recovery_claim (method)”InvocationContext.without_recovery_claim() -> InvocationContextDrop a settled recovery claim while preserving invocation authority.
Release source · Runtime guarantees · Capability guides
ModelCompletionManualRecoveryRequired
Section titled “ModelCompletionManualRecoveryRequired”from cayu import ModelCompletionManualRecoveryRequiredA model dispatch cannot be reconstructed safely without operator input.
Bases: RuntimeError.
init (method)
Section titled “init (method)”ModelCompletionManualRecoveryRequired.__init__(message: str) -> NoneRelease source · Runtime guarantees · Capability guides
ProducerCleanupReclamation
Section titled “ProducerCleanupReclamation”from cayu.collaboration import ProducerCleanupReclamationBases: ContractValue.
Fields and attributes
Section titled “Fields and attributes”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 |
|---|---|---|
retirement |
ProducerCleanupRetirement |
required |
removed |
StrictInt |
Field(ge=0, le=32) |
remaining |
StrictBool |
required |
bounded_input (method)
Section titled “bounded_input (method)”ProducerCleanupReclamation.bounded_input(value: object) -> Anyimmutable_fields (method)
Section titled “immutable_fields (method)”ProducerCleanupReclamation.immutable_fields() -> ContractValueRelease source · Runtime guarantees · Capability guides
ProducerCleanupRetirement
Section titled “ProducerCleanupRetirement”from cayu.collaboration import ProducerCleanupRetirementBases: ContractValue.
Fields and attributes
Section titled “Fields and attributes”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 |
|---|---|---|
receiver |
ObjectRef |
required |
namespace |
NamespaceRef |
required |
bounded_input (method)
Section titled “bounded_input (method)”ProducerCleanupRetirement.bounded_input(value: object) -> Anyimmutable_fields (method)
Section titled “immutable_fields (method)”ProducerCleanupRetirement.immutable_fields() -> ContractValuecoherent (method)
Section titled “coherent (method)”ProducerCleanupRetirement.coherent()Release source · Runtime guarantees · Capability guides
SessionContinuationOwner
Section titled “SessionContinuationOwner”from cayu.runtime import SessionContinuationOwnerOwner-level receiving service, not a wait arbiter or automatic worker.
init (method)
Section titled “init (method)”SessionContinuationOwner.__init__(*, store: SessionStore, owner: OwnerRef, receiver: ContinuationLatchReceiver, receiver_capability: CapabilityDescriptor, redactor: SecretRedactor, temporary_permits: TemporaryServicePermitAuthority | None=None, track: Callable[[asyncio.Task[Any]], None] | None=None) -> Nonelatch (method)
Section titled “latch (method)”async SessionContinuationOwner.latch(candidate: ContinuationLatch) -> ContinuationRecordprepare (method)
Section titled “prepare (method)”async SessionContinuationOwner.prepare(intent: ContinuationWait, *, invocation: InvocationContext) -> ContinuationRecordRetain ticket and registration intent while the actual writer is active.
recover_writer (method)
Section titled “recover_writer (method)”async SessionContinuationOwner.recover_writer(candidate: ContinuationTicket, *, invocation: InvocationContext) -> ContinuationRecordAttach an ARMING external ticket to the exact native recovery claim.
park_recovered (method)
Section titled “park_recovered (method)”async SessionContinuationOwner.park_recovered(candidate: ContinuationTicket, *, invocation: InvocationContext) -> ContinuationRecordPark after the recovered runtime reaches its complete whole-turn boundary.
park (method)
Section titled “park (method)”async SessionContinuationOwner.park(candidate: ContinuationTicket, *, invocation: InvocationContext) -> ContinuationRecordAcknowledge parking without releasing or replacing the session writer.
retire (method)
Section titled “retire (method)”async SessionContinuationOwner.retire(candidate: ContinuationRetirement, *, invocation: InvocationContext | None=None) -> ContinuationRecordRetire with writer authority, or exclude an overtaken unconsumed wait.
Registered owners may recover supersession without retaining an old in-process invocation. The store must prove writer advancement atomically. This never authorizes admission or settlement of an in-flight consumption.
exclude (method)
Section titled “exclude (method)”async SessionContinuationOwner.exclude(candidate: ContinuationRetirement, *, invocation: InvocationContext) -> ContinuationRecordRecord an exact destination refusal without dispatching admission.
retire_released (method)
Section titled “retire_released (method)”async SessionContinuationOwner.retire_released(candidate: ContinuationReleasedRetirement) -> ContinuationRecordRetire only through native release and acknowledged service evidence.
admit (method)
Section titled “admit (method)”async SessionContinuationOwner.admit(candidate: ContinuationConsumption, command: AdmitInvocationCommand, *, invocation: InvocationContext) -> tuple[InvocationMutationResult, ContinuationRecord]prepare_temporary_admission (method)
Section titled “prepare_temporary_admission (method)”async SessionContinuationOwner.prepare_temporary_admission(candidate: TemporaryServiceIntent, command: AdmitInvocationCommand, *, invocation: InvocationContext) -> tuple[InvocationMutationResult, TemporaryServiceRecord]Join runtime preparation to durable registration, then native admission.
No public caller may supply this invocation authority. The configured clarification coordinator must configure current source disclosure authorization on the permit owner’s admission guard. That guard belongs to the durable registration task, not its cancellable observer.
admit_temporary (method)
Section titled “admit_temporary (method)”async SessionContinuationOwner.admit_temporary(candidate: TemporaryServiceAdmission, command: AdmitInvocationCommand, *, invocation: InvocationContext, wait_for_settlement: bool=False) -> tuple[InvocationMutationResult, TemporaryServiceRecord]Consume a registered permit after ordinary runtime preparation gates.
This is not a public caller receipt entrance. Both the runtime context and the foreign durable permit must authenticate the complete command.
exclude_temporary (method)
Section titled “exclude_temporary (method)”async SessionContinuationOwner.exclude_temporary(candidate: TemporaryServicePreparation) -> TemporaryServiceRecordFence a prepared native operation before settling foreign responsibility.
This is an explicit coordinator decision, never an inference from timeout or cancellation. The native compare-and-publication races admission under the same session transaction; admitted work cannot take this transition.
reconcile_temporary (method)
Section titled “reconcile_temporary (method)”async SessionContinuationOwner.reconcile_temporary(candidate: TemporaryServiceAdmission) -> TemporaryServiceRecordReconcile native return before discharging the foreign obligation.
If the foreign acknowledgement is lost, the source’s exact returned record remains available to the registered settlement reader. Neither missing admission nor caller cancellation is an exclusion witness.
service_temporary (method)
Section titled “service_temporary (method)”async SessionContinuationOwner.service_temporary(app: CayuApp, request: ResumeRequest, candidate: TemporaryServiceIntent, *, participant_context: CollaborationAccessContext, delivery: Callable[[InvocationContext], Awaitable[None]] | None=None, wait_for_settlement: bool=False) -> TemporaryServiceRecordExplicit internal service, with durable reconciliation before dispatch.
The registered clarification coordinator configures the permit owner’s admission guard to retain current source disclosure through registration. The guard ends before provider serialization acquires its own disclosure authority; holding a non-reentrant policy guard around this entire call would deadlock. This is not an independently authorized SDK entrance. Cancelling observation does not prove the owned service stopped.
service (method)
Section titled “service (method)”async SessionContinuationOwner.service(app: CayuApp, request: ResumeRequest, candidate: ContinuationService, *, participant_context: CollaborationAccessContext | None=None) -> ContinuationRecordObserve normal resume or exact reconciliation with a bounded waiter.
reconcile_admission (method)
Section titled “reconcile_admission (method)”async SessionContinuationOwner.reconcile_admission(candidate: ContinuationConsumption) -> ContinuationRecordSettle a retained handoff only from positive typed admission evidence.
drain (method)
Section titled “drain (method)”async SessionContinuationOwner.drain() -> NoneRelease source · Runtime guarantees · Capability guides
TaskGroupInvocationSettlementPending
Section titled “TaskGroupInvocationSettlementPending”from cayu.tasks import TaskGroupInvocationSettlementPendingRetain settlement and await its retry() to publish owner return.
Retry never executes the invocation again. Process loss before publication deliberately leaves the durable barrier fenced.
Bases: RuntimeError.
init (method)
Section titled “init (method)”TaskGroupInvocationSettlementPending.__init__(settlement: _InvocationSettlement) -> NoneRelease source · Runtime guarantees · Capability guides
UsageAccountingSnapshot
Section titled “UsageAccountingSnapshot”from cayu import UsageAccountingSnapshotExact usage through a store-owned sequence boundary, without source events.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”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 |
|---|---|---|
through_sequence |
StrictInt |
Field(ge=0, le=MAX_DURABLE_JSON_INTEGER) |
generation |
StrictInt |
Field(default=0, ge=0, le=MAX_DURABLE_JSON_INTEGER) |
summary |
SessionUsageSummary |
required |
session_summaries |
tuple[SessionUsageSummary, ...] |
() |
provider_summaries |
tuple[UsageIdentitySummary, ...] |
() |
model_summaries |
tuple[UsageIdentitySummary, ...] |
() |
Release source · Runtime guarantees · Capability guides
UsageIdentitySummary
Section titled “UsageIdentitySummary”from cayu import UsageIdentitySummaryRequested identity breakdown, including its distinct session membership.
Bases: BaseModel.
Fields and attributes
Section titled “Fields and attributes”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 |
|---|---|---|
provider_name |
str | None |
required |
model |
str | None |
required |
session_ids |
tuple[str, ...] |
required |
model_steps |
StrictInt |
Field(ge=0) |
usage |
AggregateUsageMetrics |
required |