Skip to main content

engram-metagpt

MetaGPT integration for Engram — durable cross-run memory for multi-agent simulations.

MetaGPT's built-in Memory is per-process and dies when Team.run() returns. This recipe gives a role (or a whole team) a hosted Engram bucket they all share, with two integration surfaces designed to be used together:

  1. EngramMemory(Memory) — drop-in replacement for role.rc.memory. Every observed message is mirrored to a single Engram bucket, so the next process picks up where the last one left off.
  2. EngramStoreMemory / EngramQueryMemory Actions — first-class MetaGPT Action subclasses any role can list under set_actions(...). The agent deliberately stores atomic facts and queries them via Engram's hybrid retrieval pipeline.

Install

pip install -e .
export ENGRAM_API_KEY="eng_live_..."

(Recipe is local-install only — vendored alongside engram-crewai, engram-camel-ai, etc., not on PyPI.)

Get an Engram API key

Sign up at https://lumetra.io — free tier, no card. You'll see an eng_live_… token in your dashboard.

Don't forget BYOK — Engram is bring-your-own-key end-to-end for the LLM that does extraction + synthesis. Configure a provider at https://lumetra.io/models. DeepSeek is what we recommend. Without one, store/query returns HTTP 412.

MetaGPT config

MetaGPT loads ~/.metagpt/config2.yaml at import time. For Anthropic:

llm:
  api_type: "anthropic"
  api_key: "sk-ant-..."
  base_url: "https://api.anthropic.com"
  model: "claude-haiku-4-5-20251001"
  max_token: 1024

If you'd rather not write a global config, build a Config programmatically — see example.py.

Usage — EngramMemory (passive transcript mirror)

from metagpt.roles import Role
from engram_metagpt import EngramMemory

role = Role(name="Alice", profile="Analyst")
role.rc.memory = EngramMemory(bucket="my-team-transcript")

Now every Message the role observes is mirrored to the my-team-transcript bucket. MetaGPT's local Memory semantics (the index, find_news, get_by_actions) all keep working unchanged — Engram is a write-through mirror, not a replacement for the in-process buffer.

try_remember(keyword) falls back to Engram's hybrid retrieval if the local buffer has no hit, so the role can recall facts learned in an earlier process run.

Usage — Engram Actions (deliberate memory)

from engram_metagpt import engram_actions

role = Role(name="Researcher", profile="Analyst")
role.set_actions(engram_actions(bucket="my-team-facts"))

The role now has two actions available:

  • EngramStoreMemory — await action.run(content) → saves one atomic fact, returns "stored memory_id=...".
  • EngramQueryMemory — await action.run(query) → returns the synthesized answer string from Engram's hybrid retrieval (BM25 + vector + knowledge graph fusion).

Combine them with other actions and MetaGPT's react_mode="react" to let the agent decide when to remember and recall on its own.

Why this beats MetaGPT's built-in memory

  • Persists across runs. MetaGPT's Memory is per-process; the next Team.run() starts blank. Engram doesn't.
  • Shared across roles. Engram is the team's institutional memory, not a per-role scratchpad.
  • Hybrid retrieval — BM25 + vector + knowledge graph fusion, not vector-only.
  • Bring-your-own-LLM for extraction and synthesis (https://lumetra.io/models).
  • Per-team buckets — pass bucket=f"team-{project_id}" and isolation is automatic.

Verified

Smoke-tested against live api.lumetra.io with the Anthropic-backed MetaGPT provider (claude-haiku-4-5-20251001). The flow in example.py:

  1. Build a Role with a custom SummarizeUserFact action.
  2. Swap EngramMemory(bucket=transcript_bucket) into role.rc.memory.
  3. Mirror a user message + an LLM-generated summary through Engram.
  4. Invoke EngramStoreMemory twice (two atomic facts).
  5. Invoke EngramQueryMemory against the facts bucket.

Cross-checked with curl — both facts landed in the bucket as expected, and the mirrored transcript bucket extracted the user/assistant content into atomic memories.

License

MIT — Lumetra

Metadata

Release files for engram-metagpt 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for engram-metagpt 0.1.0
File Size Uploaded Provenance Actions
engram_metagpt-0.1.0.tar.gz 8.3 kB Without provenance Details for engram_metagpt-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for engram-metagpt 0.1.0
File Interpreter ABI Platform Actions
engram_metagpt-0.1.0-py3-none-any.whl Python 3 none any Details for engram_metagpt-0.1.0-py3-none-any.whl

Total release size: 18.2 kB

Release files / engram_metagpt-0.1.0.tar.gz

Download URL engram_metagpt-0.1.0.tar.gz
Size 8.3 kB
Tags Source
SHA-256 checksum
How to use checksums
1e9b764815d4ac0055cb8627b5027d2ff119eef2cd4f5ecd4c257b1facf1bc64
BLAKE2b-256 checksum
How to use checksums
68300de45d0ae1acf8c1737c835e5521c21b00c9b18c3ba72318a01597612bd1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Release files / engram_metagpt-0.1.0-py3-none-any.whl

Download URL engram_metagpt-0.1.0-py3-none-any.whl
Size 9.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cf9366f732d1b9b9c49f47cff8cf27436f0a7c1b5abf026d22a1b93626ecf33
BLAKE2b-256 checksum
How to use checksums
1a64127af9842c78987f7729fbce91ea15f42b035c36cc43f85b9c7ef77f8ddc
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.2

Security for engram-metagpt 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page