supermemory

A MemoryProvider that stores records in Supermemory.

Pass it as agent({memory: supermemory()}). Each scope is its own container; saves are effects that park when uncertain, since Supermemory documents no dedup window.

Import from @threads/supermemory (TypeScript) or threads.supermemory (Python).

function supermemory(options?: {
  apiKey?: string | Secret;
  baseUrl?: string;
  fetch?: (input: string | URL | Request, init?: RequestInit) => Promise<Response>;
}): MemoryProvider

Parameters

apiKey / api_keystring | Secret

The Supermemory API key: a secret() or a string. Omitted: secret("SUPERMEMORY_API_KEY"). Resolved on the host at setup (check() or the first run); unset is missing_secret naming the option and the variable. A string is redacted like a revealed secret.

baseUrl / base_urlstring

The Supermemory API base URL. Omitted: the SDK's default endpoint.

fetch(input: string | URL | Request, init?: RequestInit) => Promise<Response>

TypeScript only. Seam: the fetch the SDK sends through (a proxy, a test server); the run's fence wraps it either way. Omitted: globalThis.fetch.

Returns

MemoryProvider

Throws ConfigError with one of these codes: missing_secret.

Edit on GitHub

On this page