> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agentium.in/llms.txt
> Use this file to discover all available pages before exploring further.

# Daytona sandbox adapter

> Run Python or Node in an owned Daytona sandbox with a fixed language and bounded operations.

`DaytonaSandbox` implements `CloudSandbox`; `DaytonaSandboxToolkit` exposes Agent tools. Import from `@agentium/core/toolkits`.

```bash theme={null}
npm install @agentium/core@4.0.0 @daytona/sdk@0.220.0
npm install --save-dev tsx
export DAYTONA_API_KEY="your-key"
```

## Run code

This example creates a real remote sandbox. Save as `daytona.ts`, then use `npx tsx daytona.ts`.

```typescript daytona.ts theme={null}
import { DaytonaSandbox } from "@agentium/core/toolkits";

const sandbox = new DaytonaSandbox({
  language: "node",
  defaultTimeoutSeconds: 30,
  maxOutputBytes: 64 * 1024,
});
try {
  const result = await sandbox.run('console.log(6 * 7)', { language: "node" });
  if (result.exitCode !== 0) throw new Error(`Sandbox failed: ${result.output}`);
  console.log(result.output);
} finally {
  await sandbox.close();
}
```

Expect output containing `42`. The adapter imports the SDK and creates its sandbox lazily. `language` is fixed at creation; use separate instances for Python and Node. `baseURL` maps to the SDK's `apiUrl`. Optional `workspace` is a sandbox name, not an existing local directory.

## Borrow a client, own the sandbox

You may supply a `DaytonaSandboxClient` through `client`. Your host retains responsibility for that client, while the adapter still owns and deletes sandboxes it creates. Without a supplied client, it manages the client it constructed.

For a model-controlled workflow, use `DaytonaSandboxToolkit.getTools()` and close the toolkit after the Agent stops. A temporary remote session is not a durable workflow checkpoint.

## Failure and cleanup

Close waits for bounded SDK work and deletes the owned sandbox once. A cancellation or timeout can leave remote execution uncertain, so reconcile effects before replaying. Nonzero exits and code errors remain failures; only file-not-found responses become null. See [sandbox lifecycle](/features/sandbox-toolkits) and [execution policy](/agents/execution-policy).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.