Skip to main content

Reusable agent memory runtime for durable observations, representations, and prompt recall.

Project description

Memnon

Reusable agent memory runtime for durable observations, cached profiles, and prompt-ready recall.

Memnon turns normalized agent sessions into long-lived memory. It extracts atomic observations, stores them by workspace, owner, and subject, builds cached representations, and retrieves relevant context for future runs.

Install

pip install memnon
pip install "memnon[postgres,pydantic-ai]"

For local development:

uv sync --extra dev
uv run pytest

Python API

from datetime import UTC, datetime

from memnon import PeerKind, PeerRef
from memnon.factory import create_memory_runtime
from memnon.types import InitializeRequest, MemoryMessage, MessageRole, SearchRequest, SessionEnvelope

runtime = create_memory_runtime(mode="test")

user = PeerRef(id="user-1", kind=PeerKind.USER)
agent = PeerRef(id="agent-1", kind=PeerKind.AGENT)

session = SessionEnvelope(
    workspace_id="workspace-1",
    session_id="thread-1",
    source_id="thread-1",
    peers=[user, agent],
    messages=[
        MemoryMessage(
            id="m1",
            peer_id="user-1",
            role=MessageRole.USER,
            content="I prefer short bullet summaries.",
            timestamp=datetime.now(UTC),
        ),
    ],
)

await runtime.initialize(
    InitializeRequest(workspace_id="workspace-1", targets=[user], sessions=[session])
)

result = await runtime.search(
    SearchRequest(workspace_id="workspace-1", owner=user, query="How should I summarize?")
)
print(result.context)

CLI

The CLI works with the Postgres runtime:

export MEMNON_DATABASE_URL="postgresql+asyncpg://localhost:5432/memnon"
memnon schema init
memnon ingest session session.json --target user:user-1
memnon search "How should I summarize?" --workspace workspace-1 --owner user:user-1
memnon representation get --workspace workspace-1 --owner user:user-1

For real LLM extraction through OpenRouter:

export OPENROUTER_API_KEY=...
MEMNON_MODEL=openrouter:openrouter/free memnon ingest session session.json --target user:user-1

Concepts

  • owner: the peer that owns the memory space.
  • subject: the peer the memory is about.
  • Observation: an atomic durable fact extracted from a session.
  • Representation: a cached prompt-facing profile built from observations.
  • SessionEnvelope: normalized conversation data supplied by host applications.

Releasing

Tags trigger the release workflow. Configure PyPI trusted publishing in the GitHub release environment, then:

git tag v0.1.1
git push origin v0.1.1

See docs/ for the full API, CLI, and Postgres reference.

Evals

Memnon includes a Pydantic Evals smoke benchmark that runs live observation extraction, prompt-memory search, and automatic profile generation against OpenRouter:

OPENROUTER_API_KEY=... uv run --extra all python benchmarks/openrouter_memory_eval.py
OPENROUTER_API_KEY=... uv run --extra all pytest -m llm

The default model is openrouter/free; pass --model to the benchmark or set MEMNON_OPENROUTER_MODEL for the pytest smoke test.

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

memnon-0.1.1.tar.gz (198.4 kB view details)

Uploaded Source

Built Distribution

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

memnon-0.1.1-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file memnon-0.1.1.tar.gz.

File metadata

  • Download URL: memnon-0.1.1.tar.gz
  • Upload date:
  • Size: 198.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memnon-0.1.1.tar.gz
Algorithm Hash digest
SHA256 86ad2357d7789e8822ad3cb4d7bf216f1c03a29f2099d61bc0f95b3ae9c98408
MD5 1e282553485ba5598cbff2de3ac4dc35
BLAKE2b-256 ca77427547c859cee94909808d4a0890329713861754177ae2f9659d25684eec

See more details on using hashes here.

Provenance

The following attestation bundles were made for memnon-0.1.1.tar.gz:

Publisher: release.yml on advantch/memnon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file memnon-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: memnon-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for memnon-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 393af4de3704e68efcf37ad2d2d181c8708787f0d283b2c0f8acc52c469125a3
MD5 f9063ffb13fdb7bd3b1dd329926d7f68
BLAKE2b-256 e759b7bfa9f12d90b50c5a12597a59cb6b7b949c06593aad67701062988a4ab3

See more details on using hashes here.

Provenance

The following attestation bundles were made for memnon-0.1.1-py3-none-any.whl:

Publisher: release.yml on advantch/memnon

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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