Skip to content

cayu.runtime.stop_policy

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 first_reached_limit
first_reached_limit(*, limits: RunLimits, usage: SessionUsageSummary, elapsed_seconds: int, pending_tool_calls: int=0) -> StopDecision | None

Release source · Runtime guarantees · Capability guides

from cayu import StopDecision

Decision returned when a run limit is reached.

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
limit StopLimit required
maximum StrictInt | Decimal required
actual StrictInt | Decimal required
message str required
StopDecision.validate_numeric_values(value: int | Decimal, info) -> int | Decimal

Release source · Runtime guarantees · Capability guides

from cayu import StopLimit

Kinds of limits that can stop a session run.

first_reached_limit produces the token, tool-call, and elapsed-time kinds. ESTIMATED_COST is produced by request-budget evaluation (BudgetLimit), whose StopDecision carries Decimal cost values in maximum and actual. MODEL_STEPS is produced when durable queued input reaches an otherwise-complete run at its final model step; neither is returned by first_reached_limit.

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
INPUT_TOKENS class attribute 'input_tokens'
OUTPUT_TOKENS class attribute 'output_tokens'
TOTAL_TOKENS class attribute 'total_tokens'
TOOL_CALLS class attribute 'tool_calls'
MODEL_STEPS class attribute 'model_steps'
ELAPSED_SECONDS class attribute 'elapsed_seconds'
ESTIMATED_COST class attribute 'estimated_cost'

Release source · Runtime guarantees · Capability guides