Skip to main content

Module persistence

Module persistence 

Source
Expand description

Persistence support for @persistent agent beliefs.

This module provides the runtime support for persistent agent state:

  • CheckpointStore trait for storage backends
  • Persisted<T> wrapper for auto-checkpointing fields
  • AgentCheckpoint for managing agent-level persistence

§Backends

The following backends are available via feature flags:

  • persistence-sqlite: SQLite database (recommended for local development)
  • persistence-postgres: PostgreSQL (recommended for production)
  • persistence-file: JSON files (useful for debugging)

Without any persistence feature, only MemoryCheckpointStore is available.

Structs§

MemoryCheckpointStore
In-memory checkpoint store for testing.
Persisted
A wrapper for @persistent fields that auto-checkpoints on modification.

Traits§

CheckpointStore
A checkpoint store for persisting agent state.

Functions§

agent_checkpoint_key
Helper to generate a unique checkpoint key for an agent instance.
checkpoint_all
Helper to save all @persistent fields atomically before yield.