Skip to main content
Weaviate

weaviate-engram

PyPI version Python versions License CI

The official Python SDK for Engram, the fully managed memory service by Weaviate.

Engram lets you add persistent, personalized memory to AI assistants and agents, with no infrastructure to set up or manage. When you add a memory, Engram processes it asynchronously through a background pipeline that extracts, deduplicates, and reconciles facts. Memories are scoped by project and user, along with any custom scope properties you define, and these scopes can be mixed and matched freely. Each scope is backed by Weaviate's multi-tenant architecture, ensuring strong isolation between tenants.

Learn more about Engram →

Requirements

  • Python 3.11 to 3.14

Installation

pip install weaviate-engram
uv add weaviate-engram

Get an API key

Engram runs on Weaviate Cloud. To get started:

  1. Sign up (or log in) at console.weaviate.cloud.
  2. Open Engram and create a project at console.weaviate.cloud/engram.
  3. Generate an API key from the project's API Keys page. Keys are shown once, so copy yours somewhere safe.

Quick start

1. Initialize the client

from engram import EngramClient

client = EngramClient(api_key="YOUR_API_KEY")

2. Add a memory from a string

# add() returns immediately. Memory processing happens asynchronously
# in the background via Engram's pipeline.
run = client.memories.add(
    "User prefers concise responses and dark mode",
    user_id="alice@example.com",
)
print(run.run_id)  # e.g. "run_abc123"

3. Add a memory from a conversation

Conversations use the OpenAI Chat Completions message format. Separately, you can pass scope properties to control where a memory lives — here a conversation_id scopes it to a specific session. Properties work with any input type, not just conversations:

run = client.memories.add(
    [
        {"role": "user", "content": "I just moved to Berlin and I am looking for a good coffee shop."},
        {"role": "assistant", "content": "Welcome to Berlin! Here are some popular coffee shops in the city..."},
        {"role": "user", "content": "I prefer specialty coffee, not chains."},
    ],
    user_id="alice@example.com",
    properties={"conversation_id": "session-abc123"},
)

print(run.run_id)  # e.g. "run_abc123"

4. Search memories

results = client.memories.search(
    query="What does the user prefer?",
    user_id="alice@example.com",
)
for memory in results:
    print(memory.content)

Async client

An async client with the same surface is available:

from engram import AsyncEngramClient

client = AsyncEngramClient(api_key="YOUR_API_KEY")

run = await client.memories.add(
    "User prefers concise responses and dark mode",
    user_id="alice@example.com",
)
results = await client.memories.search(
    query="What does the user prefer?",
    user_id="alice@example.com",
)

Error handling

All SDK exceptions inherit from EngramError:

from engram import (
    APIError,             # raised on any non-2xx response
    AuthenticationError,  # 401, invalid or missing API key
    ValidationError,      # invalid client configuration or request input
    ConnectionError,      # network failure reaching the Engram API
    EngramTimeoutError,   # runs.wait() did not reach a terminal status in time
)

Waiting for a run to complete

Each run is processed asynchronously. Under normal conditions you should not wait on runs — treat add() as fire-and-forget to keep latency low and let the pipeline reconcile memories in the background. Blocking on every run defeats the purpose of the async pipeline and will slow your application down, especially when ingesting at volume.

runs.wait() exists for the cases where you genuinely need the outcome of a specific run before proceeding — primarily debugging and tests:

status = client.runs.wait(run.run_id, timeout=60.0)
print(status.status)  # "completed" or "failed"
print(f"+{len(status.memories_created)} ~{len(status.memories_updated)} -{len(status.memories_deleted)}")

Learn more

Contributing

See CONTRIBUTING.md.

License

This project is licensed under the BSD 3-Clause License.

Support

For questions or help, reach out to support@weaviate.io.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

weaviate_engram-1.0.1.tar.gz (10.5 kB view details)

Uploaded Source

Built Distribution

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

weaviate_engram-1.0.1-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file weaviate_engram-1.0.1.tar.gz.

File metadata

  • Download URL: weaviate_engram-1.0.1.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for weaviate_engram-1.0.1.tar.gz
Algorithm Hash digest
SHA256 4bcca4c37c03b42ad27451a8dc194a9983e598c5130ea46b7f0a9f5229ccfdca
MD5 edd8f16ce57e2555532c517aea108a1c
BLAKE2b-256 235881a6fef4b9de1c7c5152e087deb5b6135080a458f42a8fc46bfefcfe8316

See more details on using hashes here.

File details

Details for the file weaviate_engram-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: weaviate_engram-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for weaviate_engram-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 862e7872bbd3025da821f1b979152f63cd359ad6ef28b585b0a5f0fb06024be6
MD5 7462ee767c05079f4d60cf6bbab3e5f1
BLAKE2b-256 c98017d5bb2233250b765c37d2dec64bfdf738aee18777a75475ca36e256b8db

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

1.0.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 files

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