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
**Note:** Currently, Steel doesn’t support editing the timeout duration of a live session.
56
56
57
+
### Inactivity Timeout
58
+
59
+
By default a session runs until its `timeout` elapses, even when nothing is driving the browser. Set `inactivityTimeout` to release the session early once it stops seeing activity—any CDP command or remote input—so you don’t keep paying for an idle browser while waiting on an external step.
60
+
61
+
<CodeTabsstorage="languageSwitcher">
62
+
63
+
```typescript !! Typescript -wcn
64
+
importSteelfrom'steel-sdk';
65
+
66
+
const client =newSteel();
67
+
68
+
// Release the session after 1 minute with no CDP or input activity,
69
+
// capped at a 10-minute hard limit.
70
+
const session =awaitclient.sessions.create({
71
+
timeout: 600000, // 10 minutes (hard cap)
72
+
inactivityTimeout: 60000, // release after 1 minute of inactivity
73
+
});
74
+
```
75
+
76
+
77
+
```python !! Python -wcn
78
+
import os
79
+
from steel import Steel
80
+
81
+
client = Steel()
82
+
83
+
# Release the session after 1 minute with no CDP or input activity,
84
+
# capped at a 10-minute hard limit.
85
+
session = client.sessions.create(
86
+
api_timeout=600000, # 10 minutes (hard cap)
87
+
inactivity_timeout=60000, # release after 1 minute of inactivity
88
+
)
89
+
```
90
+
</CodeTabs>
91
+
92
+
**Note:**`timeout` is always the hard cap on a session’s lifetime. If `inactivityTimeout` is greater than or equal to `timeout` it has no effect—`timeout` elapses first. Omit `inactivityTimeout` to disable inactivity-based release (the default).
93
+
57
94
### **Releasing a Session**
58
95
59
96
When you're done with a session, it's best practice to release it explicitly rather than waiting for the timeout. You can release a session any time before the timeout is up by calling the `release` method.
0 commit comments