SDKs & tools
TypeScript SDK
Install and use @illumina/client, the TypeScript SDK for the Illumina API.
The TypeScript SDK is published as @illumina/client. Its IlluminaClient
class wraps every common operation and runs in Node.js, Bun, Deno, and the
browser (it uses the fetch API). All methods are async, take namespaceId as
the first argument, and accept an optional signal (an AbortSignal) inside
their options object.
Install
npm install @illumina/clientInitialize
Construct the client with the hosted base URL and your API key. The key is sent as a bearer token on every request:
import { IlluminaClient } from "@illumina/client";
const client = new IlluminaClient({
baseUrl: "https://api.illumina.sh",
apiKey: "sub_live_...",
});| Option | Description |
|---|---|
baseUrl | Required. The API base URL — https://api.illumina.sh for the hosted service. |
apiKey | Your sub_live_... key, sent as Authorization: Bearer <key>. |
userAgent | Overrides the default illumina-client-typescript/<version> header. Node.js, Bun, and Deno only — browsers ignore it. |
Core operations
Memories live in namespaces, and retain does not auto-create one — create it first:
await client.createNamespace("alice");Retain
Store raw text; Illumina extracts facts, entities, and relationships.
retain(namespaceId, content, options?):
await client.retain("alice", "Ada shipped the payments rewrite in Q3 2025.", {
context: "standup notes",
tags: ["work"],
});Options: timestamp, context, metadata, documentId, async, entities,
tags, updateMode ("replace" | "append"), observationScopes,
strategy, and factType ("world" | "experience" | "decision").
Use retainBatch(namespaceId, items, options?) for multiple memories in one
request — each item requires content:
await client.retainBatch("alice", [
{ content: "Alice loves hiking" },
{ content: "Alice visited Paris", context: "travel", timestamp: "2024-07-01" },
], { async: true });retainFiles(namespaceId, files, options?) takes an Array<File | Blob> plus
context or filesMetadata, always processes asynchronously, and returns
operation IDs for tracking progress.
Recall
Query a namespace by semantic similarity. recall(namespaceId, query, options?) — budget ("low" | "mid" | "high") controls retrieval effort
and defaults to "mid":
const recalled = await client.recall("alice", "What are Alice's hobbies?", {
budget: "mid",
includeEntities: true,
});
for (const result of recalled.results) {
console.log(result.text);
}Other options: types (filter by fact type), maxTokens, tags and
tagsMatch ("any" | "all" | "any_strict" | "all_strict"), tagGroups
(compound boolean tag filters, mutually exclusive with tags/tagsMatch),
includeChunks, includeSourceFacts, queryTimestamp, and trace.
recall returns a RecallResponse whose facts live on .results (not a bare
array). The exported helper recallResponseToPromptString(response)
serializes a response into a string for LLM prompts.
Reflect
Ask a higher-level question over everything the namespace knows.
reflect(namespaceId, query, options?) — budget defaults to "low"; the
answer is on .text:
const answer = await client.reflect("alice", "Summarize Ada's recent work", {
factTypes: ["world", "observation"],
});
console.log(answer.text);Other options: context, maxTokens, responseSchema (a JSON Schema — the
response then includes structured_output), tags, tagsMatch, tagGroups,
excludeAutomations, and excludeAutomationIds.
Error handling
Failed requests throw an IlluminaError carrying statusCode and details:
import { IlluminaClient, IlluminaError } from "@illumina/client";
try {
await client.recall("missing", "anything");
} catch (err) {
if (err instanceof IlluminaError) {
console.error(err.statusCode, err.details);
}
}Method reference
Retain
| Method | Description |
|---|---|
retain | Store a single memory. |
retainBatch | Store multiple memories in one request. |
retainFiles | Upload files and retain their contents; always asynchronous, returns operation IDs. |
Recall
| Method | Description |
|---|---|
recall | Retrieve memories by semantic similarity. |
Reflect
| Method | Description |
|---|---|
reflect | Generate a contextual answer from the namespace's identity and memories. |
Memories
| Method | Description |
|---|---|
listMemories | List memory units with pagination and filters. |
Namespaces
| Method | Description |
|---|---|
createNamespace | Create or update a namespace. |
setMission | Deprecated — forwards to createNamespace({ reflectMission }). |
getNamespaceProfile | Get a namespace's profile. |
deleteNamespace | Delete a namespace. |
The createNamespace disposition fields (name, mission, background,
disposition*) are deprecated in favour of updateNamespaceConfig.
Namespace config
| Method | Description |
|---|---|
getNamespaceConfig | Get the resolved configuration for a namespace. |
updateNamespaceConfig | Update configuration overrides. |
resetNamespaceConfig | Reset all namespace-level overrides to server defaults. |
Automations
| Method | Description |
|---|---|
createAutomation | Create an automation (runs reflect in the background). |
listAutomations | List automations, optionally filtered by tags. |
getAutomation | Get a specific automation. |
refreshAutomation | Re-synthesize an automation with current knowledge. |
clearAutomation | Clear content so the next refresh performs a full re-synthesis. |
updateAutomation | Update an automation's metadata. |
deleteAutomation | Delete an automation. |
getAutomationHistory | Get an automation's change history. |
Directives
| Method | Description |
|---|---|
createDirective | Create a directive (hard rule for reflect). |
listDirectives | List directives, optionally filtered by tags. |
getDirective | Get a specific directive. |
updateDirective | Update a directive. |
deleteDirective | Delete a directive. |
Documents
| Method | Description |
|---|---|
listDocuments | List documents with pagination and tag filters. |
getDocument | Get a document by ID; returns null if not found. |
updateDocument | Update a document's mutable fields (tags). |
deleteDocument | Delete a document. |
Ontology
| Method | Description |
|---|---|
getOntology | Get entity classes, typed relations, and the resolved ontology mode. |
putOntology | Replace the namespace's ontology (whole-document). |
inferOntology | Propose a draft ontology from the entity graph. |
getOntologyInferStatus | Poll the inference lifecycle; the stored draft is inline when ready. |
classifyEntities | Backfill ontology classes onto unclassified entities. |
Communities
| Method | Description |
|---|---|
buildCommunities | Rebuild communities from the entity co-occurrence graph (background by default). |
listCommunities | List communities, largest first, with build status attached. |
getCommunity | Get one community, including its member entities. |
getCommunityStatus | Get the build lifecycle and live community count. |
clearCommunities | Delete all communities and reset the build state. |
Beyond the wrapper
The package re-exports the generated layer for any endpoint the wrapper does not cover (entity graph, operations, webhooks, namespace templates, monitoring):
import { sdk, createClient, createConfig } from "@illumina/client";Request and response types are exported from the package root as well (for
example RecallResponse, ReflectResponse, RetainResponse, Budget,
MemoryItem).