Skip to main content

crewai-memory-postgres

A PostgreSQL (pgvector) StorageBackend for CrewAI's unified Memory — hierarchical scopes, categories, metadata filters, importance/recency, and native vector search (<=>, HNSW index).

pip install crewai-memory-postgres
from crewai import Crew
from crewai.memory import Memory
from crewai_memory_postgres import PostgresMemoryBackend

backend = PostgresMemoryBackend("postgresql://user:pass@host:5432/db", 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: PostgresMemoryBackend(...)).

How it works

  • One table (crewai_memory by default) with id, scope, content, categories / metadata (JSONB), importance, timestamps, source, private, and embedding vector(dims); a B-tree on scope and an HNSW cosine index on embedding. Auto-created; CREATE EXTENSION IF NOT EXISTS vector is run at startup.
  • search is one SQL query ordered by embedding <=> query with the scope subtree in WHERE (scope = p OR scope LIKE 'p/%'); score is 1 - cosine_distance. categories / metadata_filter / min_score are applied on the candidates.
  • Requires the pgvector extension on the server (apt install postgresql-16-pgvector, or built in on RDS / Cloud SQL / Azure Database).

Docs: https://skamalj.github.io/agentstate-reducer/ · part of crewai-memory

License

MIT

Release files for crewai-memory-postgres 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for crewai-memory-postgres 0.1.0
File Size Uploaded
crewai_memory_postgres-0.1.0.tar.gz 4.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for crewai-memory-postgres 0.1.0
File Interpreter ABI Platform
crewai_memory_postgres-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 8.4 kB

Release files / crewai_memory_postgres-0.1.0.tar.gz

Download URL crewai_memory_postgres-0.1.0.tar.gz
Size 4.2 kB
Tags Source
SHA-256 checksum
How to use checksums
8fd3321cdd565016d5d3c1e86ec2f331d209996332951400e69c69c0c43cf8dd
BLAKE2b-256 checksum
How to use checksums
4a5c3497d36eb2eb37af969af8ba51a9f640f1fa15f5bf73e4ad4f32739362e5
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_postgres-0.1.0-py3-none-any.whl

Download URL crewai_memory_postgres-0.1.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a22e130fa7da3adc8f5fd11431a0a74483cc313ddf34286ffaaef84c52b9c001
BLAKE2b-256 checksum
How to use checksums
0407afd152c6d07ea3882e6f6ba6ad80608bf5355b72ef83dc63dcf74785d085
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 history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page