synap-microsoft-agent
Synap memory integration for Microsoft Agent Framework (MAF).
Install
pip install synap-microsoft-agent
Requires agent-framework>=1.0, maximem-synap>=0.2.0.
Quickstart
from agent_framework import InMemoryHistoryProvider
from agent_framework.openai import OpenAIChatClient
from maximem_synap import MaximemSynapSDK
from synap_microsoft_agent import SynapContextProvider, SynapHistoryProvider
sdk = MaximemSynapSDK(api_key="sk-...")
client = OpenAIChatClient(model="gpt-4o-mini")
agent = client.as_agent(
name="MemoryAgent",
instructions="You are a helpful assistant.",
context_providers=[
SynapContextProvider(
sdk=sdk,
user_id="alice",
customer_id="acme",
),
SynapHistoryProvider(
sdk=sdk,
user_id="alice",
customer_id="acme",
),
],
)
session = agent.create_session()
result = await agent.run("What's my trial expiring?", session=session)
What each provider does
-
SynapContextProvider— on every turn, fetches Synap context (facts, preferences, episodes, emotions, temporal events) and appends it as instructions. After the turn, records the user + assistant messages back to Synap. -
SynapHistoryProvider— persists the conversation message log. Loads prior turns on session resume. Subclass of MAF'sHistoryProvider, so all its flags (load_messages,store_inputs,store_outputs,store_context_messages) work as documented. -
SynapShortTermContextProvider— injects a compacted summary of the current conversation, refreshed each turn.
You can use either or both; they coexist.
The Agent Harness
MAF's harness (create_harness_agent) is a separate surface with its own memory
subsystem, and this package backs both of its storage seams. Needs
agent-framework>=1.13; the classes import lazily so the floor above stays at 1.0.
from agent_framework import create_harness_agent
from synap_microsoft_agent import SynapAgentFileStore, create_synap_harness_memory
agent = create_harness_agent(
client,
history_provider=create_synap_harness_memory(sdk, user_id="alice", customer_id="acme"),
file_memory_store=SynapAgentFileStore(sdk, user_id="alice", customer_id="acme"),
)
SynapMemoryStore— backs the topic notebook (MEMORY.md, topic records, extraction, consolidation). Extraction and consolidation stay MAF's; storage and retrieval become Synap's.MEMORY.mdgains a durable recall block that survives restarts and is shared across agents on the same scope.SynapAgentFileStore— backs the sevenfile_memory_*tools.grepsearches by regex and by meaning;deleteis real.create_synap_harness_memory— builds the provider wired correctly. Prefer it.
Two things to know:
create_harness_agenttakes exactly onehistory_provider, and bothSynapHistoryProviderand the harness memory provider areHistoryProviders. Passing both silently drops one. Use the factory and pass only that.- Topic records are held exactly, and by default only for the life of the
process. Synap's ingestion rewrites what you submit, and the harness does
read-modify-write on records, so reading them back from Synap would corrupt
them a little more each turn. Pass a
record_storeto survive restarts. The content is durable in Synap either way.
Every harness API is @experimental upstream. Pin a tested version and re-run the
suite on each MAF minor.
Error policy
- Read-side failures (
fetch,get_context_for_prompt) degrade gracefully — logged atERROR, empty result returned. An outage never crashes an agent turn. - Write-side failures —
SynapContextProvider.after_runlogs and swallows (context providers must not raise per MAF's hook contract).SynapHistoryProvider.save_messagessurfaces errors asSynapIntegrationErrorso explicit persistence failures are observable. - Harness stores — same split.
get_index_textdegrades to pointer lines with no recall block, because it feeds the system prompt on every turn.write_topicandfile_memory_writeraise. A topic that is not held raisesFileNotFoundError, which is MAF's own not-found contract.
Tests
pytest integrations/synap-microsoft-agent/tests -q
The harness tests skip cleanly when agent-framework<1.13 is installed, so the SDK
surfaces stay testable on the floor version. bench/smoke.py drives MAF's real
MemoryContextProvider and FileMemoryProvider over both stores — run it with
--mock for no network, or with credentials and --scope against a seeded scope.
Release files for maximem-synap-microsoft-agent 0.3.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| maximem_synap_microsoft_agent-0.3.0.tar.gz | 45.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| maximem_synap_microsoft_agent-0.3.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 79.5 kB
Release files / maximem_synap_microsoft_agent-0.3.0.tar.gz
| Download URL | maximem_synap_microsoft_agent-0.3.0.tar.gz |
|---|---|
| Size | 45.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
28ae2e9da308f6b8bd56e3281b61526ab156a3cfcfca18296bf1a290eba609b3
|
|
BLAKE2b-256 checksum How to use checksums |
d80a2301f89cce9f59ed37e6a6afcdff04ea73502e29d0e602228fb220adc349
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|
Release files / maximem_synap_microsoft_agent-0.3.0-py3-none-any.whl
| Download URL | maximem_synap_microsoft_agent-0.3.0-py3-none-any.whl |
|---|---|
| Size | 34.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d8c453e8a6d4a7bae782fb74825a57adc198f9abcb7a5c7b461efe94f541e6cb
|
|
BLAKE2b-256 checksum How to use checksums |
885415d1480f320358ebfcf9e3109cc20a72d03f08e23202a9656dfaa187cc80
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.15
|