Quick Start
Install the optional dependency first:
pip install pymongo or pip install "praisonaiagents[mongodb]".Configuration
| Option | Type | Default | Description |
|---|---|---|---|
connection_string | str | mongodb://localhost:27017/ | MongoDB URI |
database | str | praisonai | Database name |
use_vector_search | bool | False | Enable Atlas Vector Search on long-term memory |
max_pool_size | int | 50 | Connection pool maximum |
min_pool_size | int | 10 | Connection pool minimum |
max_idle_time | int | 30000 | Max idle time in ms |
server_selection_timeout | int | 5000 | Server selection timeout in ms |
Vector Search
Whenuse_vector_search: True:
- Long-term writes include an embedding (via
text-embedding-3-smallby default). - Searches use MongoDB
$vectorSearchagainst indexvector_indexon fieldembedding. - If vector search fails or is unavailable, the adapter falls back to MongoDB text search.
use_vector_search: False (default), only MongoDB text indexes are used.
As of PraisonAI PR #2060,
use_vector_search is always initialised on the Memory instance — even when MongoDB is not the active provider. Previously, a missing attribute could raise AttributeError deep in store/search paths.Atlas Setup
- Create a vector search index named
vector_indexon thelong_term_memorycollection. - Set the indexed path to
embedding. - Pass
use_vector_search: Truein agent config.
Related
Custom Memory Adapters
Registry pattern and custom backend registration.
Memory Concepts
Overview of memory providers and lifecycle.

