agent-framework-memorysync
MemorySync for the Microsoft Agent Framework: agents that remember users across sessions — without ever stalling a run.
pip install agent-framework-memorysync
Quick start
from agent_framework import Agent
from agent_framework_memorysync import MemorySyncContextProvider
provider = MemorySyncContextProvider(
api_key="ms_...", # or MEMORYSYNC_API_KEY
user_id="customer-42", # required — who these memories belong to
session_id="support", # scopes the transcript
)
agent = Agent(client=..., context_providers=[provider])
result = await agent.run("which seat should I book?")
Every run recalls relevant memories into the instructions layer under a hard budget, and both sides of the exchange persist automatically after the run — no extra code per turn.
Why this one
Mem0 (agent-framework-mem0, in-repo) |
Zep (zep-ms-agent-framework) |
MemorySync | |
|---|---|---|---|
| Injection layer | ✗ fabricates a role="user" message |
✓ instructions | ✓ instructions |
| Recall latency budget | ✗ none | ✗ none | ✓ hard 1.2s default — a slow backend means an unenriched run, never a late one |
| Capture failure behaviour | ✗ after_run errors crash the agent |
swallowed | ✓ entirely fail-open, logged |
| Scope model | ✗ storage ≠ retrieval scopes — forget search_user_id and the agent is silently memoryless |
single | ✓ one user_id drives both — the bug cannot exist |
| Per-run identity | ✗ construction-only | ✗ construction-only (documented) | ✓ agent.run(..., options={"memorysync_user_id": ...}) or a user_id_resolver |
| Write dedup | ✗ re-adds every turn | ✗ | ✓ deterministic idempotency seeds |
| Tool-loop double-capture | ✗ | — | ✓ after_run_once_per_turn = True |
| Release status | beta (1.0.0b…) |
0.2.1 | ✓ stable 1.0.0 |
| Python | ≥3.10 | ✗ ≥3.11 only | ✓ ≥3.10 (matches the framework) |
Semantics worth knowing
- Turns store verbatim under the
agent-framework::<session>transcript scope — separate history, same shared user memories as every other MemorySync surface. - The resolved run identity is pinned in the provider's session-state
slice, so recall and capture can never diverge within a run — and the
slice stays JSON-native, so
AgentSessionserialization keeps working. expose_search_tool=Trueaddssearch_memory+save_memorytools viacontext.extend_tools.- Free-tier quota exhaustion is silent by design (adds accepted-without-
storing, reads empty); evaluation keys surface strict
429s.
Configuration
| Parameter | Default | Meaning |
|---|---|---|
user_id |
— (required) | End user the memories belong to |
session_id |
"default" |
Transcript scope |
top_k |
5 |
Memories considered per run |
recall_timeout |
1.2 |
Hard recall budget, seconds |
min_prompt_chars |
8 |
Skip recall for trivial prompts |
context_template |
built-in | {context} placeholder, brace-safe .replace rendering |
capture |
True |
Persist the exchange after each run |
expose_search_tool |
False |
Register memory tools on every run |
user_id_resolver |
None |
Callable[[AgentSession], str] for dynamic identity |
Development
pip install -e . agent-framework-core pytest pytest-asyncio
python -m pytest tests -q # 21 tests incl. a REAL Agent run (stub chat client)
License
MIT
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file agent_framework_memorysync-1.0.0-py3-none-any.whl.
File metadata
- Download URL: agent_framework_memorysync-1.0.0-py3-none-any.whl
- Upload date:
- Size: 11.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/7.0.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9299d1fd963a367e455e7fbaeab7e8bb255a0a24d3dfbaad09991064f379898a
|
|
| MD5 |
e2ab0edf6bb7003f0aeb27ef46126caa
|
|
| BLAKE2b-256 |
4995cc100606cfaed2ede0d0658ee2a058ac2f44db55fda0b4fc360e22d8dc08
|