episemic.simple
index
/Users/adityakarnam/Projects/episemic/episemic/simple.py

Simple, user-friendly API for Episemic Core.

 
Modules
       
asyncio

 
Classes
       
builtins.object
Episemic
EpistemicSync
Memory
SearchResult

 
class Episemic(builtins.object)
    Episemic(config: episemic.config.EpistemicConfig | None = None, **config_kwargs)
 
Simple memory system for AI agents.
 
Example:
    >>> # Basic usage
    >>> episemic = Episemic()
    >>> await episemic.start()
    >>>
    >>> # Store a memory
    >>> memory = await episemic.remember("Important information", tags=["work"])
    >>>
    >>> # Search memories
    >>> results = await episemic.recall("important")
    >>>
    >>> # Get a specific memory
    >>> memory = await episemic.get(memory_id)
 
  Methods defined here:
async __aenter__(self)
Async context manager entry.
async __aexit__(self, exc_type, exc_val, exc_tb)
Async context manager exit.
__init__(self, config: episemic.config.EpistemicConfig | None = None, **config_kwargs)
Initialize Episemic memory system.
 
Args:
    config: EpistemicConfig object. If provided, config_kwargs are ignored.
    **config_kwargs: Configuration options such as:
        - qdrant_host: Qdrant server host (default: "localhost")
        - qdrant_port: Qdrant server port (default: 6333)
        - postgres_host: PostgreSQL host (default: "localhost")
        - postgres_db: PostgreSQL database (default: "episemic")
        - postgres_user: PostgreSQL user (default: "postgres")
        - postgres_password: PostgreSQL password (default: "postgres")
        - redis_host: Redis host (default: "localhost")
        - redis_port: Redis port (default: 6379)
        - debug: Enable debug mode (default: False)
async consolidate(self) -> int
Run memory consolidation to optimize storage.
 
Returns:
    Number of memories processed.
async find_related(self, memory_id: str, limit: int = 5) -> list[episemic.simple.SearchResult]
Find memories related to a specific memory.
 
Args:
    memory_id: The reference memory ID
    limit: Maximum number of related memories
 
Returns:
    List of related memories.
async forget(self, memory_id: str) -> bool
Remove a memory from the system.
 
Args:
    memory_id: The memory to remove
 
Returns:
    True if successful, False otherwise.
async get(self, memory_id: str) -> episemic.simple.Memory | None
Get a specific memory by ID.
 
Args:
    memory_id: The memory identifier
 
Returns:
    Memory object if found, None otherwise.
async health(self) -> bool
Check if the memory system is healthy.
 
Returns:
    True if all components are working, False otherwise.
async recall(self, query: str, limit: int = 10, tags: list[str] | None = None) -> list[episemic.simple.SearchResult]
Search for memories.
 
Args:
    query: What to search for
    limit: Maximum number of results
    tags: Optional tag filters
 
Returns:
    List of search results with relevance scores.
async remember(self, text: str, title: str | None = None, tags: list[str] | None = None, metadata: dict | None = None) -> episemic.simple.Memory | None
Store a new memory.
 
Args:
    text: The content to remember
    title: Optional title for the memory
    tags: Optional list of tags
    metadata: Optional additional data
 
Returns:
    Memory object if successful, None otherwise.
async start(self) -> bool
Start the memory system.
 
Returns:
    True if started successfully, False otherwise.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class EpistemicSync(builtins.object)
    EpistemicSync(config: episemic.config.EpistemicConfig | None = None, **config_kwargs)
 
Synchronous wrapper for Episemic (for non-async code).
 
Example:
    >>> episemic = EpistemicSync()
    >>> episemic.start()
    >>> memory = episemic.remember("Important info")
    >>> results = episemic.recall("important")
 
  Methods defined here:
__init__(self, config: episemic.config.EpistemicConfig | None = None, **config_kwargs)
Initialize self.  See help(type(self)) for accurate signature.
consolidate(self) -> int
Run memory consolidation.
find_related(self, memory_id: str, limit: int = 5) -> list[episemic.simple.SearchResult]
Find related memories.
forget(self, memory_id: str) -> bool
Remove a memory.
get(self, memory_id: str) -> episemic.simple.Memory | None
Get a specific memory.
health(self) -> bool
Check system health.
recall(self, query: str, limit: int = 10, tags: list[str] | None = None) -> list[episemic.simple.SearchResult]
Search for memories.
remember(self, text: str, title: str | None = None, tags: list[str] | None = None, metadata: dict | None = None) -> episemic.simple.Memory | None
Store a new memory.
start(self) -> bool
Start the memory system.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class Memory(builtins.object)
    Memory(internal_memory)
 
A simple memory object that users interact with.
 
  Methods defined here:
__init__(self, internal_memory)
Initialize self.  See help(type(self)) for accurate signature.
__repr__(self) -> str
Return repr(self).
__str__(self) -> str
Return str(self).

Readonly properties defined here:
created_at
When the memory was created (ISO format).
id
Unique memory identifier.
metadata
Additional memory metadata.
tags
Memory tags.
text
The memory content.
title
Memory title.

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
class SearchResult(builtins.object)
    SearchResult(internal_result)
 
A search result with memory and relevance score.
 
  Methods defined here:
__init__(self, internal_result)
Initialize self.  See help(type(self)) for accurate signature.
__str__(self) -> str
Return str(self).

Data descriptors defined here:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
async create_memory_system(**config_kwargs) -> episemic.simple.Episemic
Create and start a memory system in one call.
 
Args:
    **config_kwargs: Configuration options
 
Returns:
    Started Episemic instance.