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

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.0
git push origin v0.1.0

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

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.0.tar.gz (194.6 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.0-py3-none-any.whl (31.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: memnon-0.1.0.tar.gz
  • Upload date:
  • Size: 194.6 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.0.tar.gz
Algorithm Hash digest
SHA256 1252ae8d422018dff661ff990d589fd10e8b2b33653498bee467ae6cde58999a
MD5 520514ee2dbff7cf97def1d5239aa756
BLAKE2b-256 1c511ac6246e0527022145d80476347af66eaba5400f03e1286fa4b857368935

See more details on using hashes here.

Provenance

The following attestation bundles were made for memnon-0.1.0.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.0-py3-none-any.whl.

File metadata

  • Download URL: memnon-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 31.1 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 07af91eb5c92d761c50cb5121533c44e5674ef8a66e82039a9339090f2664d92
MD5 1fbbd96cd37426083b96e43a6b760c3f
BLAKE2b-256 9014e8a050fd86f23611b1d564994f2e7762d3c780bd732ca30654314fa7075c

See more details on using hashes here.

Provenance

The following attestation bundles were made for memnon-0.1.0-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