Shared memory for
CrewAI.
Give every agent in a crew the same two tools, and what one agent records is available to the others and to the next run.
Connect once
Install the SDK and CrewAI:
pip install priostack crewaiOne registration per crew is the simplest: the crew is one agent, and its members share its space. Register separate agents when you want per-agent grants and receipts.
import os
from priostack import ACNClient
# First run: no ACN_TOKEN yet, so register once and save the token it prints
# (it is shown once). Later runs: set ACN_TOKEN and ACN_SPACE and the same
# agent finds the same memory.
acn = ACNClient(token=os.environ.get("ACN_TOKEN"))
if not acn.token:
print("ACN_TOKEN =", acn.register(display_name="crewai-crew").token)
acn.connect()
SPACE_ID = os.environ.get("ACN_SPACE") or acn.create_space("crew-shared-memory").space_id
print("ACN_SPACE =", SPACE_ID)Two crew tools
Define the tools once with CrewAI's @tool and pass the same list to each Agent. A researcher records a finding, a writer recalls it, and both read the same durable space.
from crewai.tools import tool
@tool("Remember Fact")
def remember_tool(fact: str) -> str:
"""Persist a fact to the crew's shared long-term memory."""
acn.store(SPACE_ID, objects=[{"content": fact, "type": "declaration"}])
return f"Recorded: {fact!r}"
@tool("Recall Fact")
def recall_tool(topic: str) -> str:
"""Recall facts that contain a word from the crew's shared memory. Pass one word, not a question."""
return "\n".join(acn.fetch(SPACE_ID, query=topic, limit=5).contents()) or "Nothing recorded yet."
# give the same two tools to every Agent(...) in the crew
memory_tools = [remember_tool, recall_tool]examples/crewai_memory.py in the SDK repository; it runs in tool-only mode without a model key.Or connect over MCP
CrewAI's MCPServerAdapter (pip install "crewai-tools[mcp]") hands the network's own tools to an agent. The model then makes the calls: it must call noetic.connect with the saved token first and pass the returned sessionId to every other tool.
from crewai import Agent
from crewai_tools import MCPServerAdapter
server = {"url": "https://priostack.com/mcp", "transport": "streamable-http"}
with MCPServerAdapter(server) as acn_tools: # the noetic.* tools
researcher = Agent(
role="Researcher",
goal="Record findings in the crew's memory",
backstory="Call noetic.connect with the saved token first, then pass the "
"returned sessionId to every other noetic tool.",
tools=acn_tools,
)
# build the Crew and kickoff() inside this block, while the connection is opennoetic.fetch. Several model APIs accept only letters, digits, underscores and hyphens in a tool name. If yours refuses the tool list, use the two crew tools above.Questions
What does the memory not do?
It does not embed or rank your facts. It returns what is stored, filtered by a word, and an empty list when nothing matches. What the crew reads back is exactly what a crew member wrote.
Can a crew read another crew's memory?
Only through a grant from that crew's owner, and only with the rights granted.
Inspect the MCP tool schemasLet your next agent start with context.
Try the memory demo, then connect the tools you already use.
The endpoint is live. Example ids, keys and outputs on this page are samples.