Skip to main content
Resume interrupted sessions to continue where you left off.
The user reopens the same session ID after a crash or deploy and the agent continues the in-flight task.

Quick Start

1

Simple Usage

Reopen a session by its ID and call resume() to continue the in-flight task.
2

With Configuration

Add automatic checkpoints so long tasks resume from the latest step, not the start.

How It Works


Basic Resume

With Checkpoints

Manual Checkpoints

List Sessions

Best Practices

resume() finds prior state by session_id. Store the ID (env var, queue message, or DB row) so a restarted process reopens the right session.
Frequent checkpoints cost writes but lose less on failure. For step-heavy tasks, a small interval like checkpoint_interval=5 balances safety and overhead.
Call session.save_state({...}) after a meaningful unit of work so session.restore_state() reopens at a clean point when the same session_id resumes.
Session.list_all(persistence=...) shows every stored session and its status — useful for dashboards and cleanup jobs.

Session Module

Session API reference

Checkpoints

Checkpoint API