> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# factories • AI Agent SDK

> Memory Adapter Factory Functions

# factories

<Badge color="blue">AI Agent</Badge>

Memory Adapter Factory Functions

Provides factory functions for heavy memory adapters that replace hardcoded imports
in memory/memory.py. These enable lazy loading of heavy dependencies while maintaining
the protocol-driven architecture.

Each factory function:

1. Lazy imports the required dependencies
2. Creates and returns an adapter instance that implements MemoryProtocol
3. Raises clear ImportError with installation instructions if dependencies missing

This approach follows the protocol-driven core principle by moving heavy implementations
out of the core Memory class while preserving backward compatibility.

## Import

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
from praisonaiagents.memory.adapters import factories
```

## Classes

<CardGroup cols={2}>
  <Card title="Mem0MemoryAdapter" icon="brackets-curly" href="../classes/Mem0MemoryAdapter">
    Memory adapter that wraps mem0.Memory to implement MemoryProtocol.
  </Card>

  <Card title="ChromaMemoryAdapter" icon="brackets-curly" href="../classes/ChromaMemoryAdapter">
    Memory adapter that uses ChromaDB to implement MemoryProtocol.
  </Card>

  <Card title="MongoDBMemoryAdapter" icon="brackets-curly" href="../classes/MongoDBMemoryAdapter">
    Memory adapter that uses MongoDB to implement MemoryProtocol.
  </Card>

  <Card title="DakeraMemoryAdapter" icon="brackets-curly" href="../classes/DakeraMemoryAdapter">
    Memory adapter that wraps the Dakera SDK to implement `MemoryProtocol`.
  </Card>
</CardGroup>

## Functions

<CardGroup cols={2}>
  <Card title="safe_mem0_search()" icon="function" href="../functions/safe_mem0_search">
    Defensive wrapper for mem0.search() to handle MongoDB vector store compatibility.
  </Card>

  <Card title="create_mem0_memory_adapter()" icon="function" href="../functions/create_mem0_memory_adapter">
    Factory function to create Mem0 memory adapter.
  </Card>

  <Card title="create_chroma_memory_adapter()" icon="function" href="../functions/create_chroma_memory_adapter">
    Factory function to create ChromaDB memory adapter.
  </Card>

  <Card title="create_mongodb_memory_adapter()" icon="function" href="../functions/create_mongodb_memory_adapter">
    Factory function to create MongoDB memory adapter.
  </Card>

  <Card title="create_dakera_memory_adapter()" icon="function" href="../functions/create_dakera_memory_adapter">
    Factory function to create a Dakera memory adapter.
  </Card>
</CardGroup>
