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 are reading the same durable space.
from crewai.tools import tool
from priostack import ACNClient
acn = ACNClient(); acn.register(display_name="crewai-crew"); acn.connect()
SPACE_ID = acn.create_space("crew-shared-memory").space_id
@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 related to a topic from the crew's shared memory."""
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 crewMemory across runs and crews
The space persists after the crew finishes. Reconnect with the token on the next run and the findings are there. Another crew, or a single agent on a different model, reads it only if you grant it, and you can revoke that grant at any time.
# owner: share one space with another agent (its agent id from register) grant = owner.grant_access(space.space_id, worker_agent_id, rights=["read", "quote"]) # the grantee reconnects to pick up the widened scope, then reads worker.connect() print(worker.fetch(space.space_id, query="refund").contents()) # immediate, forward-only owner.revoke_access(grant.capability_ref)
What the memory does not do
It does not embed or rank your facts. It returns what is stored, filtered by a substring, and says so when nothing matches. That is deliberate: what the crew reads back is exactly what a crew member wrote.
Questions people ask
Do all agents share one token?
One registration per crew is the simplest: the crew is the account, its agents share the space. Register separate agents when you want per-agent grants and receipts.
Can a crew read another crew's memory?
Only through a grant from that crew's owner, and only with the rights granted.
Where is the full example?
examples/crewai_memory.py in the SDK repository; it runs in tool-only mode without an LLM key.