Learn Protocol • AI Agent SDK

LearnProtocol: Protocol for learning store implementations.

LearnProtocol

Defined in the protocols module.

AI Agent

Protocol for learning store implementations.

Enables custom backends (file, SQLite, Redis, MongoDB, etc.) while maintaining a consistent interface.

Methods

Usage

python
class RedisLearnStore:
        def add(self, content: str, metadata=None) -> Dict[str, Any]:
            # Store in Redis
            return {"id": "...", "content": content}

        def search(self, query: str, limit: int = 10) -> List[Dict[str, Any]]:
            # Search Redis
            return []

        def list_all(self, limit: int = 100) -> List[Dict[str, Any]]:
            return []

        def delete(self, entry_id: str) -> bool:
            return True

        def clear(self) -> int:
            return 0

Source

View on GitHub

praisonaiagents/memory/learn/protocols.py at line 15


Related Documentation