Contexts are the unit of isolation in Spectron. Each Context has its own SurrealDB database, its own API keys, and its own configuration. This page covers the operator lifecycle for creating, configuring, and removing Contexts.
Creating a Context
A Context is created via the management API. The operation:
Registers the Context in the control plane (
spectron/metadatadatabase)Creates the SurrealDB namespace and database (if they do not exist)
Applies all schema migrations to the new database
Naming constraints
Context IDs must be lowercase alphanumeric with hyphens (
acme-prod,tenant-alpha).The
spectronnamespace is reserved for internal use. Do not bind a Context tonamespace: "spectron".Two Contexts can share a namespace (different databases) or live in separate namespaces.
Using the CLI
Using the Python SDK
Listing Contexts
Returns all Contexts registered on this deployment. Provider API key values are replaced with a providers_configured list in the response.
Inspecting a Context
Returns the Context record including effective configuration:
Updating Context configuration
Send a partial config patch – only the fields you want to change:
Changes take effect immediately for new requests.
Common config updates
Rotate a provider key:
Increase the token limit:
Switch the reflection model:
Add retention policy:
Provisioning API keys
After creating a Context, provision at least one agent key for your application:
The secret is returned once in the response. Store it securely – it cannot be retrieved again. See API keys and delegation for key types and rotation.
Deleting a Context
Deleting a Context is irreversible. It drops the bound SurrealDB database, removing all authoritative knowledge and experiential memory data, all API keys for this Context, and the control-plane registry entry.
The SurrealDB namespace is not deleted – it may contain other Contexts. Only the bound database is dropped.
Before deleting
Export any data you need to retain (SurrealDB native export or the
/knowledgedownload API).Revoke or rotate any external references to this Context's API keys.
Confirm there are no active agent processes writing to this Context.
Migrating a Context
To move a Context to a different SurrealDB namespace/database:
Create a new Context with the target
(namespace, database)pair.Export data from the old Context's SurrealDB database and import it into the new database.
Update your application to use the new Context ID and new API keys.
Delete the old Context.
Schema migrations run automatically when the new Context is created, so the new database will have the correct schema before you import data.
Context isolation guarantees
A caller holding an API key for Context
acme-prodcannot read, write, or enumerate anything in another Context.Two Contexts that share a SurrealDB namespace but different databases are fully isolated at the database level.
The control plane (Context registry, management keys) lives in the reserved
spectron/metadatadatabase and is not accessible via Context-level API keys.