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.
Learn how to give OpenAI Agents SDK agents persistent team memory — recalled into the agent's instructions before a run, written back after.
A tiny Unison client
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": "private"}]
})Wire it into an agent
from agents import Agent, Runner
task = "What did we decide about the enterprise tier?"
memory = recall(task)
agent = Agent(
name="Assistant",
instructions=f"Answer using team memory when it's relevant.\n\nTeam memory:\n{memory}",
)
result = await Runner.run(agent, task)
remember(
[{"role": "user", "content": task},
{"role": "assistant", "content": result.final_output}],
source_ref="agents-sdk-session-1",
)Prepend recalled memory to the agent's instructions before Runner.run, then remember the result after. For multi-user products, use a brain:act-as service key with per-user actors so each user gets an isolated private namespace (details).
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.
Persistent Memory for Vercel AI SDK - Unison Integration
Give Vercel AI SDK agents persistent team memory: contextMd into the system prompt, conversation ingest after each generation.