Skip to main content

openengram

Python SDK for the Engram memory API — persistent memory for AI agents.

Installation

pip install openengram

Quick Start

from openengram import Engram

engram = Engram(api_key="ek_...", user_id="user_beaux")

# Store a memory
memory = engram.remember("User prefers dark mode and uses vim")

# Search memories
results = engram.search("What editor does the user prefer?")
for m in results.memories:
    print(m.raw)

# Load context for a session
ctx = engram.context(max_tokens=2000)
print(ctx.context)

# Get a specific memory
memory = engram.get(memory.id)

# Update a memory
engram.update(memory.id, raw="User prefers dark mode and uses neovim")

# Delete a memory
engram.forget(memory.id)

Configuration

Parameter Env Var Default
api_key ENGRAM_API_KEY —
user_id ENGRAM_USER_ID —
base_url ENGRAM_BASE_URL https://api.openengram.ai
# Using environment variables
import os
os.environ["ENGRAM_API_KEY"] = "ek_..."
os.environ["ENGRAM_USER_ID"] = "user_beaux"

engram = Engram()  # picks up env vars automatically

Async Support

from openengram import AsyncEngram

async def main():
    async with AsyncEngram(api_key="ek_...") as engram:
        memory = await engram.remember("User likes async Python")
        results = await engram.search("async")

Memory Layers

Memories are organized into layers:

  • SESSION — Short-lived, conversation-scoped
  • PROJECT — Project-specific context
  • IDENTITY — Long-term user preferences and facts
  • TASK — Task-specific context
from openengram import MemoryLayer

engram.remember(
    "User's favorite color is blue",
    layer=MemoryLayer.IDENTITY,
)

results = engram.search("color", layers=[MemoryLayer.IDENTITY])

Feedback

Help improve memory relevance with feedback signals:

engram.mark_used(memory.id)      # implicit signal
engram.mark_helpful(memory.id)   # explicit signal

Error Handling

from openengram import NotFoundError, RateLimitError

try:
    memory = engram.get("nonexistent-id")
except NotFoundError:
    print("Memory not found")
except RateLimitError:
    print("Slow down!")

License

Apache 2.0

Metadata

Release files for openengram 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 openengram 0.1.0
File Size Uploaded Provenance Actions
openengram-0.1.0.tar.gz 10.8 kB Without provenance Details for openengram-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 22.3 kB

Release files / openengram-0.1.0.tar.gz

Download URL openengram-0.1.0.tar.gz
Size 10.8 kB
Tags Source
SHA-256 checksum
How to use checksums
07d5f511035013a53045f163b1684d560cebfea406d5cd49199b64f9db8bf1e9
BLAKE2b-256 checksum
How to use checksums
b9d684a589abaefabd2d9a938b115e9fb59932784d8ed9c5ffc6bc09a5316982
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

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

Download URL openengram-0.1.0-py3-none-any.whl
Size 11.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d95007b8bee6d1a2d1e829d7a71e159ffdc91a8f7b72eabcc620b4022d2f75c3
BLAKE2b-256 checksum
How to use checksums
d7cae458fcc60ca451bad30a168dd811f21bca19149ef1d9a8ab151073d61067
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.3

Security for openengram 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