Expand description
Database-backed persistence implementations for agent checkpointing.
This crate provides production-ready checkpointer implementations for various storage backends, allowing users to choose the persistence layer that best fits their infrastructure.
§Available Backends
- Redis: High-performance in-memory data store with optional persistence
- PostgreSQL: Robust relational database with ACID guarantees
- DynamoDB: AWS-managed NoSQL database (available in
agents-aws
crate)
§Feature Flags
redis
: Enable Redis checkpointerpostgres
: Enable PostgreSQL checkpointerall
: Enable all backends
§Examples
§Redis Checkpointer
use agents_persistence::RedisCheckpointer;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let checkpointer = RedisCheckpointer::new("redis://127.0.0.1:6379").await?;
// Use with ConfigurableAgentBuilder
Ok(())
}
§PostgreSQL Checkpointer
use agents_persistence::PostgresCheckpointer;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
let checkpointer = PostgresCheckpointer::new(
"postgresql://user:pass@localhost/agents"
).await?;
// Use with ConfigurableAgentBuilder
Ok(())
}
Re-exports§
pub use redis_checkpointer::RedisCheckpointer;
pub use postgres_checkpointer::PostgresCheckpointer;
Modules§
- postgres_
checkpointer - PostgreSQL-backed checkpointer implementation with ACID guarantees.
- redis_
checkpointer - Redis-backed checkpointer implementation using connection pooling.
Structs§
- Agent
State Snapshot - Snapshot of agent state shared between runtime, planners, and tools.
Traits§
- Checkpointer
- Trait for persisting and retrieving agent state between conversation runs. This mirrors the LangGraph Checkpointer interface used in the Python implementation.
Type Aliases§
- Thread
Id - Unique identifier for a conversation thread/session.