Skip to main content

Multi-Backend State Persistence

Support for multiple storage backends including Redis, SQLite, and PostgreSQL.

Overview

Multi-backend support allows choosing the right storage backend for your use case.

Supported Backends

See State Persistence and Redis Backend for detailed configuration.

  • High performance
  • Distributed support
  • TTL and expiration

SQLite (Development)

  • File-based storage
  • No external dependencies
  • Good for testing

PostgreSQL (Enterprise)

  • ACID compliance
  • Advanced querying
  • Scalable

Configuration

from recoagent.state import RedisStatePersistence

# Redis backend
redis_persistence = RedisStatePersistence(
redis_url="redis://localhost:6379/0",
compression_type=CompressionType.LZ4
)

Choosing a Backend

BackendUse CasePerformanceScalability
RedisProductionExcellentHigh
SQLiteDevelopmentGoodLow
PostgreSQLEnterpriseGoodVery High

Best Practices

  1. Redis for Production: Use Redis for production workloads
  2. SQLite for Testing: Use SQLite for development and testing
  3. PostgreSQL for Enterprise: Use PostgreSQL for complex queries