SDKs & tools

Python SDK

Install and use illumina-client, the Python SDK for the Illumina API.

The Python SDK is published as illumina-client and imported as illumina_client. Its Illumina class wraps every common operation, and every method ships with an a-prefixed async twin (retain/aretain, recall/arecall, and so on) that uses its own transport — neither variant depends on the other's event loop.

Install

pip install illumina-client

Requires Python 3.10 or newer.

Initialize

Construct the client with the hosted base URL and your API key. The key is sent as a bearer token on every request:

from illumina_client import Illumina
 
client = Illumina(base_url="https://api.illumina.sh", api_key="sub_live_...")

The full constructor is Illumina(base_url, api_key=None, timeout=300.0, user_agent=None):

ParameterDescription
base_urlRequired. The API base URL — https://api.illumina.sh for the hosted service.
api_keyYour sub_live_... key, sent as Authorization: Bearer <key>.
timeoutRequest timeout in seconds (default 300.0).
user_agentOverrides the default illumina-client-python/<version> header.

Async

Every method has an async counterpart prefixed with a. The client is also a context manager (sync and async) that closes its transports on exit:

import asyncio
from illumina_client import Illumina
 
async def main():
    async with Illumina(base_url="https://api.illumina.sh", api_key="sub_live_...") as client:
        await client.aretain(namespace_id="alice", content="Alice loves AI")
        response = await client.arecall(namespace_id="alice", query="What does Alice like?")
        for result in response.results:
            print(result.text)
 
asyncio.run(main())

Core operations

Memories live in namespaces, and retain does not auto-create one — create it first:

client.create_namespace(namespace_id="alice")

Retain

Store raw text; Illumina extracts facts, entities, and relationships:

client.retain(
    namespace_id="alice",
    content="Ada shipped the payments rewrite in Q3 2025.",
    context="standup notes",
    tags=["work"],
)

retain also accepts timestamp, document_id, metadata, entities ([{"text": "...", "type": "..."}]), update_mode ("replace" or "append"), fact_type ("world", "experience", or "decision"), and retain_async=True to process in the background.

Use retain_batch for multiple memories in one request — each item is a dict with a required content key:

client.retain_batch(
    namespace_id="alice",
    items=[
        {"content": "Alice loves hiking"},
        {"content": "Alice visited Paris", "context": "travel", "timestamp": "2024-07-01"},
    ],
)

retain_files(namespace_id, files, context=None, files_metadata=None) uploads files, always processes them asynchronously, and returns operation IDs for tracking progress.

Recall

Query a namespace by semantic similarity. budget ("low", "mid", "high") controls retrieval effort and defaults to "mid"; max_tokens defaults to 4096:

response = client.recall(
    namespace_id="alice",
    query="What are Alice's hobbies?",
    budget="mid",
    include_entities=True,
)
for result in response.results:
    print(result.text, result.type_)

Other keyword arguments: types (filter by fact type), tags and tags_match ("any", "all", "any_strict", "all_strict"), tag_groups (compound boolean tag filters), include_chunks, include_source_facts, query_timestamp, and trace.

RecallResponse is iterable, supports len(), and has .to_prompt_string() to serialize results for LLM prompts. Each RecallResult carries .text, .type_, and optional .context and temporal fields.

Reflect

Ask a higher-level question over everything the namespace knows. budget defaults to "low"; the answer is on .text:

answer = client.reflect(
    namespace_id="alice",
    query="Summarize Ada's recent work",
    include_facts=True,
)
print(answer.text)

Other keyword arguments: context, max_tokens, response_schema (a JSON Schema — the response then includes structured_output), tags, tags_match, tag_groups, fact_types, exclude_automations, and exclude_automation_ids. include_facts=True adds a based_on field listing the sources used.

Error handling

Any non-success (>= 400) response raises IlluminaAPIError, which carries status_code, detail, and the raw content:

from illumina_client import Illumina, IlluminaAPIError
 
client = Illumina(base_url="https://api.illumina.sh", api_key="sub_live_...")
 
try:
    client.recall(namespace_id="missing", query="anything")
except IlluminaAPIError as err:
    print(err.status_code, err.detail)

Method reference

Every method below exists in sync and async (a-prefixed) form.

Retain

MethodDescription
retainStore a single memory.
retain_batchStore multiple memories in one request.
retain_filesUpload files and retain their contents; always asynchronous, returns operation IDs.

Recall

MethodDescription
recallRetrieve memories by semantic similarity.

Reflect

MethodDescription
reflectGenerate a contextual answer from the namespace's identity and memories.

Memories

MethodDescription
list_memoriesList memory units with pagination and filters.
get_memoryGet a single memory unit by ID.
clear_memoriesDelete memory units, optionally filtered by fact type. Destructive and irreversible.

Namespaces

MethodDescription
create_namespaceCreate or update a namespace.
set_missionSet a namespace's mission (wrapper around create_namespace).
set_reflect_missionSet a namespace's reflect mission.
delete_namespaceDelete a namespace.

Namespace config

MethodDescription
get_namespace_configGet the resolved configuration for a namespace.
update_namespace_configUpdate config overrides, passed as keyword arguments.
reset_namespace_configReset all namespace-level overrides to server defaults.

Namespace templates

MethodDescription
export_namespace_templateExport config overrides, automations, and directives as a portable manifest.
import_namespace_templateApply a template manifest; pass dry_run=True to validate without writing.

Automations

MethodDescription
create_automationCreate an automation (a reflect that runs in the background).
list_automationsList automations, optionally filtered by tags.
get_automationGet a specific automation.
refresh_automationRe-synthesize an automation with current knowledge.
clear_automationClear content so the next refresh performs a full re-synthesis.
update_automationUpdate an automation's metadata.
delete_automationDelete an automation.
get_automation_historyGet an automation's content change history.

create_automation and update_automation accept a trigger_refresh_after_consolidation: bool shortcut that expands to trigger={"refresh_after_consolidation": value}; an explicit trigger dict takes precedence.

Directives

MethodDescription
create_directiveCreate a directive (hard rule applied during reflect).
list_directivesList directives, optionally filtered by tags.
get_directiveGet a specific directive.
update_directiveUpdate a directive.
delete_directiveDelete a directive.

Documents

MethodDescription
list_documentsList documents with pagination and tag filters.
get_documentGet a specific document.
update_documentUpdate a document's tags (triggers re-consolidation).
delete_documentDelete a document and its derived memory units.
get_document_chunksList a document's raw text chunks, ordered by index.
reprocess_documentRe-run the retain pipeline on an existing document.

Entities

MethodDescription
get_entity_graphGet the entity co-occurrence graph for a namespace.
classify_entitiesBackfill ontology classes onto unclassified entities.

Ontology

MethodDescription
get_ontologyGet entity classes, typed relations, and the resolved ontology mode.
put_ontologyReplace the namespace's ontology (whole-document).
infer_ontologyPropose a draft ontology from the entity graph.
get_ontology_infer_statusPoll the inference lifecycle; the stored draft is inline when ready.

Communities

MethodDescription
build_communitiesRebuild communities from the entity co-occurrence graph (background by default).
list_communitiesList communities, largest first, with build status attached.
get_communityGet one community, including its member entities.
get_community_statusGet the build lifecycle and live community count.
clear_communitiesDelete all communities and reset the build state.

Audit

MethodDescription
list_audit_logsList audit log entries with filters and pagination.
audit_statsGet audit log counts grouped by time bucket.

Beyond the wrapper

For operations without a convenience method (async operations, webhooks, monitoring, remaining entity ops), use the per-group accessors, which pre-bind the low-level client:

client.documents.delete_document.sync(namespace_id, document_id)
await client.operations.get_operation_status.asyncio(namespace_id, op_id)

Available groups: memory, namespaces, documents, entities, automations, directives, operations, webhooks, files, monitoring, audit, communities, ontology, and namespace_templates. Each operation exposes sync, sync_detailed, asyncio, and asyncio_detailed.

Search docs

Search the documentation