@kognite/sdk
TypeScript SDK for Kognite — long-term memory for AI agents.
Hybrid semantic + full-text search, LLM memory formation, and a knowledge graph,
behind one API key. Zero runtime dependencies (built on fetch).
npm install @kognite/sdk
Quickstart
import { Kognite } from "@kognite/sdk";
const kognite = new Kognite({ apiKey: process.env.KOGNITE_API_KEY! });
await kognite.memories.add({ content: "User prefers dark mode", kind: "preference" });
const { results } = await kognite.memories.search("ui preferences", { limit: 5 });
await kognite.memories.search("ui preferences", { rerank: true });
Memory formation (the good stuff)
ingest runs the pipeline behind Kognite's published LoCoMo results: it stores
raw messages as episodes and extracts atomic facts — pronouns resolved to
names, relative dates converted to absolute ones. Prefer it over add for any
multi-message context:
await kognite.memories.ingest([
{ speaker: "user", timestamp: "2026-07-15", content: "I moved to Berlin last month." },
{ speaker: "assistant", content: "Noted — how are you finding it?" },
]);
Context assembly
A token-budgeted bundle of relevant memories, ready to drop into a prompt:
const ctx = await kognite.context.assemble({ query: "user's living situation", token_budget: 2000 });
Everything else
await kognite.memories.get(id);
await kognite.memories.forget(id);
await kognite.memories.list({ limit: 50 });
await kognite.graph.query("Berlin");
await kognite.health();
Errors throw KogniteError with status (HTTP) and code
(validation_failed, quota_exceeded, not_found, …). Retries with
exponential backoff on 429/5xx/network errors are built in.
The tenant scope is derived server-side from your API key — the SDK has no
scope parameter and cannot reach another tenant. Get a key in the
dashboard, and see the live, judge-audited
benchmarks.
Self-hosted? Pass baseUrl in the constructor.
Development
smoke.live.ts is a full live-API exercise of every method (safe: runs in the
key's own scope and forgets everything it creates):
KOGNITE_API_KEY=kgn_... npx tsx smoke.live.ts