Wontopos — long-term memory for AI agents
pip install wontopos
Get an API key in the console. Keys look like wos-live-...;
the client also reads WONTOPOS_API_KEY from the environment.
from wontopos import Client
mem = Client(api_key="wos-live-...")
# Each end-user / agent / topic gets its own store — create it once.
# (A "default" store already exists, so you can skip this and omit the id.)
mem.create_store("alice")
mem.add("she prefers tea over coffee", user_id="alice")
# one call → short-term + long-term + context, ready for your LLM prompt
ctx = mem.recall("what does alice drink?", user_id="alice")
Why
- The same in every language — identical recall whichever language a memory was written in (Korean · Japanese · Chinese · English).
- No LLM in the loop —
store/search/recallnever call a language model. You pay retrieval, not generation. - Bounded retrieval —
recall()returns a small, fixed-size slice regardless of how much you've stored (~1,000 tokens ontablet-2, the default engine). Your LLM bill stops growing with history.
Methods
| Method | Purpose |
|---|---|
add(content, user_id, **metadata) |
Store one memory |
add_turn(user_msg, assistant_msg, user_id?) |
Store a conversation exchange |
add_bulk(content, user_id, category=, timestamp=) |
Backfill a long history |
update(old_memory_id, new_content, user_id?) |
Supersede an old fact |
search(query, user_id, limit=10, **opts) |
Search stored memories |
search_full(query, user_id, limit=10, **opts) |
The same search with every field kept — images and verify_used included |
recall(query, user_id) |
One-call context (short + long + surrounding) |
history(user_id) |
Recent turns (short-term) |
stats(user_id) |
Counts |
get(user_id, memory_id) |
Fetch one memory by id (the text you stored, and its metadata) |
list_memories(user_id, limit=100, cursor=) |
Browse/export a store's raw memories, paged |
delete(user_id, memory_id) |
Delete one memory |
delete_all(user_id) |
GDPR erase (delete every memory for the user) |
add_speaker(speaker, user_id?) |
Register a person (explicit, up to 50 to start) |
list_speakers(user_id?) |
Registered people + per-person memory counts |
remove_speaker(speaker, user_id?) |
Unregister; memories stay, the tag goes |
All methods take a user_id — it names the store: one isolated memory space per end-user, agent, or topic, then per account (your API key). WHO said each memory inside a store is the speaker tag below — storing the assistant's own words never needs a separate id.
Who said it (speakers)
Every memory can carry a speaker: "me" for the assistant's own words, or a
person's name. Speakers are explicit, like stores: register a person once,
then store under their name — a typo can never silently become a new person.
Search accepts a speaker too, so you can recall one person's words only.
mem.add_speaker("Bob", user_id="alice") # once per person
mem.add("I promised to send the report on Friday", user_id="alice", speaker="me")
mem.add("Bob said the deadline moved to Tuesday", user_id="alice", speaker="Bob")
mem.search("what did Bob say about deadlines?", user_id="alice", speaker="Bob")
Results arrive best-first — take the list in the order given. similarity on each
memory is a raw closeness score, not the ranking key: what produces the order is
internal and is not returned, so sorting by it makes results worse. There is no
score field.
A store registers up to 50 people to start (a limit we plan to raise);
"me" never needs registration and never counts against it.
Async
Same surface, awaitable — needs the extra:
pip install "wontopos[async]"
from wontopos import AsyncClient
async with AsyncClient(api_key="wos-live-...", user_id="alice") as mem:
await mem.add("she prefers tea over coffee")
hits = await mem.search("what does alice drink?")
Every Client method exists on AsyncClient with identical arguments and
semantics (retries, redirect refusal, guards). Close with async with or
await mem.aclose().
Recall caching
Opt in per search and repeated or extended queries reuse the previous result at 10% of the normal rate (Tablet and Scroll models).
It is not free to turn on: the FIRST call writes the cache and bills the query
tokens at 2x for a 5m TTL, 3x for 1h. Only hits inside the TTL bill at 0.1x.
So it pays for a query you repeat or extend, and costs more for one you issue
once — do not switch it on globally. Any write to the store invalidates its cache
at once, so a hit can never predate a new memory.
hits = mem.search("...the conversation so far...", user_id="alice",
cache_control={"ttl": "5m"}) # or "1h"
Reliability
Built in, no configuration needed:
- Automatic retries — 429 always, and 502 / 503 or a connection error only when a
retry cannot double-process a write. The writes and the searches are POSTs, and a
502 on one of those may have been returned after the service already stored and
billed it, so those get 429 and connect-level failures only. The reads and the
deletes that address a whole store —
list_stores,list_speakers,delete_store,remove_speaker,forget_image— are GET or DELETE and do retry a 502. Twice, with exponential backoff + jitter, honoring the server'sRetry-After. Tune withClient(retries=...);retries=0disables. - Redirects refused — the API key never follows a 3xx to another host.
- Timeouts — 30s per attempt by default (
Client(timeout=...)), and a total budget for the whole call across every retry withClient(deadline=...)/with_deadline(secs). At the defaults one call can hold for 30s + backoff + 30s- backoff + 30s, which a request handler with five seconds cannot use.
- Key never in logs —
repr(client)masks the API key. - Wipe guard —
delete()without amemory_idraises instead of silently meaning "delete everything"; wiping a store is only ever the explicitdelete_all(user_id)/delete_store(user_id).
Security
Built in, none of it configurable off:
- TLS 1.2 floor and certificate verification that cannot be disabled.
- Redirects refused — a 3xx is an error, so the key never follows one to another host.
- Response size cap — anything over 64MB is refused instead of buffered.
- Key hygiene — keys are trimmed (a stray newline from a file otherwise becomes a mystery 401) and inner whitespace is rejected; model names are validated before they reach a header.
Client.from_env()readsWONTOPOS_API_KEY(orWOS_API_KEY) — keep keys out of source code.- Plain-HTTP base URLs on non-local hosts warn. One dependency (
requests, floor>=2.32for its certificate-verification fix).
Errors
Any non-2xx response raises WosError(status, message). When the server sent a
request id it's on e.request_id — include it when contacting support.
from wontopos import Client, WosError
try:
mem.search("...", user_id="alice")
except WosError as e:
if e.status == 401:
print("API key invalid or revoked")
elif e.status == 429:
print("Rate limited — back off") # already retried twice by then
else:
print(e.status, e.message, e.request_id)
A different API host
Point the client somewhere other than the default endpoint - a dedicated region, a proxy of your own, or a local test server:
mem = Client(api_key="...", base_url="https://api.example.com")
Links
- Homepage: https://wontopos.com
- API reference: https://wontopos.com/en/why (Developers tab)
Reporting a bug
Found something wrong, or something that looks unsafe? Tell us — every report gets read.
- Bugs: https://wontopos.com/contact?topic=bug
- Security: https://wontopos.com/contact?topic=security (also published at
/.well-known/security.txt)
Include the SDK version (wontopos.__version__) and the language. If it involves a store id or a
memory, describe the shape rather than pasting the contents — we do not need your
data to fix it.
Changelog
The three clients release in lockstep — same version, same surface, same day.
Patch releases are additive: nothing is removed or reordered within a minor line.
Two have bent that, deliberately and named at the top of their entry — 2.2.34 moved the
default engine, and 2.2.35 gives search the count range recall has always had. A
rule you can bend without saying so is not a rule, so both are stated rather than left
for a reader to hit.
-
2.2.36 — an outside review, read by a different model with no knowledge of why any of this was written. The one that mattered:
recall()promised in its own documentation that a count outside 5–20 was refused rather than clamped, and nothing checked — solimit=500travelled to the service and failed there, for a mistake visible before opening a socket.context_limit(0–20) was unchecked the same way. Both are refused here now, and0still passes forcontext_limitbecause "attach none" is an answer, not a missing value. An argument mistake now raisesValueError, notWosError. AWosErrorwith status 0 isAPIConnectionError— "the request never got a response" — so code branching on it would have retried a typo forever. Every other argument check in this client already raisedValueError. NewClient(deadline=…)/with_deadline(secs): a TOTAL budget for one call across every retry.timeoutbounds one ATTEMPT, so at the defaults a call could hold for 30s + backoff + 30s + backoff + 30s and a request handler with five seconds had no way to say so. Unset means the previous behaviour.replayedis set only when the service did not send that field itself — these responses are widening, and a client overwriting a server's value is one release away from replacing a real answer with a guess. -
2.2.35 — fixes, and two behaviour changes, both listed first because a patch release is not the place to find one by surprise.
⚠️
search's count is now 5–20, and out of range is refused rather than adjusted.recallhas carried that range from the start; search had no contract anywhere, so the clients sent whatever they were given and the service capped at 50 with no floor.search(q, limit=50)andsearch(q, limit=3)both worked on 2.2.34 and now raise. The default is still 10, so a call that passes no count is unaffected. Asking for 20 and silently getting 10 reads as "that is all there is", which is why this refuses instead of clamping.⚠️ A Rust
limitof 0 is no longer rewritten to 10. It was, and the caller whose prompt budget computed zero was handed ten memories and the bill for them. It is now refused under the range above rather than quietly changed to something nobody asked for.The fixes: a
nullidempotency key no longer becomes the literal key"null", which had made every write on that path share one key so the second onward stored nothing (TypeScript). The async client no longer reads an explicitretries=2as "the caller said nothing" (Python). The image read is actually streamed, so the 64MB cap bounds a compressed body instead of measuring bytes already in memory (Python async), and that route's ERROR body is capped too (Rust).iter_imagesstops on a repeated cursor the wayiter_memoriesalways did (Python).iterImagesno longer throws on the ordinary end of a walk (TypeScript).get_imageretries a 429 and a connect-level failure like every other call — it had none at all — in the sync Python client and TypeScript; the async Python client and the Rust crate still make a single attempt there, and say so at the method. An empty or control-character API key is refused at the call site rather than at the network in Python and Rust; TypeScript still refuses only empty and whitespace. And a page walk that reaches its ceiling now raises instead of returning a truncated list that looks complete. -
2.2.34 — the default engine is
tablet-2: same token price astablet-1, and the one that serves images and re-ask. Pin the old one withmodel="tablet-1"for the previous behaviour exactly. (The engine's own default count differs between the two, but these SDKs always send one, so a call through them is unaffected.) Newsearch_full/searchFullkeeps every field the answer came with —searchwas merging away the photos andverify_used, both of which you were billed for. Also: results arrive best-first — take the order as given.similarityis a raw closeness score, and sorting by it makes results worse. -
2.2.33 —
get_imagecan return a different FORMAT than you uploaded: the service re-encodes on downscale, so a large PNG comes back as WebP. Take the file extension from the response Content-Type, not from what you sent. -
2.2.32 —
get_imagereturns the picture the SERVICE holds, not your original. An image whose long edge is over 1568px is downscaled on the way in, and that smaller picture is what is stored and handed back. Keep your own copy if you need the full file. -
2.2.31 — images, by-speaker, lineage and revisions are SDK methods in all three clients;
searchandrecalltakeverify,max_imagesand recall'slimit/context_limit. -
2.2.30 — documentation only: this changelog, which had not been updated in the shipped package since 2.2.10.
-
2.2.29 — a store id that was PASSED but unusable no longer becomes the default store. 2.2.28 caught a blank string; the value a failed tenant lookup actually produces in Python is an integer primary key.
user_id=0is falsy and fell through to the client default, and any other integer died inside the warn helper as'int' object has no attribute 'lower'. Anything but a non-blank string now raises, on the destructive calls too. Omitting the argument still means "use the default". Also:delete_storenow warns when a store id folds (delete_allalready did, and it is the call that removes a whole store), and anidempotency_keyending in a newline is refused here instead of failing insidehttp.clientasInvalid header value. -
2.2.28 — audit: warn caches made thread-safe, a whitespace
memory_idcan no longer read as a whole-store delete, a blank store id raises instead of silently using the default, and a gzip bomb no longer bypasses the response cap on the async client. -
2.2.11–2.2.27 — additive fixes and hardening across all three clients.
-
2.2.10 —
Memoryfix: the relevance field issimilarity(notscore); added typedimportance,category,is_superseded,superseded_by,created_at,event_date. -
2.2.4–2.2.9 — one version across Python, TypeScript and Rust, released in lockstep; retries, redirect refusal, response cap, key masking, speakers.
License: MIT.
Metadata
Release files for wontopos 2.2.37
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| wontopos-2.2.37.tar.gz | 75.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| wontopos-2.2.37-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 126.1 kB
Release files / wontopos-2.2.37.tar.gz
| Download URL | wontopos-2.2.37.tar.gz |
|---|---|
| Size | 75.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2bda184baa8074ca326739924d2f63f2c9296e308203c721ce198677338b9633
|
|
BLAKE2b-256 checksum How to use checksums |
34bca73f4a39c41d8b908b8f01ae3fc73f4e6640450fc6187f7415dfd0d2e782
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|
Release files / wontopos-2.2.37-py3-none-any.whl
| Download URL | wontopos-2.2.37-py3-none-any.whl |
|---|---|
| Size | 50.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
37065ba7d0d0ba0232d7fb40eee3a7112a8dee83448a1bc75388b15e10a3f180
|
|
BLAKE2b-256 checksum How to use checksums |
7a2b3569d1fb6feae6e59ba1895dcab2891e4e9baa120e13542edf579a262b5d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.12.13
|