CrewAI Integration
Use SynapseCrewStorage to give your CrewAI crews persistent, encrypted memory. Drop-in replacement for CrewAI's default storage — every memory passes through PII sanitization and AES-256-GCM encryption.
Overview
CrewAI is a framework for orchestrating autonomous AI agents into collaborative crews. By default, CrewAI stores agent memory in local storage. SynapseCrewStorage replaces this with Synapse Layer's Cognitive Security Pipeline — giving every memory automatic PII redaction, intent classification, and AES-256-GCM encryption at rest.
The integration implements CrewAI's Storage interface, so existing crews work without code changes beyond swapping the storage backend.
Installation
bash
pip install synapse-layer crewaiQuick Start
Standalone example — no LLM required:
python
from synapse_memory.integrations.crewai_memory import SynapseCrewStorage
from crewai.memory.types import MemoryRecord
# Initialize Synapse Layer as CrewAI's storage backend
storage = SynapseCrewStorage(agent_id="research-crew")
# Store memories through the Cognitive Security Pipeline
records = [
MemoryRecord(
content="User prefers concise technical reports.",
scope="/crew/research",
categories=["preference"],
importance=0.8,
),
MemoryRecord(
content="Project deadline is next Friday.",
scope="/crew/research",
categories=["context"],
importance=0.9,
),
]
for record in records:
storage.save(record)
print(f"Stored {len(records)} memories.")
# Search across stored memories
results = storage.search("What are the project deadlines?", top_k=3)
for r in results:
print(f" [{r.score:.2f}] {r.content}")Crew Integration
Use with a full CrewAI crew:
python
from crewai import Agent, Crew, Task
from crewai.memory.unified_memory import Memory
from synapse_memory.integrations.crewai_memory import SynapseCrewStorage
# Synapse Layer handles persistence and encryption
storage = SynapseCrewStorage(agent_id="research-crew")
memory = Memory(storage=storage)
researcher = Agent(
role="Senior Researcher",
goal="Find and summarize key insights",
backstory="Expert analyst with deep domain knowledge.",
)
task = Task(
description="Research the latest trends in AI agent memory.",
expected_output="A summary of key trends.",
agent=researcher,
)
crew = Crew(
agents=[researcher],
tasks=[task],
memory=memory, # Synapse Layer handles all persistence
)
result = crew.kickoff()Note
Every memory stored by the crew passes through PII sanitization, intent classification, and AES-256-GCM encryption before persistence — automatically.
API Reference
SynapseCrewStorage
| Method | Description |
|---|---|
| save(record) | Store a MemoryRecord through the security pipeline |
| search(query, top_k) | Semantic search across stored memories |
| reset() | Clear all memories for this agent |