AutoGen
Add Suprflo long-term memory to AutoGen agents. Ships in the Python SDK.
Install
pip install "suprflo[autogen]"Version support
Targets AutoGen 0.4+ — the autogen-agentchat / autogen-core rewrite — and its autogen_core.memory.Memory protocol. It is not compatible with the old pyautogen 0.2 line, whose agent and memory APIs are fundamentally different. Written against the autogen_core.memory source; not verified against a live install.
What you get
Built on the Python SDK MemoryClient:
SuprfloMemory— a fullMemoryimplementation (add,query,update_context,clear,close). Pass it to any agent that acceptsmemory=and it recalls relevant facts on every turn.
Memory for an assistant
from autogen_agentchat.agents import AssistantAgent
from autogen_ext.models.openai import OpenAIChatCompletionClient
from suprflo import MemoryClient
from suprflo.integrations.autogen import SuprfloMemory
client = MemoryClient(api_key="YOUR_API_KEY")
memory = SuprfloMemory(client, user_id="alice", top_k=5)
agent = AssistantAgent(
name="assistant",
model_client=OpenAIChatCompletionClient(model="gpt-4o"),
memory=[memory],
)On each turn update_context searches on the last message and injects the hits as a single SystemMessage — the same shape AutoGen's own ListMemory and ChromaDBVectorMemory use.
Writing and reading directly
from autogen_core.memory import MemoryContent, MemoryMimeType
await memory.add(
MemoryContent(
content="Alice is allergic to peanuts",
mime_type=MemoryMimeType.TEXT,
metadata={"topic": "diet"},
)
)
results = await memory.query("dietary restrictions")
for hit in results.results:
print(hit.content, hit.metadata["score"])Query hits come back as MemoryContent with metadata carrying the memory id, its score when the API returns one, and any metadata you stored.
Scoping
SuprfloMemory(client, user_id=..., agent_id=..., top_k=...) — the scope is applied to every add, query and clear.
Notes and caveats
MemoryClientis synchronous. Every call is offloaded withasyncio.to_threadrather than being natively async.cancellation_tokenis ignored. It's accepted for protocol compatibility, but an in-flight HTTP request won't be interrupted.- Text only. Non-text
mime_typecontent is coerced withstr(), not rejected. close()is a no-op — you own theMemoryClientlifecycle, so close it yourself.clear()needs a scope. With nouser_id/agent_idit would wipe every memory in the workspace, so it raisesValueErrorinstead.
If
autogen-coreisn't installed, importing this module raises a clearImportErrortelling you topip install "suprflo[autogen]".