Skip to content

cayu.tools.files

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 ArtifactReader

Extension point for artifact-specific read behavior.

Bases: Protocol.

ArtifactReader.can_read(artifact: ArtifactMetadata) -> bool

Return true when this reader handles the artifact.

async ArtifactReader.read(request: ArtifactReadRequest) -> ToolResult

Read the artifact and return a model-facing tool result.

Release source · Runtime guarantees · Capability guides

from cayu.tools import ArtifactReadRequest

Decorators: @dataclass(frozen=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
ctx ToolContext required
artifact_store ArtifactStore required
artifact ArtifactMetadata required
initial_read ArtifactReadResult required
options ReadFileOptions required
structured dict required

Release source · Runtime guarantees · Capability guides

from cayu.tools import default_artifact_readers
default_artifact_readers() -> tuple[ArtifactReader, ...]

Release source · Runtime guarantees · Capability guides

from cayu.tools import DeleteFileTool

Delete one workspace file only when its content precondition matches.

Bases: Tool.

DeleteFileTool.__init__(spec: ToolSpec | None=None) -> None
DeleteFileTool.name() -> str
DeleteFileTool.execution_profile_identity() -> ExecutionProfileBehaviorIdentity | None

Return the stable behavior declaration frozen with this tool’s spec.

DeleteFileTool.retain_arguments_for_model() -> bool

Retain bounded redacted original inputs privately for the same profile.

Independent of audit publication; oversized and compacted-away inputs may be omitted. This does not grant knowledge read or activation rights.

DeleteFileTool.description() -> str
DeleteFileTool.schema() -> dict[str, Any]
async DeleteFileTool.run(ctx: ToolContext, args: dict) -> ToolResult

Release source · Runtime guarantees · Capability guides

from cayu.tools import EditFileTool

Apply exact text replacements to one existing workspace file.

Bases: Tool.

EditFileTool.__init__(spec: ToolSpec | None=None) -> None
EditFileTool.name() -> str
EditFileTool.execution_profile_identity() -> ExecutionProfileBehaviorIdentity | None

Return the stable behavior declaration frozen with this tool’s spec.

EditFileTool.retain_arguments_for_model() -> bool

Retain bounded redacted original inputs privately for the same profile.

Independent of audit publication; oversized and compacted-away inputs may be omitted. This does not grant knowledge read or activation rights.

EditFileTool.description() -> str
EditFileTool.schema() -> dict[str, Any]
async EditFileTool.run(ctx: ToolContext, args: dict) -> ToolResult

Release source · Runtime guarantees · Capability guides

from cayu.tools import ImageArtifactReader
ImageArtifactReader.can_read(artifact: ArtifactMetadata) -> bool
async ImageArtifactReader.read(request: ArtifactReadRequest) -> ToolResult

Release source · Runtime guarantees · Capability guides

from cayu.tools import ListArtifactsTool

Bases: Tool.

ListArtifactsTool.__init__(spec: ToolSpec | None=None) -> None
ListArtifactsTool.name() -> str
ListArtifactsTool.execution_profile_identity() -> ExecutionProfileBehaviorIdentity | None

Return the stable behavior declaration frozen with this tool’s spec.

ListArtifactsTool.retain_arguments_for_model() -> bool

Retain bounded redacted original inputs privately for the same profile.

Independent of audit publication; oversized and compacted-away inputs may be omitted. This does not grant knowledge read or activation rights.

ListArtifactsTool.description() -> str
ListArtifactsTool.schema() -> dict[str, Any]
async ListArtifactsTool.run(ctx: ToolContext, args: dict) -> ToolResult

Release source · Runtime guarantees · Capability guides

from cayu.tools import ListFilesTool

Bases: Tool.

ListFilesTool.__init__(*, exclude_directories: Iterable[str]=(), max_scan_entries: int=DEFAULT_LIST_SCAN_LIMIT) -> None
ListFilesTool.name() -> str
ListFilesTool.execution_profile_identity() -> ExecutionProfileBehaviorIdentity | None

Return the stable behavior declaration frozen with this tool’s spec.

ListFilesTool.retain_arguments_for_model() -> bool

Retain bounded redacted original inputs privately for the same profile.

Independent of audit publication; oversized and compacted-away inputs may be omitted. This does not grant knowledge read or activation rights.

ListFilesTool.description() -> str
ListFilesTool.schema() -> dict[str, Any]
async ListFilesTool.run(ctx: ToolContext, args: dict) -> ToolResult

Release source · Runtime guarantees · Capability guides

from cayu.tools import PdfArtifactReader
PdfArtifactReader.can_read(artifact: ArtifactMetadata) -> bool
async PdfArtifactReader.read(request: ArtifactReadRequest) -> ToolResult

Release source · Runtime guarantees · Capability guides

from cayu.tools import ReadFileOptions

Decorators: @dataclass(frozen=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
max_bytes int DEFAULT_READ_LIMIT_BYTES
max_attachment_bytes int DEFAULT_ATTACHMENT_LIMIT_BYTES
max_attachment_validation_bytes int DEFAULT_MAX_ATTACHMENT_LIMIT_BYTES
pages str | None None
image_region tuple[int, int, int, int] | None None
offset int 0

Release source · Runtime guarantees · Capability guides

from cayu.tools import ReadFileTool

Bases: Tool.

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
spec class attribute _read_file_tool_spec(default_attachment_limit_bytes=DEFAULT_ATTACHMENT_LIMIT_BYTES, max_attachment_limit_bytes=DEFAULT_MAX_ATTACHMENT_LIMIT_BYTES)
ReadFileTool.__init__(*, extra_artifact_readers: Iterable[ArtifactReader] | None=None, artifact_readers: Iterable[ArtifactReader] | None=None, default_attachment_limit_bytes: int=DEFAULT_ATTACHMENT_LIMIT_BYTES, max_attachment_limit_bytes: int=DEFAULT_MAX_ATTACHMENT_LIMIT_BYTES, spec: ToolSpec | None=None) -> None
ReadFileTool.name() -> str
ReadFileTool.execution_profile_identity() -> ExecutionProfileBehaviorIdentity | None

Return the stable behavior declaration frozen with this tool’s spec.

ReadFileTool.retain_arguments_for_model() -> bool

Retain bounded redacted original inputs privately for the same profile.

Independent of audit publication; oversized and compacted-away inputs may be omitted. This does not grant knowledge read or activation rights.

ReadFileTool.description() -> str
ReadFileTool.schema() -> dict[str, Any]
async ReadFileTool.run(ctx: ToolContext, args: dict) -> ToolResult

Release source · Runtime guarantees · Capability guides

from cayu.tools import TextArtifactReader
TextArtifactReader.can_read(artifact: ArtifactMetadata) -> bool
async TextArtifactReader.read(request: ArtifactReadRequest) -> ToolResult

Release source · Runtime guarantees · Capability guides

from cayu.tools import WriteFileTool

Bases: Tool.

WriteFileTool.__init__(spec: ToolSpec | None=None) -> None
WriteFileTool.name() -> str
WriteFileTool.execution_profile_identity() -> ExecutionProfileBehaviorIdentity | None

Return the stable behavior declaration frozen with this tool’s spec.

WriteFileTool.retain_arguments_for_model() -> bool

Retain bounded redacted original inputs privately for the same profile.

Independent of audit publication; oversized and compacted-away inputs may be omitted. This does not grant knowledge read or activation rights.

WriteFileTool.description() -> str
WriteFileTool.schema() -> dict[str, Any]
async WriteFileTool.run(ctx: ToolContext, args: dict) -> ToolResult

Release source · Runtime guarantees · Capability guides