Skip to main content

localmem-memory

Memory of each of your customers, for your product and its AI agents. Your backend sends what it learns about a customer (documents, notes, chat turns, facts); localmem keeps it as facts, each with the document it came from and the date it became true, and answers what is true now or on any past date.

This is the Python SDK for the localmem Memory API. It signs every request, retries safely and pairs your terminal for a key. Server-side only: a key's secret must never reach a browser or an app.

1. Get a key

Start building (sign up or sign in, answer four questions). You get an account in test, a project and a test key. Then, in your product's folder:

pip install localmem-memory
localmem-memory login

It prints a code such as WDJB-MJHT and opens app.localmem.org/pair. Check the code matches, choose the project and approve. The terminal then writes LOCALMEM_PROJECT, LOCALMEM_KEY_ID and LOCALMEM_KEY_SECRET into .env (or the file --env-file names) and adds that file to .gitignore. The code lasts 10 minutes. Options: --env-file PATH, --device NAME, --no-browser.

Pairing gives test keys only. Live keys are made by an admin in the app (Team → API) once your account is approved to go live.

2. Write and recall

from localmem_memory import Memory

lm = Memory()  # reads the three variables from the environment

# One localmem customer per user or company of yours, made with your own id.
tenant = lm.customers.create("cust-42")["tenant"]

# A document is read by a model into facts, kept with the document as source.
lm.documents.send(tenant, "Ada Byron joined Acme as head of research on 3 March.",
                  as_of="2026-03-03T09:00:00Z")

# Everything known about Ada, each fact with its source and date.
facts = lm.recall(tenant, "Ada Byron")["facts"]

# What was true on a past date.
then = lm.search(tenant, "Who leads research?", at_time="2026-02-01T00:00:00Z")

What you can call

Call What it does
customers.create(ref, phi=None) Makes a customer (its own memory) for your id ref. The same ref again answers the same customer, so a retry is safe. Never put a name or other content in ref.
customers.list(), customers.get(tenant) Your customers.
customers.delete(tenant) Access stops at once; the data contract says what follows.
tenants The same group as customers, under the API's name.
documents.send(tenant, text, title=, as_of=, tags=, external_ref=) Reads a document (at most 200 KB) into facts. Up to 20 KB answers with the facts written; above, it is read in the background and answers { status, follow }.
documents.wait(tenant, document_id) Waits for a background document to be written or failed.
facts(tenant, facts=[...]) Facts you extracted yourself; nothing goes to a model.
write(tenant, content) A memory in your own words.
search(tenant, query, k=, at_time=) Facts that answer a question, ranked, with their sources.
recall(tenant, entity, at_time=) A subject's facts. Without at_time, its whole history: a replaced value carries retired_at.
profile(tenant, scope=) A short summary of what is known, as Markdown.
get(tenant, event_id), forget(tenant, target_id) Read one memory; hide one from answers from now on.
usage(from_=, to=) Documents, facts, writes, reads and tokens by customer and day.

The API reference has every field and answer.

Errors and retries

A request that is not a success raises LocalmemError with status, error (a code to act on, such as monthly_limit, rate_limited or no_tenant), message (for people), request_id and retry_after.

The SDK sends an Idempotency-Key with every document, so a document sent again after a timeout is read once. It retries a rate limit or a busy server, and a timeout or server error when sending again cannot do the work twice, waiting as Retry-After says (up to 60 seconds). A monthly limit is not retried: its message says the limit and the date it resets. Quote request_id when you write to support@localmem.org.

Memory(timeout=120, max_retries=3)  # the defaults

Test and live

A test key (lm_test_…) reaches only customers made with a test key; a live key (lm_live_…) only live ones. Test is free, always, within small monthly limits. Live starts once we approve your account, which you ask for in Team → API. Health data waits for a business associate agreement: mark such a customer phi=True and tell us before you go live.

Licence

Apache-2.0 (see LICENSE and NOTICE). The licence covers this SDK, not the localmem service, and grants no use of the localmem name.

Metadata

Release files for localmem-memory 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for localmem-memory 0.1.2
File Size Uploaded Provenance Actions
localmem_memory-0.1.2.tar.gz 17.9 kB Without provenance Details for localmem_memory-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for localmem-memory 0.1.2
File Interpreter ABI Platform Actions
localmem_memory-0.1.2-py3-none-any.whl Python 3 none any Details for localmem_memory-0.1.2-py3-none-any.whl

Total release size: 33.1 kB

Release files / localmem_memory-0.1.2.tar.gz

Download URL localmem_memory-0.1.2.tar.gz
Size 17.9 kB
Tags Source
SHA-256 checksum
How to use checksums
e0e252fc3c6dffe7ad7705cd203a67be840ad9decd418deda41652b1a27b3e73
BLAKE2b-256 checksum
How to use checksums
a86eb7c585df9326b015d0675ab3825f911ef1815e03f32c822f30b81b0837d8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Release files / localmem_memory-0.1.2-py3-none-any.whl

Download URL localmem_memory-0.1.2-py3-none-any.whl
Size 15.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b2b7880308b534f595889e29caab6bdad4bbab8b550e671e9b6f4c64c4e385d9
BLAKE2b-256 checksum
How to use checksums
aa82129e3dcc6e7568931d0de2892e70b4384a7adba26d33ac25409b690a35cb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.7

Security for localmem-memory 0.1.2

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.

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