Skip to content

cayu.tools.result_projection

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.

ARTIFACT_EXTERNALIZING_TOOL_RESULT_POLICY_ID

Section titled “ARTIFACT_EXTERNALIZING_TOOL_RESULT_POLICY_ID”
from cayu.tools import ARTIFACT_EXTERNALIZING_TOOL_RESULT_POLICY_ID
ARTIFACT_EXTERNALIZING_TOOL_RESULT_POLICY_ID = 'cayu.artifact_externalizing_tool_result.v1'

Release source · Runtime guarantees · Capability guides

from cayu.tools import ArtifactExternalizingToolResultPolicy

Externalize oversized redacted text through the configured ArtifactStore.

Decorators: @dataclass(frozen=True, slots=True, init=False).

Bases: ToolResultProjectionPolicy.

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_inline_bytes int | None required
max_inline_token_estimate int | None required
preview_bytes int required
chars_per_token int required
ArtifactExternalizingToolResultPolicy.identity() -> str
async ArtifactExternalizingToolResultPolicy.project(request: ToolResultProjectionRequest) -> ToolResultProjection
ArtifactExternalizingToolResultPolicy.__init__(*, max_inline_bytes: int | None=DEFAULT_TOOL_RESULT_MAX_INLINE_BYTES, max_inline_token_estimate: int | None=DEFAULT_TOOL_RESULT_MAX_INLINE_TOKEN_ESTIMATE, preview_bytes: int=DEFAULT_TOOL_RESULT_PREVIEW_BYTES, chars_per_token: int=DEFAULT_TOOL_RESULT_ESTIMATE_CHARS_PER_TOKEN) -> None
ArtifactExternalizingToolResultPolicy.token_estimation_method() -> str
ArtifactExternalizingToolResultPolicy.readback_max_bytes() -> int

Largest generated text read guaranteed to stay inline under this policy.

ArtifactExternalizingToolResultPolicy.estimate_tokens(text: str) -> int

Release source · Runtime guarantees · Capability guides

from cayu.tools import copy_tool_result_projection_policy

Validate a policy collaborator; the built-in policy is immutable.

copy_tool_result_projection_policy(policy: ToolResultProjectionPolicy | None) -> ToolResultProjectionPolicy | None

Release source · Runtime guarantees · Capability guides

DEFAULT_TOOL_RESULT_ESTIMATE_CHARS_PER_TOKEN

Section titled “DEFAULT_TOOL_RESULT_ESTIMATE_CHARS_PER_TOKEN”
from cayu.tools import DEFAULT_TOOL_RESULT_ESTIMATE_CHARS_PER_TOKEN
DEFAULT_TOOL_RESULT_ESTIMATE_CHARS_PER_TOKEN = 4

Release source · Runtime guarantees · Capability guides

from cayu.tools import DEFAULT_TOOL_RESULT_MAX_INLINE_BYTES
DEFAULT_TOOL_RESULT_MAX_INLINE_BYTES = 32 * 1024

Release source · Runtime guarantees · Capability guides

DEFAULT_TOOL_RESULT_MAX_INLINE_TOKEN_ESTIMATE

Section titled “DEFAULT_TOOL_RESULT_MAX_INLINE_TOKEN_ESTIMATE”
from cayu.tools import DEFAULT_TOOL_RESULT_MAX_INLINE_TOKEN_ESTIMATE
DEFAULT_TOOL_RESULT_MAX_INLINE_TOKEN_ESTIMATE = 8 * 1024

Release source · Runtime guarantees · Capability guides

from cayu.tools import DEFAULT_TOOL_RESULT_PREVIEW_BYTES
DEFAULT_TOOL_RESULT_PREVIEW_BYTES = 2 * 1024

Release source · Runtime guarantees · Capability guides

from cayu.tools import MAX_PROJECTED_TOOL_RESULT_CONTENT_BYTES
MAX_PROJECTED_TOOL_RESULT_CONTENT_BYTES = 64 * 1024

Release source · Runtime guarantees · Capability guides

from cayu.tools import MAX_TOOL_RESULT_ARTIFACT_REFERENCE_BYTES
MAX_TOOL_RESULT_ARTIFACT_REFERENCE_BYTES = 4 * 1024

Release source · Runtime guarantees · Capability guides

from cayu.tools import MAX_TOOL_RESULT_PREVIEW_BYTES
MAX_TOOL_RESULT_PREVIEW_BYTES = MAX_PROJECTED_TOOL_RESULT_CONTENT_BYTES - 4 * 1024

Release source · Runtime guarantees · Capability guides

from cayu.tools import TOOL_RESULT_ARTIFACT_TYPE
TOOL_RESULT_ARTIFACT_TYPE = 'cayu.tool_result_artifact.v1'

Release source · Runtime guarantees · Capability guides

from cayu.tools import TOOL_RESULT_TOKEN_ESTIMATION_METHOD
TOOL_RESULT_TOKEN_ESTIMATION_METHOD = 'unicode_codepoints_divided_by_4_ceiling_v1'

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolResultProjection

Decorators: @dataclass(frozen=True, slots=True).

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
result ToolResult required
record ToolResultProjectionRecord required

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolResultProjectionPolicy

Projects final redacted tool results before durable terminal publication.

Bases: ABC.

ToolResultProjectionPolicy.identity() -> str

Stable, version-identifiable policy name used in durable evidence.

async ToolResultProjectionPolicy.project(request: ToolResultProjectionRequest) -> ToolResultProjection

Return a bounded model-facing result and content-free projection record.

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolResultProjectionRecord

Bounded, content-free evidence for one configured projection 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[1] 1
status ToolResultProjectionStatus required
policy_id str required
original_bytes StrictInt Field(ge=0)
projected_bytes StrictInt Field(ge=0)
original_token_estimate StrictInt Field(ge=0)
projected_token_estimate StrictInt Field(ge=0)
token_estimation_method str required
artifact_id str | None None
artifact_sha256 str | None None
logical_identity_sha256 str | None None
tool_call_id_sha256 str | None None
failure_type str | None None
store_id_bytes StrictInt | None Field(default=None, ge=0)
store_id_max_bytes StrictInt | None Field(default=None, ge=1)
artifact_write_settlement ArtifactWriteSettlementEvidence | None None
ToolResultProjectionRecord.validate_identity_fields(value: str, info) -> str

validate_optional_identity_fields (method)

Section titled “validate_optional_identity_fields (method)”
ToolResultProjectionRecord.validate_optional_identity_fields(value: str | None, info) -> str | None
ToolResultProjectionRecord.copy_settlement_evidence(value: object) -> ArtifactWriteSettlementEvidence | None
ToolResultProjectionRecord.validate_status_fields() -> ToolResultProjectionRecord

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolResultProjectionRequest

Final redacted tool result plus the durable identity needed for projection.

Decorators: @dataclass(frozen=True, slots=True).

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
result ToolResult required
session_id str required
agent_name str required
environment_name str | None required
tool_call_id str required
artifact_store ArtifactStore | None required

Release source · Runtime guarantees · Capability guides

from cayu.tools import ToolResultProjectionStatus

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
UNCHANGED class attribute 'unchanged'
EXTERNALIZED class attribute 'externalized'
FAILED class attribute 'failed'

Release source · Runtime guarantees · Capability guides