CrewAI Integration
Persistent, semantically-recalled memory for CrewAI agents. Your crews remember everything — across sessions, across restarts. Dakera handles embedding, storage, and retrieval server-side.
crewai-dakera · GitHub →Quick Start
Run Dakera
Dakera is a self-hosted memory server. Spin it up with Docker:
docker run -d \
--name dakera \
-p 3000:3000 \
-e DAKERA_ROOT_API_KEY=dk-mykey \
ghcr.io/dakera-ai/dakera:latest
# Verify it's running
curl http://localhost:3000/health
Install
# Core + integration
pip install crewai-dakera
# With CrewAI (if not already installed)
pip install "crewai-dakera[crewai]"
Requirements: Python ≥ 3.10, a running Dakera server.
Add memory to your crew
from crewai import Crew, Agent, Task
from crewai.memory import LongTermMemory
from crewai_dakera import DakeraStorage
storage = DakeraStorage(
api_url="http://localhost:3000",
api_key="dk-mykey",
agent_id="my-crew",
)
crew = Crew(
agents=[...],
tasks=[...],
memory=True,
long_term_memory=LongTermMemory(storage=storage),
)
result = crew.kickoff(inputs={"topic": "AI trends"})
Your crew now persists everything it learns across runs.
Configuration
| Parameter | Type | Default | Description |
|---|---|---|---|
api_url | str | — | Dakera server URL (e.g. http://localhost:3000) |
api_key | str | "" | API key set via DAKERA_ROOT_API_KEY |
agent_id | str | — | Logical identifier for this crew's memory namespace |
min_importance | float | 0.0 | Minimum importance score for recalled memories |
top_k | int | 5 | Number of memories to surface per turn |
Using environment variables
import os
from crewai_dakera import DakeraStorage
storage = DakeraStorage(
api_url=os.environ["DAKERA_API_URL"],
api_key=os.environ["DAKERA_API_KEY"],
agent_id="research-crew",
)
Full example — research crew
from crewai import Agent, Task, Crew, Process
from crewai.memory import LongTermMemory
from crewai_dakera import DakeraStorage
dakera = DakeraStorage(
api_url="http://localhost:3000",
api_key="dk-mykey",
agent_id="research-crew",
)
researcher = Agent(
role="Senior Researcher",
goal="Uncover groundbreaking insights in {topic}",
backstory="An expert researcher with decades of experience.",
verbose=True,
)
writer = Agent(
role="Content Writer",
goal="Craft compelling reports based on research findings",
backstory="A skilled writer who turns complex ideas into clear prose.",
verbose=True,
)
research_task = Task(
description="Research the latest developments in {topic}",
expected_output="A detailed research report",
agent=researcher,
)
write_task = Task(
description="Write a blog post based on the research",
expected_output="A polished 500-word article",
agent=writer,
)
crew = Crew(
agents=[researcher, writer],
tasks=[research_task, write_task],
process=Process.sequential,
memory=True,
long_term_memory=LongTermMemory(storage=dakera),
verbose=True,
)
# First run — learns and stores findings
result = crew.kickoff(inputs={"topic": "quantum computing"})
print(result.raw)
# Second run — recalls prior research automatically
result = crew.kickoff(inputs={"topic": "quantum computing advances"})
print(result.raw)
v0.2.0 — Sessions, Knowledge Graph, Entities & Namespaces
Version 0.2.0 adds four new classes for advanced memory management. All are importable from crewai_dakera.
Session management
Group related memories into sessions. Track which memories were created during a specific crew run.
from crewai_dakera import DakeraSessionManager
sessions = DakeraSessionManager(
api_url="http://localhost:3000",
api_key="dk-mykey",
agent_id="my-crew",
)
# Use as a context manager
with sessions.start(metadata={"task": "research"}) as session:
# Run your crew — all memories are grouped under this session
result = crew.kickoff(inputs={"topic": "AI trends"})
# List active sessions
active = sessions.list(active_only=True)
# Get memories from a specific session
memories = sessions.memories(session_id=session.id)
Knowledge graph
Build and query a knowledge graph from your crew's stored memories.
from crewai_dakera import DakeraKnowledgeGraph
kg = DakeraKnowledgeGraph(
api_url="http://localhost:3000",
api_key="dk-mykey",
agent_id="my-crew",
)
# Build the graph from stored memories
kg.build()
# Query the knowledge graph
results = kg.query(query="What topics did the crew research?")
# Find paths between entities
path = kg.find_path(from_id="entity-1", to_id="entity-2")
# Export the full graph
graph = kg.export(format="json")
Entity extraction
Extract named entities from text and link them to memories.
from crewai_dakera import DakeraEntityExtractor
extractor = DakeraEntityExtractor(
api_url="http://localhost:3000",
api_key="dk-mykey",
agent_id="my-crew",
)
# Extract entities from text
found = extractor.extract(
text="Alice from Acme Corp discussed the Q4 roadmap.",
entity_types=["person", "organization"],
)
# Get entities linked to a memory
linked = extractor.memory_entities(memory_id="mem_abc123")
Namespace management
Create and manage vector namespaces for organizing document collections.
from crewai_dakera import DakeraNamespaceManager
ns = DakeraNamespaceManager(
api_url="http://localhost:3000",
api_key="dk-mykey",
)
# Create a namespace
ns.create(name="crew-docs", dimension=1024)
# List all namespaces
all_ns = ns.list_namespaces()
# Get namespace details and stats
info = ns.get(name="crew-docs")
stats = ns.stats(name="crew-docs")
Enhanced DakeraStorage (v0.2.0)
The existing DakeraStorage class gained new parameters in v0.2.0:
| Parameter | Type | Default | Description |
|---|---|---|---|
memory_type | str | "episodic" | Memory type: episodic, semantic, procedural, working |
tags | list | [] | Tags applied to stored memories |
session_id | str | None | Link memories to a session |
ttl_seconds | int | None | Auto-expire memories after N seconds |
New methods: hybrid_search(query, limit) for combined BM25 + vector search, and batch_search() for parallel queries.
How it works
- After each task, CrewAI calls
DakeraStorage.save()with the result - Dakera embeds the content server-side and stores it with a semantic vector
- Before the next task, CrewAI calls
DakeraStorage.search()— Dakera performs hybrid search (vector + BM25) and returns the most relevant past memories - Memories decay gracefully over time based on access patterns — frequently-accessed memories stay prominent
Related integrations
Links
- GitHub — dakera-crewai
- Dakera deploy — Docker Compose setup
- Dakera full documentation
- All integrations
Frequently Asked Questions
How do I add persistent memory to CrewAI?
Install the crewai-dakera package, initialize DakeraStorage with your Dakera server URL and API key, then pass it to your Crew as long_term_memory=LongTermMemory(storage=storage). Enable memory=True on the Crew.
Does Dakera work with CrewAI?
Yes, via the official crewai-dakera integration package. It implements CrewAI's storage protocol so crews persist and recall memories across runs.
What does Dakera add to CrewAI?
Dakera provides persistent cross-session memory for your crews, hybrid BM25 + vector semantic search over past task results, knowledge graph construction, session management, and memory decay. All embedding and retrieval happens server-side with no local model required.
Further reading: Building Multi-Agent Memory Systems · Knowledge Graphs for AI Agents · Multi-Agent Shared Memory pattern
Add persistent memory to your framework.
One Docker command starts the server. One pip or npm install gives your agents memory that survives the session.
Prefer managed hosting? Join the Dakera Cloud waitlist →