Skip to main content

Module state_store

Module state_store 

Source
Expand description

Where managed session state lives, and whether it survives the process.

CheckpointManager holds events and run state in a Vec and a struct field. That supports replay and resume within a process and nothing more: a crash loses event history, parked-tool state, sequence position, and lifecycle status even when the nested Runner has already written conversation events through the SessionService. A new process cannot resume a session another process started.

The problem was not the in-memory implementation — it is a reasonable default — but that nothing distinguished it from a durable one. There was no seam to implement against, no way for a caller to ask what guarantee it had, and the crate described itself as durable.

ManagedStateStore is that seam. InMemoryManagedStateStore is the in-memory backend, named as such, reporting Durability::ProcessLocal. A durable implementation is not shipped; a caller can now detect that instead of assuming otherwise.

§Example

use adk_managed::state_store::{Durability, InMemoryManagedStateStore, ManagedStateStore};

let store = InMemoryManagedStateStore::new();
assert_eq!(store.durability(), Durability::ProcessLocal);
assert!(!store.durability().survives_process_loss());

Structs§

FileManagedStateStore
Records each session as one JSON file under a directory.
InMemoryManagedStateStore
The in-memory managed state store.
ManagedSessionState
A snapshot of one managed session’s state.

Enums§

Durability
What a store guarantees about state after the writing process ends.

Traits§

ManagedStateStore
Storage for managed session state.