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.
first_reached_limit
Section titled “first_reached_limit”from cayu import first_reached_limitfirst_reached_limit(*, limits: RunLimits, usage: SessionUsageSummary, elapsed_seconds: int, pending_tool_calls: int=0) -> StopDecision | NoneRelease source · Runtime guarantees · Capability guides
StopDecision
Section titled “StopDecision”from cayu import StopDecisionDecision returned when a run limit is reached.
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 |
|---|---|---|
limit |
StopLimit |
required |
maximum |
StrictInt | Decimal |
required |
actual |
StrictInt | Decimal |
required |
message |
str |
required |
validate_numeric_values (method)
Section titled “validate_numeric_values (method)”StopDecision.validate_numeric_values(value: int | Decimal, info) -> int | DecimalRelease source · Runtime guarantees · Capability guides
StopLimit
Section titled “StopLimit”from cayu import StopLimitKinds 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.
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 |
|---|---|---|
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' |