Documentation Index Fetch the complete documentation index at: https://docs.praison.ai/llms.txt
Use this file to discover all available pages before exploring further.
Redis
Redis is used for state management, caching, and vector search.
Installation
pip install " praisonaiagents[tools] "
Docker Setup
docker run -d --name praison-redis -p 6379:6379 redis:7
Quick Start
from praisonaiagents import Agent
agent = Agent (
name = " Assistant " ,
instructions = " You are a helpful assistant. " ,
memory ={
" backend " : " redis " ,
" db " : " redis://localhost:6379 " ,
" session_id " : " my-session "
}
)
response = agent . start ( " Hello! " )
print ( response )
redis://localhost:6379
redis://:password@host:port/db_number
Environment Variables
export PRAISON_STATE_URL = " redis://localhost:6379 "
import os
from praisonaiagents import Agent
agent = Agent (
name = " Assistant " ,
memory ={ " db " : os . getenv ( " PRAISON_STATE_URL " )}
)
CLI
# Validate connection
praisonai persistence doctor \
--state-url " redis://localhost:6379 "
Use Cases
Session state caching
Rate limiting
Temporary data storage
Vector search (Redis Stack)
When to Use
✅ Good for:
Session caching
Rate limiting
Real-time features
Pub/sub messaging
❌ Not recommended for:
Long-term storage
Complex queries
Large datasets
Storage Backend (Advanced)
For training data, sessions, and general persistence, use the RedisBackend:
BaseJSONStore
TrainingStorage
SessionManager
RunHistory
MCPToolIndex
from praisonaiagents . storage import RedisBackend , BaseJSONStore
backend = RedisBackend (
url = " redis://localhost:6379 " ,
prefix = " praison: " ,
ttl = 3600 # 1 hour TTL
)
store = BaseJSONStore ( " session.json " , backend = backend )
store . save ({ " messages " : [ " Hello " ]})
data = store . load ()
CLI Usage
# Training with Redis backend
praisonai train agents --input " Hello " --storage-backend redis://localhost:6379
# Session list with Redis backend
praisonai session list --storage-backend redis://localhost:6379
RedisBackend Features
Feature Description TTL Support Automatic expiration with ttl parameter Key Prefixing Namespace isolation with prefix parameter Sub-ms Latency High-speed caching Distributed Shared state across nodes
See Storage Backends for more details.