crewai-memory-cosmosdb
An Azure Cosmos DB (NoSQL) StorageBackend for CrewAI's unified Memory — hierarchical scopes, categories, metadata filters, importance/recency, and native vector search via VectorDistance (diskANN index).
pip install crewai-memory-cosmosdb
from crewai import Crew
from crewai.memory import Memory
from crewai_memory_cosmosdb import CosmosDBMemoryBackend
backend = CosmosDBMemoryBackend(
endpoint="https://<acct>.documents.azure.com:443/", key="<key>",
database_name="crewai", container_name="memory", dimensions=3072, # match your embedder
)
memory = Memory(storage=backend)
crew = Crew(agents=[...], tasks=[...], memory=memory)
Or once for every Crew(memory=True): set_memory_storage_factory(lambda spec: CosmosDBMemoryBackend(...)).
How it works
- A container partitioned by
/scope, one document per record (id= record id), created with a vector embedding policy on/embedding(cosine,dimensions) and adiskANNvector index (vector_index_type="quantizedFlat"|"flat"to change). The policy is fixed at container creation — use a new container to changedimensions. searchis one SQL query:ORDER BY VectorDistance(c.embedding, @q)with the scope subtree inWHERE; the score is the cosine similarity.categories/metadata_filter/min_scoreare applied on the candidates.- Scope tree, category counts, listing,
delete(older_than=...),resetare cross-partition SQL queries. - The account needs Vector Search for NoSQL:
az cosmosdb update -n <acct> -g <rg> --capabilities EnableServerless EnableNoSQLVectorSearch(list all existing capabilities; propagation can take a few minutes).
Docs: https://skamalj.github.io/agentstate-reducer/ · part of crewai-memory
License
MIT
Release files for crewai-memory-cosmosdb 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| crewai_memory_cosmosdb-0.1.0.tar.gz | 4.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| crewai_memory_cosmosdb-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 8.6 kB
Release files / crewai_memory_cosmosdb-0.1.0.tar.gz
| Download URL | crewai_memory_cosmosdb-0.1.0.tar.gz |
|---|---|
| Size | 4.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c12e9fbaf1cc4e08137aa7ffbf5a396283b6213568493c11bd6b83a5f1628eaa
|
|
BLAKE2b-256 checksum How to use checksums |
b14bf10f85032f00d8626f9b2a11e8dcdff80b41aa7b640009eba1a2f109ffb5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / crewai_memory_cosmosdb-0.1.0-py3-none-any.whl
| Download URL | crewai_memory_cosmosdb-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
024cddce6df17208b7f604e6ac2e5e771125c895a6ca28af5618bb5b1d9618b0
|
|
BLAKE2b-256 checksum How to use checksums |
fff7381419fd3978d4ea0df1076fb59c26c12f32449106b46580080f56c8679d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.23 {"installer":{"name":"uv","version":"0.11.23","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|