What runs where
What the sandbox provides
The handler signature is always:
What the sandbox forbids
Most of these are obvious from a security standpoint. The execution time and memory limits are platform stability — long-running tools should use the task pattern (see Task support below) rather than blocking the sandbox.
Secrets
Secrets are scoped to the Data Tool, not the project. Different tools can hold different keys — a Stripe key on one tool, a SendGrid key on another. Secrets are encrypted at rest via AWS KMS, decrypted at sandbox start, and accessible inside the handler asenv.secrets.<NAME>.
Allowed domains
The sandbox restricts outbound HTTP to the domains listed on the Data Tool. A handler that tries to fetch from a domain not on the list fails before the request leaves the sandbox. Configure allowed domains on the Data Tool:Execution limits
Default limits per invocation:Task support (long-running operations)
If a Data Tool needs more than 60 seconds — a long-running search, an external API that paginates, an AI-generated image — declare task support. The tool returns an immediate task token; the host polls for completion. Configure on the Data Tool:
Inside a task-supporting handler, use the task helper APIs (covered in Task patterns once shipped) to push intermediate progress and the final result.
Designing for the sandbox
A few principles that come up in practice:- Treat each call as cold. No caching across invocations inside the handler. Cache externally if you need to.
- Fail fast. Validate that secrets exist at the top of the handler. Throw with a useful message — the AI sees the error and can adjust.
- Use small, focused handlers. A Data Tool that does one thing well is easier to reason about than one that branches across many APIs.
- Stream when possible. If you’re proxying a large response, prefer streaming over buffering.
- Don’t log sensitive data.
console.logoutput is captured by platform observability; treat it like any other log surface.
Debugging
When a handler fails:- The error returns to the test panel (or to the AI on retry).
- The error appears in the project’s tool-call audit log with the timestamp, input, and stack trace where available.
console.logoutput is captured per call.
Related
Build a Data Tool
The end-to-end Data Tool walkthrough.
Governance
Where sandboxed execution fits in the broader governance model.
Audit logs
Per-call observability for debugging and review.
BindJS Reference
defineDataSource and the property system.