Reference
Session Restoration
Sandbox Agent automatically restores stale sessions when live session state is no longer available.
This is driven by the configured SessionPersistDriver (inMemory, IndexedDB, SQLite, Postgres, or custom).
How Auto-Restore Works
Section titled “How Auto-Restore Works”When you call session.prompt(...) (or resumeSession(...)) and the saved session points to a stale connection, the SDK:
- Recreates a fresh session for the same local session id.
- Rebinds the local session to the new runtime session id.
- Replays recent persisted events into the next prompt as context.
This happens automatically; you do not need to manually rebuild the session.
Replay Limits
Section titled “Replay Limits”Replay payload size is capped by:
replayMaxEvents(default50)replayMaxChars(default12000)
These controls limit prompt growth during restore while preserving recent context.