Client Libraries · Python & JavaScript

One install. Eight verbs.

Typed clients for Python and JavaScript that turn the MemoryIntelligence API into eight verbs you already know: capture, ask, get, list, verify, explain, forget, and upload. Results come back as small typed objects, not raw envelopes. The wire format stays out of your way.

What you get back: a UMO

Every call returns a Unified Memory Object: your content, turned into meaning your agent can trust. Not raw text but the entities, relationships, topics, and tone inside it, sealed with a receipt verify() can check. That is why you can cite a memory, not just retrieve it. More on UMOs →

The eight verbs

The same surface in both languages. Each maps to one call against the public API.

MethodWhat it doesEndpoint
captureTurn content into a structured memoryPOST /v1/process
askFind memories by meaningPOST /v1/memories/query
getRetrieve one memory by idGET /v1/memories/{id}
listList your memoriesGET /v1/memories
verifyProve a memory is real and unalteredGET /v1/memories/{id}/proof
explainSee what was extracted and why it matchedGET /v1/memories/{id}/explain
forgetDelete a memory, with a receiptDELETE /v1/memories/{id}
uploadCapture a media filePOST /v1/upload
Server-side only. Your API key grants full account access. Keep it on a backend, never in browser code. Both clients read MI_API_KEY from the environment via from_env() / fromEnv().

Authenticate

Both clients read your key from MI_API_KEY. Grab one from the developer portal (free during beta), then set it once. Keep it server-side; it grants full account access.

$ export MI_API_KEY=mi_sk_beta_your_key_here
Prefer to pass it explicitly? MemoryIntelligence(api_key=...) in Python, or new MemoryIntelligence({ apiKey }) in JavaScript. Never hard-code a key in browser or committed code.

Python

Requires Python 3.10 or newer. Depends on httpx alone. View on PyPI →

1
Install
$ pip install memoryintelligence
2
Capture, ask, verify
# reads MI_API_KEY from the environment from memoryintelligence import MemoryIntelligence mi = MemoryIntelligence.from_env() note = mi.capture("Shipping moved to Tuesdays.", source="standup") for hit in mi.ask("when do we ship?"): print(hit.score, hit.summary) assert mi.verify(note.id).valid # every memory has a receipt
Results are typed. capture() returns a Memory (note.id, note.quality_score), ask() a list of Match (hit.score, hit.summary), verify() a Proof. Each keeps a .raw dict for any field we did not surface. Errors share one family: catch MIError, or the specific AuthenticationError, NotFoundError, or RateLimitError.

JavaScript & TypeScript

ESM, runs in Node and edge runtimes, fully typed. View on npm →

1
Install
$ npm install @memoryintelligence/sdk
2
Capture, ask, verify
// reads MI_API_KEY from the environment import { MemoryIntelligence } from "@memoryintelligence/sdk"; const mi = MemoryIntelligence.fromEnv(); const note = await mi.capture("Shipping moved to Tuesdays.", { source: "standup" }); for (const hit of await mi.ask("when do we ship?")) { console.log(hit.score, hit.summary); } if ((await mi.verify(note.id)).valid) console.log("intact");
Same shape as Python, in camelCase. fromEnv(); capture returns Memory, ask returns Match[], verify returns Proof. Errors extend SDKError. Every method returns a Promise. MI is a shorter alias for the same class.

The rest of the verbs

Same pattern for the other five. Python shown; JavaScript is identical in camelCase.

# get, list, explain, forget, upload one = mi.get(note.id) # one memory by id recent = mi.list(limit=20) # newest first why = mi.explain(note.id) # what matched and why mi.forget(note.id) # delete, returns a receipt mi.upload("meeting.mp3") # audio, video, image, or PDF
Capturing a lot at once? mi.batch([...]) captures many in one call. One signature differs across languages: in Python mi.upload("meeting.mp3") takes a file path, but in JavaScript upload takes a Blob/File plus a filename — await mi.upload(fileBlob, "meeting.mp3").

Handling errors

One exception family. Catch the base, or branch on the specific ones.

from memoryintelligence import MIError, AuthenticationError, RateLimitError try: note = mi.capture("...") except AuthenticationError: ... # key missing, wrong, or out of scope except RateLimitError: ... # the client already retried with backoff except MIError as e: print(e.status, e) # any API error carries its status
In JavaScript the family extends SDKError: AuthenticationError, RateLimitError, ValidationError, APIError.

Prefer raw HTTP, or another language?

Every method above is a single call against the public REST API. See the API Reference for request and response shapes with any HTTP client, or give an assistant memory with the MCP server.