Documentation / @agentick/sandbox / useSandbox
Function: useSandbox() ​
useSandbox():
SandboxHandle
Defined in: context.ts:29
Access the nearest Sandbox from the component tree.
Returns ​
Throws ​
Error if no <Sandbox> provider is found in the tree.
Example ​
tsx
const Bash = createTool({
name: 'bash',
use: () => ({ sandbox: useSandbox() }),
handler: async ({ command }, deps) => {
const result = await deps!.sandbox.exec(command);
return [{ type: 'text', text: result.stdout }];
},
});