Skip to content

cayu.tools.exposure

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.tools import ALL_REGISTERED_TOOLS_PROFILE_ID
ALL_REGISTERED_TOOLS_PROFILE_ID = 'cayu:all-registered-tools:v1'

Release source · Runtime guarantees · Capability guides

from cayu.tools import AllRegisteredToolsExposurePolicy

Compatibility policy exposing every tool inside the effective ceiling.

Bases: ToolExposurePolicy.

AllRegisteredToolsExposurePolicy.execution_profile_identity() -> ExecutionProfileBehaviorIdentity | None

Return a stable application declaration, or None when non-portable.

AllRegisteredToolsExposurePolicy.select(request: ToolExposurePolicyRequest) -> ToolExposureDecision

Release source · Runtime guarantees · Capability guides

from cayu.tools import copy_resolved_tool_exposure

Return a detached, fully revalidated exposure snapshot.

copy_resolved_tool_exposure(exposure: ResolvedToolExposure) -> ResolvedToolExposure

Release source · Runtime guarantees · Capability guides

from cayu.tools import copy_tool_capability_ceiling

Return a detached, fully revalidated durable ceiling.

copy_tool_capability_ceiling(ceiling: ToolCapabilityCeiling) -> ToolCapabilityCeiling

Release source · Runtime guarantees · Capability guides

from cayu.tools import RegisteredToolCapability

Immutable, callable-free summary of one registered application tool.

The summary is safe to pass to an application-owned exposure policy: it contains the declared model contract and execution classifications, but no live tool, policy, runner, environment, credential, or secret handle.

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
name str required
description str ''
input_schema Mapping[str, Any] Field(default_factory=dict)
parallel_safe StrictBool True
effect ToolEffect ToolEffect.EXTERNAL
publishes_arguments StrictBool True
workspace_mutation StrictBool False
execution_contract ToolExecutionContract Field(default_factory=ToolExecutionContract)
execution_requirements tuple[ToolExecutionRequirement, ...] ()
schema_fingerprint str ''
definition_fingerprint str ''
RegisteredToolCapability.copy_execution_requirements(value: object) -> tuple[ToolExecutionRequirement, ...]
RegisteredToolCapability.validate_name(value: str) -> str
RegisteredToolCapability.validate_description(value: str) -> str
RegisteredToolCapability.copy_input_schema(value: object) -> dict[str, Any]
RegisteredToolCapability.freeze_input_schema(value: Mapping[str, Any]) -> Mapping[str, Any]
RegisteredToolCapability.serialize_input_schema(value: Mapping[str, Any]) -> dict[str, Any]
RegisteredToolCapability.validate_and_bind_fingerprints() -> RegisteredToolCapability
RegisteredToolCapability.input_schema_copy() -> dict[str, Any]

Return an owned ordinary-JSON copy for provider/profile projection.

Release source · Runtime guarantees · Capability guides

from cayu.tools import resolve_tool_capability_ceiling

Canonicalize a new or narrowed ceiling against registered capabilities.

maximum is the durable parent/session ceiling. A requested ceiling may only preserve or narrow it. Maximum names absent from a reconstructed catalog are removed; no newly registered or child-only name can enter the result.

resolve_tool_capability_ceiling(requested: ToolCapabilityCeiling | None, registered_tools: tuple[RegisteredToolCapability, ...], *, maximum: ToolCapabilityCeiling | None=None) -> ToolCapabilityCeiling

Release source · Runtime guarantees · Capability guides

from cayu.tools import resolve_tool_exposure

Run and validate a pure policy against registered and ceiling state.

resolve_tool_exposure(policy: ToolExposurePolicy, request: ToolExposurePolicyRequest) -> ResolvedToolExposure

Release source · Runtime guarantees · Capability guides

from cayu.tools import ResolvedToolExposure

Canonical, descriptor-bound result of validating one policy decision.

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
schema_version Literal[2] TOOL_EXPOSURE_SCHEMA_VERSION
profile_id str required
catalogue_revision str required
tools tuple[RegisteredToolCapability, ...] required
registered_count StrictInt Field(ge=0, le=TOOL_EXPOSURE_MAX_REGISTERED_TOOLS)
ceiling_count StrictInt Field(ge=0, le=TOOL_EXPOSURE_MAX_REGISTERED_TOOLS)
metadata Mapping[str, Any] Field(default_factory=dict)
fingerprint str ''
ResolvedToolExposure.validate_profile_id(value: str) -> str
ResolvedToolExposure.validate_catalogue_revision(value: str) -> str
ResolvedToolExposure.copy_tools(value: object) -> tuple[RegisteredToolCapability, ...]
ResolvedToolExposure.copy_metadata(value: object) -> dict[str, Any]
ResolvedToolExposure.freeze_metadata(value: Mapping[str, Any]) -> Mapping[str, Any]
ResolvedToolExposure.serialize_metadata(value: Mapping[str, Any]) -> dict[str, Any]
ResolvedToolExposure.validate_and_bind_fingerprint() -> ResolvedToolExposure
ResolvedToolExposure.tool_names() -> tuple[str, ...]

Release source · Runtime guarantees · Capability guides

from cayu.tools import StaticToolExposurePolicy

Expose one deterministic named allow-list, including an empty list.

Bases: ToolExposurePolicy.

StaticToolExposurePolicy.execution_profile_identity() -> ExecutionProfileBehaviorIdentity | None

Return a stable application declaration, or None when non-portable.

StaticToolExposurePolicy.select(request: ToolExposurePolicyRequest) -> ToolExposureDecision
StaticToolExposurePolicy.__init__(*, profile_id: str, tools: Iterable[str]) -> None
StaticToolExposurePolicy.profile_id() -> str
StaticToolExposurePolicy.tools() -> tuple[str, ...]

Release source · Runtime guarantees · Capability guides

from cayu.tools import TOOL_CAPABILITY_CEILING_SCHEMA_VERSION
TOOL_CAPABILITY_CEILING_SCHEMA_VERSION = 1

Release source · Runtime guarantees · Capability guides

from cayu.tools import TOOL_EXPOSURE_MAX_CATALOG_BYTES
TOOL_EXPOSURE_MAX_CATALOG_BYTES = TOOL_CATALOGUE_MAX_BYTES

Release source · Runtime guarantees · Capability guides

from cayu.tools import TOOL_EXPOSURE_MAX_REGISTERED_TOOLS
TOOL_EXPOSURE_MAX_REGISTERED_TOOLS = TOOL_CATALOGUE_MAX_TOOLS

Release source · Runtime guarantees · Capability guides

from cayu.tools import TOOL_EXPOSURE_METADATA_MAX_BYTES
TOOL_EXPOSURE_METADATA_MAX_BYTES = 4 * 1024

Release source · Runtime guarantees · Capability guides

from cayu.tools import TOOL_EXPOSURE_METADATA_MAX_ENTRIES
TOOL_EXPOSURE_METADATA_MAX_ENTRIES = 64

Release source · Runtime guarantees · Capability guides

from cayu.tools import TOOL_EXPOSURE_PROFILE_ID_MAX_CHARS
TOOL_EXPOSURE_PROFILE_ID_MAX_CHARS = 256

Release source · Runtime guarantees · Capability guides

from cayu.tools import TOOL_EXPOSURE_SCHEMA_VERSION
TOOL_EXPOSURE_SCHEMA_VERSION = 2

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolCapabilityCeiling

Immutable maximum application-tool set for one durable session.

Callers name already registered tools. The runtime canonicalizes those names to registration order before the ceiling becomes session authority. Its fingerprint is safe identity evidence; it does not contain schemas, tool implementations, policy bodies, credentials, or arguments.

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
schema_version Literal[1] TOOL_CAPABILITY_CEILING_SCHEMA_VERSION
tool_names tuple[str, ...] ()
fingerprint str ''
ToolCapabilityCeiling.copy_tool_names(value: object) -> tuple[Any, ...]
ToolCapabilityCeiling.validate_tool_names(value: tuple[str, ...]) -> tuple[str, ...]
ToolCapabilityCeiling.validate_and_bind_fingerprint() -> ToolCapabilityCeiling

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolExposure

Content-minimized public evidence for one prepared model-step tool projection.

The record intentionally contains no separate tool-name list, definitions, policy metadata, arguments, or policy reasoning. profile_id is a public, application-selected non-secret label. The fingerprint binds the record to the exact ordered definitions retained privately by the runtime.

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
schema_version Literal[2] TOOL_EXPOSURE_SCHEMA_VERSION
execution_profile_fingerprint str Field(min_length=64, max_length=64, pattern='^[0-9a-f]{64}$')
profile_id str required
catalogue_revision str required
exposure_fingerprint str Field(min_length=64, max_length=64, pattern='^[0-9a-f]{64}$')
registered_count StrictInt Field(ge=0, le=TOOL_EXPOSURE_MAX_REGISTERED_TOOLS)
ceiling_count StrictInt Field(ge=0, le=TOOL_EXPOSURE_MAX_REGISTERED_TOOLS)
exposed_count StrictInt Field(ge=0, le=TOOL_EXPOSURE_MAX_REGISTERED_TOOLS)
profile_changed StrictBool required
step StrictInt Field(ge=1, le=MAX_DURABLE_JSON_INTEGER)
provider_name str required
model str required
model_step_id str required
ToolExposure.validate_schema_version(value: object) -> object
ToolExposure.validate_profile_id(value: str) -> str
ToolExposure.validate_catalogue_revision(value: str) -> str
ToolExposure.validate_identity(value: str, info) -> str
ToolExposure.validate_model_step_id(value: str) -> str
ToolExposure.validate_counts() -> ToolExposure

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolExposureDecision

A policy decision naming registered tools, never tool implementations.

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
profile_id str required
tool_names tuple[str, ...] ()
metadata Mapping[str, Any] Field(default_factory=dict)
ToolExposureDecision.validate_profile_id(value: str) -> str
ToolExposureDecision.copy_tool_names(value: object) -> tuple[Any, ...]
ToolExposureDecision.validate_tool_names(value: tuple[str, ...]) -> tuple[str, ...]
ToolExposureDecision.copy_metadata(value: object) -> dict[str, Any]
ToolExposureDecision.freeze_metadata(value: Mapping[str, Any]) -> Mapping[str, Any]
ToolExposureDecision.serialize_metadata(value: Mapping[str, Any]) -> dict[str, Any]

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolExposurePolicy

Pure application policy selecting a subset of registered tools.

Implementations receive only copied immutable records. They must be local, deterministic, and side-effect-free: selection is part of preparing one model request, not an authorization or model-routing hook.

Bases: ABC.

ToolExposurePolicy.execution_profile_identity() -> ExecutionProfileBehaviorIdentity | None

Return a stable application declaration, or None when non-portable.

ToolExposurePolicy.select(request: ToolExposurePolicyRequest) -> ToolExposureDecision

Select registered tool names for one model step.

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolExposurePolicyRequest

Immutable, bounded input supplied to a tool-exposure policy.

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
session_id str required
agent_name str required
provider_name str required
model str required
step StrictInt Field(ge=1, le=MAX_DURABLE_JSON_INTEGER)
transcript_cursor StrictInt Field(default=0, ge=0)
catalogue_revision str required
registered_tools tuple[RegisteredToolCapability, ...] required
capability_ceiling tuple[str, ...] required
previous_profile_id str | None None
metadata Mapping[str, Any] Field(default_factory=dict)
ToolExposurePolicyRequest.validate_identity_text(value: str, info) -> str
ToolExposurePolicyRequest.validate_previous_profile_id(value: str | None) -> str | None
ToolExposurePolicyRequest.validate_catalogue_revision(value: str) -> str
ToolExposurePolicyRequest.copy_registered_tools(value: object) -> tuple[RegisteredToolCapability, ...]
ToolExposurePolicyRequest.copy_capability_ceiling(value: object) -> tuple[Any, ...]
ToolExposurePolicyRequest.validate_capability_ceiling(value: tuple[str, ...]) -> tuple[str, ...]
ToolExposurePolicyRequest.copy_metadata(value: object) -> dict[str, Any]
ToolExposurePolicyRequest.freeze_metadata(value: Mapping[str, Any]) -> Mapping[str, Any]
ToolExposurePolicyRequest.serialize_metadata(value: Mapping[str, Any]) -> dict[str, Any]
ToolExposurePolicyRequest.validate_catalog() -> ToolExposurePolicyRequest
ToolExposurePolicyRequest.eligible_tools() -> tuple[RegisteredToolCapability, ...]

Return ceiling-constrained capabilities in canonical registration order.

Release source · Runtime guarantees · Capability guides