Skip to main content

Install

pip install synap-microsoft-agent

What’s included

ClassPurpose
SynapContextProviderInjects Synap memory into the agent’s context before each turn, and records turns after
SynapHistoryProviderPersists and loads full conversation history via Synap

Quick start

from azure.ai.agents import AgentsClient
from synap_microsoft_agent import SynapContextProvider, SynapHistoryProvider

client = AgentsClient(endpoint=os.environ["AZURE_AI_ENDPOINT"])

agent = client.as_agent(
    context_providers=[
        SynapContextProvider(
            sdk=sdk,
            user_id="alice",
            customer_id="acme",   # optional
            max_context_results=6,
        ),
        SynapHistoryProvider(
            sdk=sdk,
            user_id="alice",
            conversation_id="thread-001",
        ),
    ],
)

response = await agent.run("What were the outcomes from my last meeting?")

SynapContextProvider

Called by the MAF runtime at the start of each turn:
  1. Fetches relevant memories for the incoming message
  2. Appends them as a system context message
  3. After the agent responds, ingests the full turn back into Synap
Failures on step 1 degrade gracefully (empty context, error logged). Failures on step 3 raise so callers know persistence failed.

SynapHistoryProvider

Persists and reloads the full conversation message list:
  • load(thread_id) — fetches prior messages from Synap and restores them to the MAF thread
  • save(thread_id, messages) — writes new messages to Synap after each turn
Use SynapHistoryProvider when you need the LLM to see the full conversation transcript, not just semantic context snippets.

Using both together

agent = client.as_agent(
    context_providers=[
        SynapContextProvider(sdk=sdk, user_id="alice", customer_id="acme"),
        SynapHistoryProvider(sdk=sdk, user_id="alice", conversation_id="thread-001"),
    ],
)
SynapContextProvider handles semantic memory injection; SynapHistoryProvider handles verbatim history recall. Use both for agents that need both types of memory.

Next steps

Semantic Kernel

Kernel plugin for Microsoft Semantic Kernel.

NeMo Agent Toolkit

MemoryEditor for NVIDIA NeMo workflows.