agents_persistence/lib.rs
1//! Database-backed persistence implementations for agent checkpointing.
2//!
3//! This crate provides production-ready checkpointer implementations for various
4//! storage backends, allowing users to choose the persistence layer that best
5//! fits their infrastructure.
6//!
7//! ## Available Backends
8//!
9//! - **Redis**: High-performance in-memory data store with optional persistence
10//! - **PostgreSQL**: Robust relational database with ACID guarantees
11//! - **DynamoDB**: AWS-managed NoSQL database (available in `agents-aws` crate)
12//!
13//! ## Feature Flags
14//!
15//! - `redis`: Enable Redis checkpointer
16//! - `postgres`: Enable PostgreSQL checkpointer
17//! - `all`: Enable all backends
18//!
19//! ## Examples
20//!
21//! ### Redis Checkpointer
22//!
23//! ```rust,no_run
24//! use agents_persistence::RedisCheckpointer;
25//!
26//! #[tokio::main]
27//! async fn main() -> anyhow::Result<()> {
28//! let checkpointer = RedisCheckpointer::new("redis://127.0.0.1:6379").await?;
29//! // Use with ConfigurableAgentBuilder
30//! Ok(())
31//! }
32//! ```
33//!
34//! ### PostgreSQL Checkpointer
35//!
36//! ```rust,no_run
37//! use agents_persistence::PostgresCheckpointer;
38//!
39//! #[tokio::main]
40//! async fn main() -> anyhow::Result<()> {
41//! let checkpointer = PostgresCheckpointer::new(
42//! "postgresql://user:pass@localhost/agents"
43//! ).await?;
44//! // Use with ConfigurableAgentBuilder
45//! Ok(())
46//! }
47//! ```
48
49#[cfg(feature = "redis")]
50pub mod redis_checkpointer;
51
52#[cfg(feature = "postgres")]
53pub mod postgres_checkpointer;
54
55#[cfg(feature = "redis")]
56pub use redis_checkpointer::RedisCheckpointer;
57
58#[cfg(feature = "postgres")]
59pub use postgres_checkpointer::PostgresCheckpointer;
60
61// Re-export core types for convenience
62pub use agents_core::persistence::{Checkpointer, ThreadId};
63pub use agents_core::state::AgentStateSnapshot;