Make CrewAI’s built-in memory durable and queryable across crews. The integration plugs into CrewAI’sDocumentation Index
Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt
Use this file to discover all available pages before exploring further.
StorageBackend protocol, so existing crews keep working — they just gain a long-term memory that survives restarts.
Overview
This guide shows how to add Synap to a CrewAI application to build crews that:- Persist
Memoryentries across executions and processes - Retrieve semantically-relevant context from prior crew runs
- Scope memories per user or per organization
| Class | CrewAI interface | Purpose |
|---|---|---|
SynapStorageBackend | StorageBackend | Persistent storage for CrewAI’s unified Memory system |
Setup
Install the package alongside CrewAI:.env
Basic integration
The smallest useful integration swaps inSynapStorageBackend as the storage for CrewAI’s Memory. Every save call inside the crew is routed to Synap, and search returns ranked, semantically-matched results:
Core concepts
Lifecycle methods
SynapStorageBackend implements CrewAI’s StorageBackend protocol by mapping each method to the equivalent Synap operation:
| Method | Behavior |
|---|---|
save(value, metadata) | Ingests a memory fragment with optional metadata tags |
search(query, limit, score_threshold) | Semantic search; returns ranked results |
list_records(limit) | Returns recent memories (uses a broad Synap search) |
count() | Returns an approximate count via a broad search |
delete) are no-ops with a warning logged — the memory pipeline keeps moving rather than blocking the crew.
Async support
CrewAI 0.100+ supports async task execution.SynapStorageBackend exposes asearch for use in async crews:
search method wraps asearch via an event-loop bridge, so the same backend works in both sync and async crews. You don’t need separate configurations.
Complete example: research crew with shared memory
The following crew chains a researcher and a writer. Both agents share the same Synap-backed memory, so the writer sees what the researcher learned, and the next crew kickoff has access to everything from earlier runs:- Memory survives the crew. Re-running
kickoffwith a new topic still benefits from the prior run’s findings. - Scope is fixed at backend construction. All agents in this crew share the same
user_id/customer_id. Build a separate crew per user if you need isolation. - CrewAI’s built-in retrieval is unchanged. You don’t restructure tasks or prompts — the memory backend just becomes Synap.
Advanced patterns
Multi-tenant scoping
SynapStorageBackend accepts the standard scoping triple — user_id (required), optional customer_id, optional conversation_id. customer_id is required on B2B Synap instances and ignored on single-tenant ones. See Memory Scopes.
Sync and async in the same codebase
SynapStorageBackend supports both search (sync) and asearch (async). The sync method bridges to the async path via an event loop, so:
- In a sync crew, just call
crew.kickoff()as usual —searchworks transparently. - In an async crew, prefer
asearchfor direct access; the framework will call it for you when you await crew tasks.
Failure semantics
The integration follows the Synap-wide contract:searchandasearchdegrade gracefully — return[]and log an error if Synap is unreachable.savesurfaces failures — raisesSynapIntegrationErrorso the crew (and caller) know if persistence failed.- Unsupported operations (e.g.,
delete) are no-ops with a warning rather than raising, so they don’t kill the crew.
Next steps
AutoGen
BaseTool implementations for AutoGen agents.Pydantic AI
Deps and tools for Pydantic AI.
Memory Scopes
How
user_id and customer_id interact across reads and writes.Ingestion
Direct ingestion API for pipelines that need finer control than
save.