Skip to main content

Engram (Lumetra) durable memory tools and middleware for the Microsoft Agent Framework.

Project description

agent-framework-engram

Durable memory for Microsoft Agent Framework agents, powered by Engram — Lumetra's memory service for AI agents.

Ships two extension points so you can pick whichever fits your architecture:

Extension point Class What it does
Skill (tools) EngramSkill Exposes engram_store_memory, engram_query_memory, etc. as first-class @ai_function tools.
Middleware EngramMiddleware Transparently recalls relevant memories before each turn and auto-stores the user message after.

The Skill path is recommended — it lets the model itself decide when to recall and persist, which is the strength of Agent Framework's function-tool loop.

Install

pip install agent-framework-engram

Requires agent-framework>=1.5 and Python 3.10+.

Get an Engram API key at https://lumetra.io. Export it:

export ENGRAM_API_KEY=eng_live_...

Quick start — Skill (recommended)

import asyncio
from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from agent_framework_engram import EngramSkill


async def main() -> None:
    skill = EngramSkill(bucket="my-agent")  # ENGRAM_API_KEY from env

    agent = Agent(
        client=OpenAIChatClient(),
        name="assistant",
        instructions=(
            "You have durable memory across conversations via the engram_* "
            "tools. Call engram_query_memory before answering questions "
            "about the user, and engram_store_memory whenever the user "
            "shares a new preference or fact."
        ),
        tools=skill.tools,
    )

    print(await agent.run("Remember that I prefer dark mode and metric units."))
    print(await agent.run("What do you remember about my UI preferences?"))


asyncio.run(main())

Quick start — Middleware (transparent)

import asyncio
from agent_framework import Agent
from agent_framework.openai import OpenAIChatClient
from agent_framework_engram import EngramMiddleware


async def main() -> None:
    agent = Agent(
        client=OpenAIChatClient(),
        name="assistant",
        instructions="You are a helpful assistant with long-term memory.",
        middleware=[EngramMiddleware(bucket="my-agent")],
    )

    print(await agent.run("Hi, my name is Jacob."))
    print(await agent.run("What's my name?"))


asyncio.run(main())

Configuration

Argument Env var Default
api_key ENGRAM_API_KEY required
base_url ENGRAM_BASE_URL https://api.lumetra.io
bucket required

For multi-tenant deployments, use one bucket per user (e.g. f"user-{user_id}").

Tools exposed by EngramSkill

Tool Maps to
engram_store_memory POST /v1/buckets/{bucket}/memories
engram_query_memory POST /v1/query
engram_list_memories GET /v1/buckets/{bucket}/memories
engram_delete_memory DELETE /v1/buckets/{bucket}/memories/{memory_id}
engram_clear_bucket DELETE /v1/buckets/{bucket}/memories
engram_list_buckets GET /v1/buckets

Restrict with EngramSkill(bucket=..., include=("store_memory", "query_memory")) if you only want recall/persist (no destructive ops).

Self-hosted Engram

EngramSkill(bucket="x", base_url="https://engram.your-corp.internal")

License

MIT — see LICENSE. Privacy notes in PRIVACY.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

agent_framework_engram-0.1.0.tar.gz (10.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

agent_framework_engram-0.1.0-py3-none-any.whl (11.8 kB view details)

Uploaded Python 3

File details

Details for the file agent_framework_engram-0.1.0.tar.gz.

File metadata

  • Download URL: agent_framework_engram-0.1.0.tar.gz
  • Upload date:
  • Size: 10.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for agent_framework_engram-0.1.0.tar.gz
Algorithm Hash digest
SHA256 70389a2eab2b18e35919df769104dba49973de8c33819f37e818bbac6c9fef65
MD5 40f64024cb7d3c074751f13335c15d60
BLAKE2b-256 7181125922fea77a80012e12595ef94781854702bed0585a63ec671faf9ffa12

See more details on using hashes here.

File details

Details for the file agent_framework_engram-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for agent_framework_engram-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f1d24363868f4c06dac5c02a02e06dac23f76aad0676672356ee1bf1aa5b6f2b
MD5 9940c1a9ecc62098afbcc46300aff3ef
BLAKE2b-256 be82d64f57923237697a5200c2fb5f8692e60b36756f20e4839e19ab9f42a404

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page