Skip to main content

Module state_schema

Module state_schema 

Source
Expand description

Versioned state schemas: explicit schema versioning and migration for durable state.

Following the principle of “state as a first-class citizen” (Hitchhiker’s Guide to Agentic AI, Section 18.6), all serialized state carries an explicit schema version so that forward/backward migration is safe and auditable.

§Schema History

VersionDescription
v0Implicit — no schema version field present (legacy snapshots, pre-2025)
v1Initial explicit schema. Adds per-message metadata scaffolding.
v2Snapshot-local turn linkage and diagnostics; unrelated state remains on v1.

§Migration

Every VersionedState implementor provides a migrate() method that walks from its current version to the target, one step at a time. A snapshot at v0 is first migrated to v1, then to v2, and so on. This keeps each migration step small and testable.

Structs§

SchemaVersion
Explicit schema version for durable agent state.

Traits§

VersionedState
Trait for types whose serialized representation carries a schema version and can be migrated forward to a newer version.