Skip to main content

Experimental Zep episodic-memory adapter for Stigmem.

Project description

stigmem-plugin-zep-adapter

Federation bridge between Stigmem and Zep session memory infrastructure.

This package is experimental and opt-in. Installing it makes the zep-adapter plugin discoverable through the stigmem.plugins entry-point group; host applications still choose when to call the adapter.

Federation model

Stigmem and Zep address different memory scopes:

Stigmem Zep
Scope Shared, multi-agent coordination Per-user/per-session episodic
Granularity Typed facts (entity + relation + value) Conversational messages extracted into propositions
Consistency Conflict detection and HLC ordering Recency-weighted extraction
Audience Agent network Single LLM application

The adapter mirrors Stigmem facts into Zep as structured [STIGMEM] system messages and maps Zep extracted facts back into Stigmem-shaped records for query hydration or re-assertion.

Design

  • assert_to_zep() writes a single Stigmem fact to a target Zep session.
  • query_from_zep() reads Zep extracted facts and stamps the caller-supplied Stigmem scope onto returned records.
  • Zep has no Stigmem scope model; callers own session authorization and downstream filtering.
  • zep-cloud is a lazy optional import; discovery and tests do not require it.

Files

File Purpose
src/stigmem_plugin_zep/adapter.py Bridge adapter - encoding helpers, Zep session write, query, and record conversion
src/stigmem_plugin_zep/manifest.py Stigmem plugin discovery manifest
demo.py Optional live demo: assert a fact, mirror to Zep, verify extraction
tests/conftest.py pytest path setup
tests/test_zep_adapter.py Unit tests (Zep client mocked; no live deps required)

Installation

python -m pip install 'stigmem-plugin-zep-adapter>=0.1.0,<2.0.0'

Install Zep only in deployments that run the live bridge:

python -m pip install 'stigmem-plugin-zep-adapter[zep]>=0.1.0,<2.0.0'

Install demo dependencies only when running demo.py:

python -m pip install 'stigmem-plugin-zep-adapter[demo,zep]>=0.1.0,<2.0.0'

Requirements

  • Python >= 3.11
  • stigmem-py: pip install stigmem-py (or from workspace)
  • zep-cloud: optional runtime extra for live Zep calls; unit tests and plugin discovery do not require it.
  • Zep Cloud API key or a self-hosted Zep base URL for live use.

Environment variables

ZEP_API_KEY=your-zep-cloud-key        # Zep Cloud
ZEP_BASE_URL=http://localhost:8000    # self-hosted Zep
STIGMEM_SOURCE_ENTITY=agent:stigmem-zep

demo.py also reads:

STIGMEM_URL=http://localhost:8765
STIGMEM_API_KEY=sk-your-key
SESSION_ID=my-session-001

Usage

Mirror a Stigmem fact into Zep

from stigmem_plugin_zep import StigmemZepAdapter

adapter = StigmemZepAdapter.from_env()

fact_dict = {
    "id": "fact-123",
    "entity": "user:alice",
    "relation": "memory:role",
    "value": {"type": "string", "v": "principal-engineer"},
    "source": "agent:my-agent",
    "scope": "company",
    "confidence": 1.0,
}

result = adapter.assert_to_zep(fact_dict, session_id="session-abc")
print(result["content"])

Hydrate from Zep episodic memory

records = adapter.query_from_zep("company", session_id="session-abc")
for record in records:
    print(record["value"]["v"])

Run the demo

STIGMEM_URL=http://localhost:8765 \
ZEP_BASE_URL=http://localhost:8000 \
SESSION_ID=demo-001 \
python experimental/zep-adapter/demo.py

Enable

The adapter has no node-global behavior gate at v0.1.0. Enable it in the host application by installing the package and importing stigmem_plugin_zep.StigmemZepAdapter.

python -m pip install 'stigmem-plugin-zep-adapter>=0.1.0,<2.0.0'
python -m pip install 'stigmem-plugin-zep-adapter[zep]>=0.1.0,<2.0.0'  # live Zep bridge
stigmem plugins list

Disable

Remove the adapter from the host application path and restart the process that loads plugins. If it was installed only for this integration, uninstall it:

python -m pip uninstall stigmem-plugin-zep-adapter

Test

cd experimental/zep-adapter
python -m pytest tests/ -v

No live Zep instance or Stigmem node required; the Zep client is injected as a unittest.mock.MagicMock via the _zep_client constructor parameter.

Uninstall

python -m pip uninstall stigmem-plugin-zep-adapter

Invariants

  • The adapter appends to Zep session memory; it does not delete or deduplicate Zep messages.
  • Zep extraction is asynchronous, so recently mirrored facts may not appear in query_from_zep() immediately.
  • Zep is a secondary enrichment layer. Zep failures do not affect Stigmem node availability.
  • Callers own retry, circuit-breaker, session authorization, redaction, and prompt/write policy.

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

stigmem_plugin_zep_adapter-0.1.0.tar.gz (12.8 kB view details)

Uploaded Source

Built Distribution

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

stigmem_plugin_zep_adapter-0.1.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for stigmem_plugin_zep_adapter-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0440735caf46820514be57e381c48bc6c823b31d3b95b017d96af6a3f32b2e79
MD5 b49b6b3d67691fce5464b2a9e4f85cf9
BLAKE2b-256 575efb3acb3112ad167cf3c1ca5c94ad04d1b9956d6b8a8aaae30b37a0facfc3

See more details on using hashes here.

Provenance

The following attestation bundles were made for stigmem_plugin_zep_adapter-0.1.0.tar.gz:

Publisher: publish.yml on eidetic-labs/stigmem

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

File details

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

File metadata

File hashes

Hashes for stigmem_plugin_zep_adapter-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2cf800fee8a4070610f71d49e22948b1bdae2ea9fd5ccbfc1de0e32da31b10e6
MD5 1e04a921c2a461b05d97f4db5ea609d0
BLAKE2b-256 bded1fea87bdde556c350b0442fd69b3e6f9ab8d665f6a6fa1c32177e082576d

See more details on using hashes here.

Provenance

The following attestation bundles were made for stigmem_plugin_zep_adapter-0.1.0-py3-none-any.whl:

Publisher: publish.yml on eidetic-labs/stigmem

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