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
"auto_resume": True, # resume when traffic arrives
32
+
"auto_resume": True, # resume when activity arrives
33
33
},
34
34
)
35
35
```
@@ -54,6 +54,59 @@ sandbox = Sandbox.create(
54
54
55
55
If you use `autoResume: false`, resume explicitly with [`Sandbox.connect()`](/docs/sandbox/connect).
56
56
57
+
## What counts as activity
58
+
59
+
Auto-resume is triggered by the sandbox activity - that's both HTTP traffic and controlling the sandbox from the SDK.
60
+
61
+
That includes SDK operations like:
62
+
-`sandbox.commands.run(...)`
63
+
-`sandbox.files.read(...)`
64
+
-`sandbox.files.write(...)`
65
+
- opening a tunneled app URL or sending requests to a service running inside the sandbox
66
+
67
+
If a sandbox is paused and `autoResume` is enabled, the next supported operation resumes it automatically. You do not need to call [`Sandbox.connect()`](/docs/sandbox/connect) first.
68
+
69
+
### SDK example: pause, then read a file
70
+
71
+
<CodeGroup>
72
+
```js JavaScript & TypeScript
73
+
import { Sandbox } from'e2b'
74
+
75
+
constsandbox=awaitSandbox.create({
76
+
timeoutMs:10*60*1000,
77
+
lifecycle: {
78
+
onTimeout:'pause',
79
+
autoResume:true,
80
+
},
81
+
})
82
+
83
+
awaitsandbox.files.write('/home/user/hello.txt', 'hello from a paused sandbox')
0 commit comments