Skip to main content
The tool system allows scripts to interact with external systems through controlled callTool() invocations. Tools are the primary way for sandboxed code to perform actions and retrieve data.

Basic Tool Handler

Tool Handler Signature

Integrating with a Tool Registry

Connect enclave to your existing tool system:

Tool Call Limits

Prevent runaway scripts with tool call limits:
When the limit is exceeded, execution fails with error code MAX_TOOL_CALLS.

Custom Globals

Provide custom globals for scripts to access:

One-Shot Execution

For simple cases without a persistent enclave instance:

Tool Error Handling

Handle tool errors gracefully:

Securing Tool Access

Limit which tools are available based on context:

Async Tool Calls

Tools are always async, allowing for external API calls:

Tool Call Statistics

Track tool usage in execution stats: