Skip to content

cayu.budgets.run_limits

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 copy_run_limits
copy_run_limits(limits: RunLimits | None) -> RunLimits

Release source · Runtime guarantees · Capability guides

from cayu import has_run_limits
has_run_limits(limits: RunLimits) -> bool

Release source · Runtime guarantees · Capability guides

from cayu import RunLimits

Optional hard limits for one session run or resume call.

Every limit is evaluated against the clock selected by scope:

  • scope="run" (the default): token, tool-call, and elapsed-time limits all measure the current runtime invocation — usage deltas since the original run entered and active time since the run started. Durable approval and user-input continuations retain the baseline and exclude the human wait interval. A fresh run or clean-boundary resume resets it.
  • scope="session": token, tool-call, and elapsed-time limits all measure the whole durable session — cumulative usage from the session event stream and wall time since the session was created. A resumed session that already meets a limit stops immediately.

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
max_input_tokens StrictInt | None Field(default=None, ge=1, le=MAX_DURABLE_JSON_INTEGER)
max_output_tokens StrictInt | None Field(default=None, ge=1, le=MAX_DURABLE_JSON_INTEGER)
max_total_tokens StrictInt | None Field(default=None, ge=1, le=MAX_DURABLE_JSON_INTEGER)
max_tool_calls StrictInt | None Field(default=None, ge=1, le=MAX_DURABLE_JSON_INTEGER)
max_elapsed_seconds StrictInt | None Field(default=None, ge=1, le=MAX_DURABLE_JSON_INTEGER)
scope Literal['session', 'run'] 'run'

Release source · Runtime guarantees · Capability guides