You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
# Example: app source already exists in /home/user/app.
99
+
# Replace this command with your API server, Next.js, Vite, etc.
100
+
sandbox.commands.run(
101
+
"cd /home/user/app && npm install && npm run dev -- --host 0.0.0.0 --port 3000",
102
+
background=True,
103
+
)
91
104
92
-
host= sandbox.get_host(8080)
93
-
print(f"Web server URL: https://{host}")
105
+
preview_host= sandbox.get_host(3000)
106
+
print(f"Preview URL: https://{preview_host}")
94
107
```
95
108
</CodeGroup>
96
109
97
110
### Agent/tool execution
98
111
99
-
The same lifecycle configuration works for agent and tool workloads: after timeout, the sandbox pauses, and the next execution request can wake it automatically.
112
+
For queued tasks or tool calls, create once, store the sandbox ID, and reconnect per task. If the sandbox is paused, `connect` resumes it.
0 commit comments