Shared Memory for CrewAI - Unison Integration
Give a CrewAI crew persistent shared memory: every agent reads the same project facts, and nothing is re-learned between runs.
Learn how to give a CrewAI crew persistent shared memory — so every agent reads the same project facts, and nothing is re-learned between runs.
CrewAI's built-in memory is per-crew and per-machine. Unison sits above it: one brain that every crew, run, and teammate shares.
A tiny Unison client
There's no dedicated CrewAI package yet — recall and persist are two HTTP calls, so a small consistent helper keeps the example self-contained:
import httpx, os
BRAIN = os.environ.get("UNISON_API_URL", "https://brain.unisonlabs.ai")
HEADERS = {"Authorization": f"Bearer {os.environ['UNISON_TOKEN']}"}
def recall(query: str) -> str:
ctx = httpx.get(f"{BRAIN}/v1/brain/context", params={"q": query}, headers=HEADERS).json()
return "" if ctx["weakEvidence"] else ctx["contextMd"]
def remember(turns: list[dict], source_ref: str) -> None:
httpx.post(f"{BRAIN}/v1/brain/ingest", headers=HEADERS, json={
"items": [{"type": "conversation", "turns": turns,
"sourceRef": source_ref, "visibility": "workspace"}]
})Wire it into a crew
from crewai import Agent, Task, Crew
goal = "Draft the Q3 pricing update"
memory = recall(goal)
analyst = Agent(
role="Pricing analyst",
goal=goal,
backstory=f"You build on what the team already decided.\n\nTeam memory:\n{memory}",
)
task = Task(
description="Propose the Q3 pricing change with rationale.",
agent=analyst,
expected_output="A short pricing memo",
)
crew = Crew(agents=[analyst], tasks=[task])
result = crew.kickoff()
remember(
[{"role": "user", "content": goal},
{"role": "assistant", "content": str(result)}],
source_ref="crew-q3-pricing",
)Every agent in the crew shares the recalled context (inject it into the backstory or the task description); remember writes the outcome to the workspace so the next crew — on any machine — starts from it. Crews pointed at the same workspace share one memory automatically.
Persistent Memory for LlamaIndex - Unison Integration
Drop-in agent memory for LlamaIndex: UnisonMemory replaces ChatMemoryBuffer and recalls team knowledge before each turn, ingesting what the agent learns.
Persistent Memory for the OpenAI Agents SDK - Unison Integration
Add persistent team memory to OpenAI Agents SDK agents: recall as instructions context, write back after each run.