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-clientRequires 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):
| Parameter | Description |
|---|---|
base_url | Required. The API base URL — https://api.illumina.sh for the hosted service. |
api_key | Your sub_live_... key, sent as Authorization: Bearer <key>. |
timeout | Request timeout in seconds (default 300.0). |
user_agent | Overrides 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
| Method | Description |
|---|---|
retain | Store a single memory. |
retain_batch | Store multiple memories in one request. |
retain_files | 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 |
|---|---|
list_memories | List memory units with pagination and filters. |
get_memory | Get a single memory unit by ID. |
clear_memories | Delete memory units, optionally filtered by fact type. Destructive and irreversible. |
Namespaces
| Method | Description |
|---|---|
create_namespace | Create or update a namespace. |
set_mission | Set a namespace's mission (wrapper around create_namespace). |
set_reflect_mission | Set a namespace's reflect mission. |
delete_namespace | Delete a namespace. |
Namespace config
| Method | Description |
|---|---|
get_namespace_config | Get the resolved configuration for a namespace. |
update_namespace_config | Update config overrides, passed as keyword arguments. |
reset_namespace_config | Reset all namespace-level overrides to server defaults. |
Namespace templates
| Method | Description |
|---|---|
export_namespace_template | Export config overrides, automations, and directives as a portable manifest. |
import_namespace_template | Apply a template manifest; pass dry_run=True to validate without writing. |
Automations
| Method | Description |
|---|---|
create_automation | Create an automation (a reflect that runs in the background). |
list_automations | List automations, optionally filtered by tags. |
get_automation | Get a specific automation. |
refresh_automation | Re-synthesize an automation with current knowledge. |
clear_automation | Clear content so the next refresh performs a full re-synthesis. |
update_automation | Update an automation's metadata. |
delete_automation | Delete an automation. |
get_automation_history | Get 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
| Method | Description |
|---|---|
create_directive | Create a directive (hard rule applied during reflect). |
list_directives | List directives, optionally filtered by tags. |
get_directive | Get a specific directive. |
update_directive | Update a directive. |
delete_directive | Delete a directive. |
Documents
| Method | Description |
|---|---|
list_documents | List documents with pagination and tag filters. |
get_document | Get a specific document. |
update_document | Update a document's tags (triggers re-consolidation). |
delete_document | Delete a document and its derived memory units. |
get_document_chunks | List a document's raw text chunks, ordered by index. |
reprocess_document | Re-run the retain pipeline on an existing document. |
Entities
| Method | Description |
|---|---|
get_entity_graph | Get the entity co-occurrence graph for a namespace. |
classify_entities | Backfill ontology classes onto unclassified entities. |
Ontology
| Method | Description |
|---|---|
get_ontology | Get entity classes, typed relations, and the resolved ontology mode. |
put_ontology | Replace the namespace's ontology (whole-document). |
infer_ontology | Propose a draft ontology from the entity graph. |
get_ontology_infer_status | Poll the inference lifecycle; the stored draft is inline when ready. |
Communities
| Method | Description |
|---|---|
build_communities | Rebuild communities from the entity co-occurrence graph (background by default). |
list_communities | List communities, largest first, with build status attached. |
get_community | Get one community, including its member entities. |
get_community_status | Get the build lifecycle and live community count. |
clear_communities | Delete all communities and reset the build state. |
Audit
| Method | Description |
|---|---|
list_audit_logs | List audit log entries with filters and pagination. |
audit_stats | Get 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.