cayu.testing.ToolContext
Part of cayu.testing.base. Read the Python API overview and install the required extra.
from cayu.testing import ToolContextBases: 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 |
|---|---|---|
execution_deadline |
ExecutionDeadline |
Field(default_factory=current_execution_deadline, exclude_if=lambda boundary: boundary.expires_at is None) |
image_decode_limits |
dict[str, int] | None |
Field(default=None, exclude_if=lambda value: value is None) |
session_id |
str |
required |
agent_name |
str | None |
None |
environment_name |
str | None |
None |
causal_budget_id |
str | None |
None |
workspace_id |
str | None |
None |
artifact_store_id |
str | None |
None |
idempotency_key |
str | None |
None |
workspace |
WorkspaceHandle | None |
Field(default=None, exclude=True) |
artifact_store |
ArtifactStoreHandle | None |
Field(default=None, exclude=True) |
runner |
RunnerHandle | None |
Field(default=None, exclude=True) |
invocation_secret_redactor |
Callable[[], Any] | None |
Field(default=None, exclude=True) |
invocation_secret_snapshot_provider |
Callable[[], Any] | None |
Field(default=None, exclude=True) |
invocation_secret_capture_observer |
Callable[[int], None] | None |
Field(default=None, exclude=True) |
vault |
VaultHandle | None |
Field(default=None, exclude=True) |
proxy |
CredentialProxyHandle | None |
Field(default=None, exclude=True) |
knowledge_store |
KnowledgeStoreHandle | None |
Field(default=None, exclude=True) |
knowledge_access_scope |
Any |
Field(default=None, exclude=True) |
mcp_servers |
tuple[Any, ...] |
Field(default_factory=tuple, exclude=True) |
metadata |
dict[str, Any] |
Field(default_factory=dict) |
inference (property)
Section titled “inference (property)”ToolContext.inference() -> InferenceInvoker | NoneOptional runtime-owned inference handle, valid only during this tool call.
workspace_reference_binding (method)
Section titled “workspace_reference_binding (method)”ToolContext.workspace_reference_binding() -> WorkspaceReferenceBindingObserve the admitted workspace after factory materialization and binding.
A detached/deserialized context has no live authority and fails closed. Public workspace_id and application metadata cannot supply this authority.
require_workspace_binding (method)
Section titled “require_workspace_binding (method)”ToolContext.require_workspace_binding(binding: WorkspaceReferenceBinding) -> NoneReject a foreign or unavailable binding before consuming its claims.
copy_metadata (method)
Section titled “copy_metadata (method)”ToolContext.copy_metadata(value: dict[str, Any]) -> dict[str, Any]validate_nonblank_session_id (method)
Section titled “validate_nonblank_session_id (method)”ToolContext.validate_nonblank_session_id(value: str, info) -> strvalidate_optional_nonblank_ids (method)
Section titled “validate_optional_nonblank_ids (method)”ToolContext.validate_optional_nonblank_ids(value: str | None, info) -> str | Nonecopy_mcp_servers (method)
Section titled “copy_mcp_servers (method)”ToolContext.copy_mcp_servers(value)