cayu.providers.operations
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.
copy_provider_operation_connection
Section titled “copy_provider_operation_connection”from cayu.providers import copy_provider_operation_connectionValidate a provider-owned connection without consuming its event stream.
copy_provider_operation_connection(connection: ProviderOperationConnection) -> ProviderOperationConnectionRelease source · Runtime guarantees · Capability guides
copy_provider_operation_snapshot
Section titled “copy_provider_operation_snapshot”from cayu.providers import copy_provider_operation_snapshotDetach one provider-owned inspection or cancellation result.
copy_provider_operation_snapshot(snapshot: ProviderOperationSnapshot) -> ProviderOperationSnapshotRelease source · Runtime guarantees · Capability guides
copy_provider_operation_state
Section titled “copy_provider_operation_state”from cayu.providers import copy_provider_operation_stateDetach one provider-owned operation identity at the runtime boundary.
copy_provider_operation_state(state: ProviderOperationState) -> ProviderOperationStateRelease source · Runtime guarantees · Capability guides
PROVIDER_OPERATION_RECOVERY_OPAQUE_MAX_BYTES
Section titled “PROVIDER_OPERATION_RECOVERY_OPAQUE_MAX_BYTES”from cayu.providers import PROVIDER_OPERATION_RECOVERY_OPAQUE_MAX_BYTESPROVIDER_OPERATION_RECOVERY_OPAQUE_MAX_BYTES = 4096Release source · Runtime guarantees · Capability guides
ProviderOperationAdapter
Section titled “ProviderOperationAdapter”from cayu.providers import ProviderOperationAdapterOptional provider-owned background-operation capability.
Keeping this adapter separate from ModelProvider.stream makes the
capability explicit while preserving the synchronous provider contract.
Bases: ABC.
start (method)
Section titled “start (method)”async ProviderOperationAdapter.start(request: ProviderOperationStartRequest) -> ProviderOperationConnectionSubmit one request and return its reconnectable identity and stream.
retrieve (method)
Section titled “retrieve (method)”async ProviderOperationAdapter.retrieve(state: ProviderOperationState) -> ProviderOperationSnapshotInspect an operation without opening a stream.
reconnect (method)
Section titled “reconnect (method)”async ProviderOperationAdapter.reconnect(state: ProviderOperationState) -> ProviderOperationConnectionReconnect to an existing provider-owned stream.
start_idempotency_support (property)
Section titled “start_idempotency_support (property)”ProviderOperationAdapter.start_idempotency_support() -> ProviderOperationStartIdempotencySupportAdvertise exact key-only start recovery only when the provider proves it.
EXACT means recover_start can recover the accepted operation
from the idempotency key without receiving or durably retaining the raw
provider request. Providers that require the request to be submitted again
must leave this as UNSUPPORTED.
recover_start (method)
Section titled “recover_start (method)”async ProviderOperationAdapter.recover_start(request: ProviderOperationStartRecoveryRequest) -> ProviderOperationConnectionRecover an accepted start by its exact provider idempotency identity.
Adapters advertising EXACT must override this method. The default is
intentionally unavailable so adding the recovery seam remains compatible
with adapters that do not advertise exact start recovery. Implementations
must only look up work already accepted under the key; this method must not
create or resubmit provider work.
cancellation_support (property)
Section titled “cancellation_support (property)”ProviderOperationAdapter.cancellation_support() -> ProviderOperationCancellationSupportAdvertise exact-operation cancellation without implying universal support.
cancel (method)
Section titled “cancel (method)”async ProviderOperationAdapter.cancel(state: ProviderOperationState) -> ProviderOperationSnapshotRequest cancellation and return the resulting provider state.
Non-cancellable adapters inherit a truthful bounded UNAVAILABLE
snapshot. Adapters advertising SUPPORTED must override this method.
Release source · Runtime guarantees · Capability guides
ProviderOperationCancellationSupport
Section titled “ProviderOperationCancellationSupport”from cayu.providers import ProviderOperationCancellationSupportWhether an adapter can target an existing durable operation.
Bases: StrEnum.
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 |
|---|---|---|
UNSUPPORTED |
class attribute |
'unsupported' |
SUPPORTED |
class attribute |
'supported' |
Release source · Runtime guarantees · Capability guides
ProviderOperationConnection
Section titled “ProviderOperationConnection”from cayu.providers import ProviderOperationConnectionA started, recovered, or reconnected operation and its normalized event stream.
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 |
|---|---|---|
state |
ProviderOperationState |
required |
status |
ProviderOperationStatus |
required |
events |
AsyncIterator[ModelStreamEvent] |
required |
Release source · Runtime guarantees · Capability guides
ProviderOperationMalformedError
Section titled “ProviderOperationMalformedError”from cayu.providers import ProviderOperationMalformedErrorA provider operation returned invalid protocol data during recovery.
Bases: ValueError.
This type’s implementation and inherited behavior are available in the linked release source.
Release source · Runtime guarantees · Capability guides
ProviderOperationMode
Section titled “ProviderOperationMode”from cayu.providers import ProviderOperationModeWhether one configured provider uses its optional operation adapter.
Bases: StrEnum.
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 |
|---|---|---|
SYNCHRONOUS |
class attribute |
'synchronous' |
BACKGROUND |
class attribute |
'background' |
Release source · Runtime guarantees · Capability guides
ProviderOperationRecoveryMetadata
Section titled “ProviderOperationRecoveryMetadata”from cayu.providers import ProviderOperationRecoveryMetadataSmall provider-neutral continuation state, never request or response data.
cursor is the runtime-owned monotonic boundary number. opaque is a
bounded adapter-owned continuation value: Cayu copies and stores it without
interpreting provider-specific field names, and gives it back only to the
same operation adapter. Provider adapters must not put credentials, raw
request or response bodies, or model reasoning in it.
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 |
|---|---|---|
cursor |
Annotated[StrictInt, Field(ge=0, le=MAX_DURABLE_JSON_INTEGER)] | None |
None |
opaque |
dict[str, object] |
Field(default_factory=dict, exclude_if=lambda value: not value) |
validate_opaque (method)
Section titled “validate_opaque (method)”ProviderOperationRecoveryMetadata.validate_opaque(value: object) -> dict[str, object]Release source · Runtime guarantees · Capability guides
ProviderOperationSnapshot
Section titled “ProviderOperationSnapshot”from cayu.providers import ProviderOperationSnapshotThe provider’s current interpretation of one durable operation identity.
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 |
|---|---|---|
state |
ProviderOperationState |
required |
status |
ProviderOperationStatus |
required |
events |
tuple[ModelStreamEvent, ...] |
() |
Release source · Runtime guarantees · Capability guides
ProviderOperationStartIdempotencySupport
Section titled “ProviderOperationStartIdempotencySupport”from cayu.providers import ProviderOperationStartIdempotencySupportWhether recovering an accepted start from its key alone is proven exact.
Bases: StrEnum.
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 |
|---|---|---|
UNSUPPORTED |
class attribute |
'unsupported' |
EXACT |
class attribute |
'exact' |
Release source · Runtime guarantees · Capability guides
ProviderOperationStartRecoveryRequest
Section titled “ProviderOperationStartRecoveryRequest”from cayu.providers import ProviderOperationStartRecoveryRequestRecover one accepted start from provider-owned idempotency authority alone.
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 |
|---|---|---|
idempotency_key |
str |
required |
Release source · Runtime guarantees · Capability guides
ProviderOperationStartRequest
Section titled “ProviderOperationStartRequest”from cayu.providers import ProviderOperationStartRequestOne explicitly enabled dispatch with stable provider idempotency authority.
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 |
|---|---|---|
request |
ModelRequest |
required |
idempotency_key |
str |
required |
Release source · Runtime guarantees · Capability guides
ProviderOperationState
Section titled “ProviderOperationState”from cayu.providers import ProviderOperationStateBounded durable state needed to inspect or reconnect provider-owned work.
Provider adapters must never put credentials, raw request bodies, or model
reasoning in recovery_metadata. Cayu enforces portable durable JSON and
a small byte bound; the metadata remains runtime-private when operation
evidence is projected to public 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 |
|---|---|---|
version |
Literal[1] |
1 |
operation_id |
str |
Field(max_length=PROVIDER_OPERATION_ID_MAX_CHARS) |
stream_protocol |
str |
Field(max_length=PROVIDER_OPERATION_STREAM_PROTOCOL_MAX_CHARS) |
recovery_metadata |
ProviderOperationRecoveryMetadata |
Field(default_factory=ProviderOperationRecoveryMetadata) |
validate_bounded_identity (method)
Section titled “validate_bounded_identity (method)”ProviderOperationState.validate_bounded_identity(value: str, info) -> strvalidate_recovery_metadata (method)
Section titled “validate_recovery_metadata (method)”ProviderOperationState.validate_recovery_metadata(value: object) -> ProviderOperationRecoveryMetadataRelease source · Runtime guarantees · Capability guides
ProviderOperationStatus
Section titled “ProviderOperationStatus”from cayu.providers import ProviderOperationStatusProvider-neutral lifecycle states for reconnectable model work.
Bases: StrEnum.
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 |
|---|---|---|
QUEUED |
class attribute |
'queued' |
IN_PROGRESS |
class attribute |
'in_progress' |
COMPLETED |
class attribute |
'completed' |
FAILED |
class attribute |
'failed' |
CANCELLED |
class attribute |
'cancelled' |
EXPIRED |
class attribute |
'expired' |
UNAVAILABLE |
class attribute |
'unavailable' |
terminal (property)
Section titled “terminal (property)”ProviderOperationStatus.terminal() -> bool