Skip to content

cayu.deadlines

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 import current_execution_deadline
current_execution_deadline() -> ExecutionDeadline

Release source · Runtime guarantees · Capability guides

from cayu import execution_deadline_scope

Bind/inherit a boundary and enforce it through ordinary task cancellation.

Exit runs after enclosed cancellation settlement. Cleanup must not call require_admission: it has its own existing bounded settlement budgets.

async execution_deadline_scope(deadline: ExecutionDeadline) -> AsyncIterator[asyncio.Timeout]

Release source · Runtime guarantees · Capability guides

from cayu import ExecutionDeadline

Portable UTC expiry with a live, process-local monotonic upper bound.

None is explicit absence of a deadline. Only UTC/source/scope are serialized; loading a durable value recomputes remaining time, never its original duration.

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
expires_at datetime | None None
source str 'runtime'
scope str 'execution'
ExecutionDeadline.validate_expiry(value: datetime | None) -> datetime | None
ExecutionDeadline.validate_label(value: str) -> str
ExecutionDeadline.model_post_init(context: Any) -> None
ExecutionDeadline.after(seconds: float | None, *, source: str='runtime', scope: str='execution') -> ExecutionDeadline
ExecutionDeadline.remaining_seconds() -> float | None
ExecutionDeadline.expired() -> bool
ExecutionDeadline.require_admission(stage: str) -> None
ExecutionDeadline.inspection() -> dict[str, Any]

Safe point-in-time evidence; call again for live remaining time.

ExecutionDeadline.model_context() -> str

Explicit opt-in text for a freshly built model request, not a live clock.

Release source · Runtime guarantees · Capability guides

from cayu import ExecutionDeadlineExceeded

New application work was denied; this does not attest external settlement.

Bases: TimeoutError.

ExecutionDeadlineExceeded.__init__(deadline: ExecutionDeadline, stage: str) -> None

Release source · Runtime guarantees · Capability guides