SDK reference

@engram/sdk

The Engram SDK exposes three methods: remember, recall, and forget. That is the complete surface area by design.

Constructor

new Engram(options: EngramOptions)
agentIdrequired
string

A stable identifier for this agent. Used as the memory namespace; all memories written by this instance are keyed to this ID.

chainrequired
"base" | "base-sepolia"

The chain to anchor integrity hashes on. Use base-sepolia for development.

apiKeyrequired
string

Your Engram API key. Set via environment variable (ENGRAM_API_KEY); never hardcode.

timeout
number

Request timeout in milliseconds. Default: 10000.


remember()(input: MemoryInput) → Promise<Memory>

Writes a memory to the agent's store and anchors its hash onchain. Returns the stored memory object including its content-addressed hash.

const memory = await engram.remember({
  type: "semantic",
  content: "User prefers responses in plain English, not bullet points.",
  metadata: { source: "user-feedback", confidence: "high" },
});

// memory.hash  → "0xae21...f0"
// memory.id    → uuid
// memory.at    → ISO timestamp
typerequired
"episodic" | "semantic" | "procedural"

Memory type determines retention policy and retrieval priority. See Memory types.

contentrequired
string

The memory payload. Plain text or structured JSON string. Max 8 KB.

metadata
Record<string, unknown>

Optional key-value bag attached to the memory. Useful for filtering and debugging.

ttl
number

Time-to-live in seconds. Memory expires after this duration. Omit for permanent storage.


recall()(query: RecallQuery) → Promise<Memory[]>

Retrieves semantically relevant memories for a natural-language query. Uses vector similarity under the hood; no need to know the memory IDs.

const memories = await engram.recall({
  query: "what does the user prefer about formatting?",
  type: "semantic",
  limit: 3,
  minScore: 0.75,
});

for (const m of memories) {
  console.log(m.content, m.score);
}
queryrequired
string

Natural-language query. The SDK embeds this and retrieves the closest matching memories.

type
"episodic" | "semantic" | "procedural"

Filter results to a single memory type. Omit to search all types.

limit
number

Max results to return. Default: 10.

minScore
number

Minimum similarity score (0-1). Memories below this threshold are excluded. Default: 0.6.


forget()(id: string) → Promise<void>

Permanently deletes a memory by its hash or UUID. The deletion is recorded onchain so the memory trail remains auditable.

await engram.forget("0xae21...f0");
// or by UUID
await engram.forget("mem_01hvk9x2z5fge8rfgp2jhbv4w");

TypeScript types for all inputs and outputs are exported from @engram/sdk/types. The SDK is fully typed with no any escapes.