Tool API¶
Tool
¶
Tool(*, name: Optional[str] = None, description: Optional[str] = None, parameters: Optional[ToolParams] = None, enabled: bool = True, timeout: Optional[int] = None, **kwargs)
flowchart TD
ms_enclave.sandbox.tools.base.Tool[Tool]
click ms_enclave.sandbox.tools.base.Tool href "" "ms_enclave.sandbox.tools.base.Tool"
Base class for all tools.
Methods:
-
execute–Execute the tool with given sandbox context and parameters.
-
is_compatible_with_sandbox–Check if this tool is compatible with the given sandbox type.
Attributes:
-
required_sandbox_types(Optional[List[SandboxType]]) –Return the list of sandbox types this tool can run in.
Source code in ms_enclave/sandbox/tools/base.py
required_sandbox_types
abstractmethod
property
¶
Return the list of sandbox types this tool can run in.
If a tool specifies required_sandbox_types, it can be used in:
1. Sandboxes whose type is in that list
2. Sandboxes that "inherit" from any of those types (e.g., DOCKER_NOTEBOOK
inherits from DOCKER and can therefore use tools requiring DOCKER)
Returns:
is_compatible_with_sandbox
¶
is_compatible_with_sandbox(sandbox_type: SandboxType) -> bool
Check if this tool is compatible with the given sandbox type.
Parameters:
-
(sandbox_type¶SandboxType) –The sandbox type to check compatibility with
Returns:
-
bool–True if the tool can be used in the given sandbox type
Source code in ms_enclave/sandbox/tools/base.py
ToolFactory
¶
Factory for creating tool instances.