Skip to content

Commit ea5c325

Browse files
feat: implement comprehensive storage backend support for PraisonAI Agents
- Add unified storage interface (BaseStorage) with async/await support - Implement 8+ storage backends: SQLite, MongoDB, PostgreSQL, Redis, DynamoDB, S3, GCS, Azure - Enhance Memory class with backward-compatible multi-storage support - Add configuration-first approach for easy provider switching - Support primary + cache storage patterns - Maintain full backward compatibility with existing code - Add graceful dependency handling for optional backends Resolves #971 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
1 parent 9ae29b0 commit ea5c325

File tree

11 files changed

+4108
-2
lines changed

11 files changed

+4108
-2
lines changed

src/praisonai-agents/praisonaiagents/__init__.py

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,27 @@
3636
from .knowledge.chunking import Chunking
3737
from .mcp.mcp import MCP
3838
from .session import Session
39-
from .memory.memory import Memory
39+
from .memory import Memory
40+
# Storage backends (optional - only available if dependencies are installed)
41+
try:
42+
from .storage import (
43+
BaseStorage, SQLiteStorage, MongoDBStorage, PostgreSQLStorage,
44+
RedisStorage, DynamoDBStorage, S3Storage, GCSStorage, AzureStorage
45+
)
46+
_storage_available = True
47+
except ImportError:
48+
_storage_available = False
49+
# Create placeholder classes for unavailable storage backends
50+
BaseStorage = None
51+
SQLiteStorage = None
52+
MongoDBStorage = None
53+
PostgreSQLStorage = None
54+
RedisStorage = None
55+
DynamoDBStorage = None
56+
S3Storage = None
57+
GCSStorage = None
58+
AzureStorage = None
59+
4060
from .guardrails import GuardrailResult, LLMGuardrail
4161
from .agent.handoff import Handoff, handoff, handoff_filters, RECOMMENDED_PROMPT_PREFIX, prompt_with_handoff_instructions
4262
from .main import (
@@ -111,6 +131,16 @@ def disable_telemetry():
111131
'AutoAgents',
112132
'Session',
113133
'Memory',
134+
# Storage backends
135+
'BaseStorage',
136+
'SQLiteStorage',
137+
'MongoDBStorage',
138+
'PostgreSQLStorage',
139+
'RedisStorage',
140+
'DynamoDBStorage',
141+
'S3Storage',
142+
'GCSStorage',
143+
'AzureStorage',
114144
'display_interaction',
115145
'display_self_reflection',
116146
'display_instruction',

src/praisonai-agents/praisonaiagents/memory/__init__.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@
88
- User memory for preferences/history
99
- Quality-based storage decisions
1010
- Graph memory support via Mem0
11+
- Enhanced storage backends (MongoDB, PostgreSQL, Redis, DynamoDB, Cloud Storage)
1112
"""
1213

13-
from .memory import Memory
14+
try:
15+
# Try to import enhanced memory with new storage backends
16+
from .enhanced_memory import Memory
17+
ENHANCED_AVAILABLE = True
18+
except ImportError:
19+
# Fallback to original memory implementation
20+
from .memory import Memory
21+
ENHANCED_AVAILABLE = False
1422

1523
__all__ = ["Memory"]

0 commit comments

Comments
 (0)