All Frameworks
CrewAI Quickstart
Share persistent memory between CrewAI agents across tasks and runs.
1Install & Configure
Install the SDK alongside CrewAI and set your API keys.
pip install agenticmemory-sdk crewai crewai-tools
export AGENTICMEMORY_API_KEY="amk_your_key_here"
export OPENAI_API_KEY="sk-..."
2Build a Crew with Shared Memory
Give CrewAI agents persistent memory that survives across crew runs.
from agenticmemoryai import AgenticMemory
from crewai import Agent, Task, Crew
from crewai.tools import tool
memory = AgenticMemory()
# Create a shared space for the crew
space = memory.create_space("Research Crew", "research-crew")
space_id = space["space"]["_id"]
# Define memory tools for agents
@tool("Store a finding to long-term memory")
def remember(content: str, tags: str = "") -> str:
"""Store a research finding to persistent memory."""
tag_list = [t.strip() for t in tags.split(",")] if tags else []
memory.add_entry(space_id, type="finding", title=content[:50],
content=content, tags=tag_list)
return "Stored to memory."
@tool("Search past research findings")
def search_memory(query: str) -> str:
"""Search persistent memory for relevant findings."""
results = memory.search(space_id, query, limit=5, scope="all")
hits = results.get("results", [])
return "\n".join(h["content"] for h in hits) or "No results found."
# Bootstrap prior context from previous runs
ctx = memory.bootstrap(space_id, entries=10, messages=20)
prior_knowledge = "\n".join(
e["content"] for e in ctx.get("entries", [])
)
researcher = Agent(
role="Senior Researcher",
goal="Find and remember key facts",
backstory=f"You have prior knowledge:\n{prior_knowledge}",
tools=[remember, search_memory]
)
writer = Agent(
role="Technical Writer",
goal="Write reports using research findings",
backstory="You synthesize research into clear reports.",
tools=[search_memory]
)
research_task = Task(
description="Research the latest trends in AI memory systems.",
agent=researcher,
expected_output="List of key findings stored to memory"
)
report_task = Task(
description="Write a summary report using stored findings.",
agent=writer,
expected_output="A concise research report"
)
crew = Crew(agents=[researcher, writer], tasks=[research_task, report_task])
result = crew.kickoff()
print(result)
3Expected Output
Stored to memory.
Stored to memory.
# AI Memory Systems Report
Key findings from research:
1. Vector-based semantic search is becoming standard...
2. Hybrid memory (short-term + long-term) improves agent performance...
Free tier: 1 space, 1K messages/month. Upgrade to Pro ($24.99/mo) for semantic search, entries, and entities.