Timeouts & cancellation
Give each phase its own deadline.
| Budget | TypeScript | Python | Default |
|---|---|---|---|
| Browser lifetime | timeoutSeconds | timeout_seconds | Instance default; 60–3,600 seconds |
| HTTP attempt | requestTimeoutMs | RequestOptions(request_timeout_ms=...) | 15 seconds |
| Acquisition | timeoutMs | RequestOptions(timeout_ms=...) | 5 minutes when capacity waiting is enabled |
| Owned readiness | readyTimeoutMs | ready_timeout_ms | 60 seconds |
| Owned cleanup | cleanupTimeoutMs | cleanup_timeout_ms | 30 seconds |
| Explicit readiness helper | waitUntilReady | wait_until_ready | 60 seconds |
| Explicit release helper | waitUntilReleased | wait_until_released | TypeScript 30 seconds; Python 60 seconds |
| Handoff wait | waitForHandoff | wait_for_handoff | 300 seconds |
Browser actions and model calls need their own framework deadlines.
Running browser updates
await client.sessions.update(sessionId, { timeoutSeconds: 1200 });
await client.sessions.update(sessionId, { idleTimeoutSeconds: 120 });
await client.sessions.touch(sessionId);timeoutSeconds is the new total lifetime from readiness. Extending it reserves the additional credit budget atomically. Existing connections follow the updated deadline. Idle timeout counts actual browser activity and explicit touch; observing state does not renew it. Both settings are bounded by 3,600 seconds. See session lifecycle.
Cancellation
With an initialized client:
const controller = new AbortController();
await client.withSession({
signal: controller.signal,
timeoutMs: 60_000,
cleanupTimeoutMs: 30_000,
timeoutSeconds: 300,
}, async (session) => {
// Pass controller.signal to any cancellable work you start here.
console.log(session.id);
});Call controller.abort() from your application's cancellation handler. Python uses task cancellation.
Acquisition timeouts do not bound the whole callback. Cancellation does not prove that a remote mutation failed; inspect unknown results. Owned cleanup runs with its independent budget. Explicitly created sessions remain your responsibility.