Skip to content

Commit 387ab08

Browse files
committed
fix: update daytona example with correct install URL and timeout
- Fix install URL from latest to 0.1.3 - Add 180s timeout for sandbox creation - Add autoStopInterval: 0 to prevent auto-stop - Add log message explaining first run may be slow
1 parent c0c3ef6 commit 387ab08

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

examples/daytona/src/daytona.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,18 @@ import { logInspectorUrl, runPrompt } from "@sandbox-agent/example-shared";
44
const daytona = new Daytona();
55

66
const envVars: Record<string, string> = {};
7-
if (process.env.ANTHROPIC_API_KEY) envVars.ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
8-
if (process.env.OPENAI_API_KEY) envVars.OPENAI_API_KEY = process.env.OPENAI_API_KEY;
7+
if (process.env.ANTHROPIC_API_KEY)
8+
envVars.ANTHROPIC_API_KEY = process.env.ANTHROPIC_API_KEY;
9+
if (process.env.OPENAI_API_KEY)
10+
envVars.OPENAI_API_KEY = process.env.OPENAI_API_KEY;
911

1012
const image = Image.base("ubuntu:22.04").runCommands(
1113
"apt-get update && apt-get install -y curl ca-certificates",
12-
"curl -fsSL https://releases.rivet.dev/sandbox-agent/latest/install.sh | sh",
14+
"curl -fsSL https://releases.rivet.dev/sandbox-agent/0.1.3/install.sh | sh",
1315
);
1416

15-
const sandbox = await daytona.create({ envVars, image });
17+
console.log("Creating Daytona sandbox (first run builds the base image and may take a few minutes, subsequent runs are fast)...");
18+
const sandbox = await daytona.create({ envVars, image, autoStopInterval: 0 }, { timeout: 180 });
1619

1720
await sandbox.process.executeCommand(
1821
"nohup sandbox-agent server --no-token --host 0.0.0.0 --port 3000 >/tmp/sandbox-agent.log 2>&1 &",
@@ -28,8 +31,7 @@ const cleanup = async () => {
2831
process.once("SIGINT", cleanup);
2932
process.once("SIGTERM", cleanup);
3033

31-
// When running as root in a container, Claude requires interactive permission prompts
32-
// (bypass mode is not supported). Set autoApprovePermissions: true to auto-approve,
34+
// When running as root in a container, Claude requires interactive permission prompts (bypass mode is not supported). Set autoApprovePermissions: true to auto-approve,
3335
// or leave false for interactive prompts.
3436
await runPrompt({
3537
baseUrl,

0 commit comments

Comments
 (0)