Sandbox
client.sandbox — start dev sessions, exec commands, and read/write files in the sandbox runtime.
On this page3
client.sandbox manages sandbox sessions for isolated code execution (the same
runtime that powers agent Bash when AGENT_BASH_BACKEND=sandbox).
Methods
| Method | Description |
|---|---|
startSession(params, options?) | Start a session (workflowId, optional vaultId) |
stopSession(sessionId, options?) | Stop session |
getHealth(sessionId, options?) | { alive: boolean } |
exec(sessionId, command, options?) | Run shell command → ExecResult |
listFiles(sessionId, dir?, options?) | List files in sandbox |
readFile(sessionId, path, options?) | Read file as string or null |
writeFile(sessionId, path, content, options?) | Write file |
deleteFile(sessionId, path, options?) | Delete file |
const session = await client.sandbox.startSession({
workflowId,
vaultId,
})
const health = await client.sandbox.getHealth(session.id)
const result = await client.sandbox.exec(session.id, 'node --version')
console.log(result.stdout, result.exitCode)
const files = await client.sandbox.listFiles(session.id, '/trickest/sandbox')
await client.sandbox.writeFile(session.id, '/trickest/sandbox/probe.txt', 'hello')
await client.sandbox.stopSession(session.id)Types
SandboxSession,ExecResult,SandboxFile