Integration
Long-term memory for Microsoft Agent Framework
Microsoft's Agent Framework gives you two extension points: function tools the model picks up, or middleware that runs around every turn. `agent-framework-engram` ships both. `EngramTools` exposes the memory functions as `@ai_function` / `@tool` callables, and `EngramMiddleware` recalls relevant memories before each turn and auto-stores user messages after.
Install
Three steps: sign up for an Engram API key, paste a BYOK LLM-provider key on /models, then drop the snippet below into Agent Framework.
Three steps to memory in your agent
- Sign up. Free, no card. You'll land on a Getting Started page that walks the next two steps.
- Add your LLM key. Engram is BYOK. Paste an OpenAI / Anthropic / Groq / Together / Fireworks key and we'll route every extraction and query call through your provider. You pay your provider directly. We never see your inference.
- Paste the snippet below into your agent and restart it. Use
Authorization: Bearer <api-key>with the API key from your portal.
agent-framework-engram: Skill (tools) + Middleware (transparent)
Two extension points: EngramSkill exposes the memory functions as @ai_function tools (model-controlled, recommended). EngramMiddleware transparently recalls memories before each turn and stores user messages after. Source: github.com/lumetra-io/engram-agent-framework.
- Install (Python 3.10+,
agent-framework≥ 1.5): - Export your API key:
- Skill: model-controlled memory (recommended):
- Middleware: transparent recall + auto-store:
pip install agent-framework-engramexport ENGRAM_API_KEY="<api-key>"from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from agent_framework_engram import EngramSkill
skill = EngramSkill(bucket="my-agent")
agent = Agent(
client=OpenAIChatClient(),
name="assistant",
instructions="You have durable memory via the engram_* tools.",
tools=skill.tools,
)from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from agent_framework_engram import EngramMiddleware
agent = Agent(
client=OpenAIChatClient(),
name="assistant",
instructions="You are a helpful assistant with long-term memory.",
middleware=[EngramMiddleware(bucket="my-agent")],
)What you can do once memory's wired in
- Use `EngramTools` for explicit, model-controlled memory where the agent decides when to store and recall
- Use `EngramMiddleware` for transparent memory: every user turn auto-recalls relevant context and stores the message
- Combine both: middleware for passive context, function tools for active curation
- Per-bucket scoping: `EngramTools(bucket='my-agent')` or `EngramMiddleware(bucket='my-agent')`
FAQ
Tools or Middleware, which should I pick?
We recommend Tools (`EngramTools`), because model-controlled memory is the strength of Agent Framework's function-tool loop. Middleware (`EngramMiddleware`) is for cases where you want memory baked in without exposing tools to the model.
Why isn't it called `EngramSkill`?
Microsoft's Agent Framework has its own `Skill` primitive: a SKILL.md-formatted bundle of instructions, scripts, and resources per the `agentskills.io` spec. Using "Skill" for our function-tool extension would collide with that. `EngramTools` is the function-tool path, and the `Skill` namespace is reserved for Microsoft's own concept.
Does this require a specific Agent Framework version?
Yes. You'll need `agent-framework>=1.5` and Python 3.10+. Both the `@ai_function` decorator and the newer `@tool` decorator are stable from that version on, and the middleware interface is too.
Can I use my own OpenAI client?
Yes: `Agent(client=OpenAIChatClient(), ...)`. Engram doesn't replace your LLM client, it adds the memory layer alongside it.
Related integrations
Ship durable memory in Agent Framework today
Free tier: 10K memories and 50K retrievals per month. No credit card. Same Engram backend powers all 41 integrations, so memories you write from one client are immediately queryable from the rest.