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.
- Python 3.9 or later, standard library only.
- Quickstart · API reference · Data contract · Pricing
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. |
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.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| localmem_memory-0.1.1.tar.gz | 17.8 kB | Without provenance | Details for localmem_memory-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| localmem_memory-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for localmem_memory-0.1.1-py3-none-any.whl |
Total release size: 32.9 kB
Release files / localmem_memory-0.1.1.tar.gz
| Download URL | localmem_memory-0.1.1.tar.gz |
|---|---|
| Size | 17.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86bb59ebfd38f94e6c62b1bcf96c2ace3824a0c95cfad697df05a61b8b3b659b
|
|
BLAKE2b-256 checksum How to use checksums |
54a2e8040cb54f9de99112da7c9c4c5d7f1fb1cee41bef7f31b66e5469d282d2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.8
|
Release files / localmem_memory-0.1.1-py3-none-any.whl
| Download URL | localmem_memory-0.1.1-py3-none-any.whl |
|---|---|
| Size | 15.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7b81e22ec38fd6a8a7dcf7bf9ff855e75f626d2bbb5a1cb941303c0c0199e34a
|
|
BLAKE2b-256 checksum How to use checksums |
941dbf112edbadc8dedd5558a0a4709bbab463817e6ac32c2b216f7b7e31148a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.8
|
Security for localmem-memory 0.1.1
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.