Skip to content

Commit 7821f75

Browse files
authored
chore: Update sandbox creation method and lifecycle management in OpenClaw and OpenCode documentation (#151)
- Removed use uneccecary use of `Sandbox.betaCreate` in persistence.mdx just above the already existing and up-to-date Sandbox.create with the updated lifecycle config - Updated lifecycle configuration in opencode.mdx and openclaw.mdx to use `onTimeout: 'pause'` instead of depricated `autoPause: true`.
1 parent aa0441a commit 7821f75

3 files changed

Lines changed: 14 additions & 29 deletions

File tree

docs/agents/openclaw.mdx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -386,17 +386,19 @@ sandbox.kill()
386386

387387
OpenClaw has a built-in [web UI and chat interface](https://openclaw.ai) served by its gateway. Start it inside a sandbox and connect from your browser.
388388

389-
<Warning>
390-
This sandbox is created with a 10-minute timeout and auto-pause enabled. After 10 minutes of inactivity it pauses and can be resumed later. See [Sandbox Persistence](/docs/sandbox/persistence) and [Sandbox Lifecycle](/docs/sandbox) for more details.
391-
</Warning>
389+
<Warning>
390+
This sandbox is created with a 10-minute timeout and auto-pause enabled. After 10 minutes of inactivity it pauses and can be resumed later. See [Sandbox Persistence](/docs/sandbox/persistence) and [Sandbox Lifecycle](/docs/sandbox) for more details.
391+
</Warning>
392392

393393
<CodeGroup>
394394
```typescript JavaScript & TypeScript
395395
import { Sandbox } from 'e2b'
396396

397-
const sandbox = await Sandbox.betaCreate('openclaw', {
397+
const sandbox = await Sandbox.create('openclaw', {
398398
envs: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY },
399-
autoPause: true,
399+
lifecycle: {
400+
onTimeout: 'pause',
401+
},
400402
timeoutMs: 10 * 60 * 1000,
401403
})
402404

@@ -498,9 +500,9 @@ python build.py
498500
## Related guides
499501

500502
<CardGroup cols={3}>
501-
<Card title="Sandbox persistence" icon="clock" href="/docs/sandbox/persistence">
502-
Auto-pause, resume, and manage sandbox lifecycle
503-
</Card>
503+
<Card title="Sandbox persistence" icon="clock" href="/docs/sandbox/persistence">
504+
Auto-pause, resume, and manage sandbox lifecycle
505+
</Card>
504506
<Card title="Git integration" icon="code-branch" href="/docs/sandbox/git-integration">
505507
Clone repos, manage branches, and push changes
506508
</Card>

docs/agents/opencode.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,11 @@ OpenCode includes a [headless HTTP server](https://opencode.ai/docs/server/) tha
120120
import { Sandbox } from 'e2b'
121121
import { createOpencodeClient } from '@opencode-ai/sdk'
122122

123-
const sandbox = await Sandbox.betaCreate('opencode', {
123+
const sandbox = await Sandbox.create('opencode', {
124124
envs: { ANTHROPIC_API_KEY: process.env.ANTHROPIC_API_KEY },
125-
autoPause: true,
125+
lifecycle: {
126+
onTimeout: 'pause', // "pause" | "kill"
127+
},
126128
timeoutMs: 10 * 60 * 1000,
127129
})
128130

docs/sandbox/persistence.mdx

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -260,25 +260,6 @@ If you call `.kill()`, the sandbox is permanently deleted and cannot be resumed.
260260

261261
For auto-resume behavior, see [AutoResume](/docs/sandbox/auto-resume).
262262

263-
<CodeGroup>
264-
```js JavaScript & TypeScript
265-
import { Sandbox } from '@e2b/code-interpreter'
266-
267-
// Create sandbox with auto-pause enabled
268-
const sandbox = await Sandbox.betaCreate({
269-
autoPause: true // Auto-pause after the sandbox times out
270-
})
271-
```
272-
```python Python
273-
from e2b_code_interpreter import Sandbox
274-
275-
# Create sandbox with auto-pause enabled
276-
sandbox = Sandbox.beta_create(
277-
auto_pause=True # Auto-pause after the sandbox times out
278-
)
279-
```
280-
</CodeGroup>
281-
282263
## Network
283264
If you have a service (for example a server) running inside your sandbox and you pause the sandbox, the service won't be accessible from the outside and all the clients will be disconnected.
284265
If you resume the sandbox, the service will be accessible again but you need to connect clients again.

0 commit comments

Comments
 (0)