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
add()
Add a new entry to the store.
search()Search entries by query.
list_all()List all entries.
get()Get entry by ID.
update()Update an existing entry.
delete()Delete an entry.
clear()Clear all entries.
Usage
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 0Source
View on GitHubpraisonaiagents/memory/learn/protocols.py at line 15