Skip to main content

Wontopos — long-term memory for AI agents. Pure semantic retrieval, identical recall in every language, ~100× lower LLM bill.

Project description

Wontopos — long-term memory for AI agents

pip install wontopos
from wontopos import Client

mem = Client(api_key="wos-...")
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

  • Pure semantic retrieval — no keyword/BM25. Identical recall in every language (한국어 · 日本語 · 中文 · English).
  • No LLM in the loopstore / search / recall never call a language model. You pay embeddings, not generation.
  • Bounded retrievalrecall() returns a small, fixed-size slice (~1,200 tokens) regardless of how much you've stored. 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) Semantic search
recall(query, user_id) One-call context (short + long + surrounding)
history(user_id) Recent turns (short-term)
stats(user_id) Counts
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")

A store registers up to 50 people to start (a limit we plan to raise); "me" never needs registration and never counts against it.

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):

hits = mem.search("...the conversation so far...", user_id="alice",
                  cache_control={"ttl": "5m"})   # or "1h"

Errors

Any non-2xx response raises WosError(status, message):

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")
    else:
        print(e.status, e.message)

Self-host

Point at your own engine:

mem = Client(api_key="...", base_url="https://wos.your-host.com")

Links

License: MIT.

Project details


Download files

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

Source Distribution

wontopos-2.2.7.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.

wontopos-2.2.7-py3-none-any.whl (9.4 kB view details)

Uploaded Python 3

File details

Details for the file wontopos-2.2.7.tar.gz.

File metadata

  • Download URL: wontopos-2.2.7.tar.gz
  • Upload date:
  • Size: 10.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for wontopos-2.2.7.tar.gz
Algorithm Hash digest
SHA256 6ca539c80972b59f3f2e3553d84ee900d2ebc20c00bf8d396092daeada28488d
MD5 1f14dc31f3f5bd8aabb9701ce19f0498
BLAKE2b-256 af92b748e74d15444e9482cdcffbb89cf9c5643f3793192be7558ce53324b854

See more details on using hashes here.

File details

Details for the file wontopos-2.2.7-py3-none-any.whl.

File metadata

  • Download URL: wontopos-2.2.7-py3-none-any.whl
  • Upload date:
  • Size: 9.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.5

File hashes

Hashes for wontopos-2.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 9315f918c8ccead3663fdb28c67f71e809da895e63397fd190e7c2f0f4739412
MD5 0d45afe55a12e9910bb4bf6790a5fd20
BLAKE2b-256 3ede82b0db43e4e4c7dee00a954bbf78591a075b59a664c5d026a8aa27743ad9

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page