Clients
- Tenant-scoped client:
MemoryOS - Universal cross-agent client:
UniversalMemoryOS
MemoryOS for normal workspace memory inside your tenant. Use UniversalMemoryOS only after a user has granted your global agent access through Memory Passport.
There is no separate SDK for domain schemas. If your tenant enables EdTech or Support, add() and get() remain the main integration path. Optional domain helper methods expose structured profile data for dashboards.
How domain schemas work with the SDK
Domain schemas are configured on the tenant, not in SDK code. That means this code stays the same:| Tenant setting | What add() does | What get() returns |
|---|---|---|
| General Engine | Generic memory extraction | Generic prompt-ready memory |
| EdTech Schema | Generic memory + EdTech overlay | Generic memory + tutoring/student context |
| Customer Support Schema | Generic memory + Support overlay | Generic memory + support/customer context |
systemPromptAddition can include current issue, support history, resolution preference, sentiment risk, and safety rules. Your own tools still provide live truth such as order status, invoice status, refunds, or ticket updates.
Use the same SDK methods for all three modes.
add()
Parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
messages | ConversationMessage[] | Yes | At least one message |
externalUserId | string | Yes | End-user identifier inside your tenant |
agentId | string | undefined | No | Optional agent identifier |
metadata | Record<string, unknown> | undefined | No | Optional metadata |
Return fields
| Field | Type | Meaning |
|---|---|---|
jobId | string | null | Extraction job id when queued |
status | string | Current add outcome |
blockedReason | string | null | Reason when blocked |
retryAfterSeconds | number | null | Retry hint for L1 blocks |
budgetRemainingPct | number | null | Remaining tenant budget percentage |
quotaMode | "FULL" | "PASSTHROUGH" | "DEGRADED_RETRIEVE" | "BLOCKED" | Quota mode from headers |
processingEtaSeconds | number | null | Queue ETA when delayed |
processingStatus | "normal" | "delayed" | Background ingestion health |
circuitStatus | "HEALTHY" | "DEGRADED" | "CRITICAL" | Platform dependency status |
Status outcomes
status value | Meaning | Typical action |
|---|---|---|
queued | Request accepted and job queued | Track the job if needed |
passthrough | Writes are bypassed in the current quota mode | Continue without persistence |
L1 | Per-user rate limit exceeded | Retry after retryAfterSeconds |
L2 | Low-quality input was blocked | Improve message quality |
L3 | Duplicate query was blocked | Avoid near-identical writes |
L4 | Budget governance blocked the request | Upgrade or wait for reset |
blocked | Internal gate fallback | Retry later |
get()
Parameters
| Parameter | Type | Required | Notes |
|---|---|---|---|
query | string | Yes | Natural-language retrieval query |
externalUserId | string | Yes | End-user identifier inside your tenant |
limit | number | No | Default 10 |
categories | MemoryCategory[] | undefined | No | Optional category filter |
timeFilterDays | number | undefined | No | Return only memories from the last N days |
format | "bullets" | "json" | "xml" | No | Format for systemPromptAddition |
contextMaxTokens | number | No | Prompt context token budget, default 500 |
Return fields
| Field | Type | Meaning |
|---|---|---|
items | MemoryItem[] | Retrieved memories |
cached | boolean | Whether the result came from the hot cache |
systemPromptAddition | string | Prompt-ready context block |
contextTokenCount | number | Tokens used by systemPromptAddition |
memoriesFromHotTier | number | Number of returned memories served from hot tier |
quotaMode | "FULL" | "PASSTHROUGH" | "DEGRADED_RETRIEVE" | "BLOCKED" | Quota mode |
isPassthrough | boolean | Skip memory context when true |
isDegraded | boolean | Retrieval is degraded when true |
circuitStatus | "HEALTHY" | "DEGRADED" | "CRITICAL" | Platform dependency status |
UniversalMemoryOS
MemoryOS. It uses agent credentials and a user UUI token:
Authorization: ApiKey agent_sk_...X-MemoryOS-UUI: uui_...
UniversalMemoryOS.consentUrl()
null for the callback, MemoryOS shows a hosted completion page after approval.
The fourth argument preselects categories for this consent link. Users can still add or remove categories before approving. If you omit it, MemoryOS uses the global agent’s default categories.
Pass a callback only if your app needs to update its own UI automatically:
universal.add()
universal.get()
| Field | Type | Meaning |
|---|---|---|
categoriesAvailable | string[] | Memory categories the user granted this agent |
permissionStatus | string | null | Permission status, such as no_grant_for_user, when no active grant exists |
Degradation handling pattern
Domain profile helpers
For domain-aware tenants, normalget() already includes domain-aware context. Use profile helpers only when your product needs structured UI data.
EdTech example:
delete()
list()
itemsnextCursorlimittotal
export()
MemoryExport object with:
usermemoriesapiKeysagents
export() currently maps to the user export endpoint, not a tenant-wide export endpoint.
getUsage() and deleteUser()
The current TypeScript SDK does not expose getUsage() or deleteUser().
Use the REST API directly for those operations:
- tenant usage:
GET /v1/tenant/usage - current user deletion:
DELETE /v1/users/me - tenant proxy-user deletion:
DELETE /v1/users/{external_user_id}