Brain Docs
Build

Wire it in

Drop it into an existing loopA chatbot that remembersHandling corrections

Production

Alongside your RAGOne space per customerErasing a subject

Working with the API

Error handlingRetries and cancellationIdempotencyStreamingGraph queriesFaithfulness checkingIdentity walkthroughNamespace lifecycle

Reference

Brain/Docs
✦ ASKBrain on GitHubDashboard
BuildNamespace lifecycle

Namespace lifecycle

Plan, create, populate, and decommission a namespace — the tenant boundary. Tenancy is managed in the dashboard; per-namespace schema is declared over the wire.

PURPOSE

Drive a namespace through its whole life: decide where a tenant boundary belongs, create it and its spaces in the dashboard, declare its schema, verify a key resolves to it, and decommission it — using only the real surface.

◇Prerequisites
  • Dashboard access to your Arc Labs org (tenancy is a control-plane concern).
  • Familiarity with the namespaces concept and identity.
▸What you'll build

A repeatable checklist for standing up a new tenant: one namespace, its spaces, keys, and schema — plus how to verify and tear it down.

A namespace is a tenant boundary, not a folder

A namespace is the top-level isolation boundary — it owns its memories, entities, statements, and relations, and no key outside it can read across. Create a namespace for a product, a customer tier, or an environment — never per end-user. The right heuristic and the anti-patterns are in Namespaces.

Namespaces, spaces, and keys are provisioned out of band — through the admin API or your managed dashboard — never by a memory verb. The data plane (the wire protocol) only ever scopes each request to the (namespace, space) its key resolves to.

Step-by-step

Decide what the namespace represents before you create it. One namespace per product or per enterprise customer; environments (dev, staging, production) as separate namespaces of the same code. End-users are not namespaces — they share a namespace, isolated by the space their key is bound to.

In the dashboard: create and name the namespace (tenant), then create the spaces (apps / personas) inside it. A namespace can hold many spaces; each is a distinct reader/writer.

Mint an API key bound to each (namespace, space) with the permission flags that space needs (POST /v1/api-keys on the admin API, or the managed dashboard). The plaintext secret is shown once — store it in your secret manager immediately. Give each space its own key so you can rotate or revoke one without touching the others. See Identity walkthrough.

Schema is always on — the seeded brain: system namespace is active from byte zero — and user declarations merge into it additively. To constrain which typed entities, statements, and relations your namespace accepts, upload a schema with the wire client's uploadSchema. Typed-graph writes then check per-type against it.

const up = await client.uploadSchema({
  schemaDocument: schemaText,
  dryRun: false,       // dryRun: true validates without applying
  allowBreaking: false,
  requestId: newId(),
});
// up: { namespace, schemaVersion, validationErrors, backwardCompatible, ... }

Uploading is wire-only; see Typed graph → Schema. Recall, extraction, and indexing run regardless of what you declare — schema narrows explicit typed-graph writes and which extracted candidates persist, it does not gate reads.

Before pointing production traffic at the new key, confirm it resolves where you expect:

const probe = await BrainClient.connect("127.0.0.1", 9090, {
  auth: { kind: "token", token: new TextEncoder().encode(NEW_KEY) },
});
if (probe.namespace !== "acme-prod") throw new Error(`key resolves to ${probe.namespace}`);
await probe.close();
probe = BrainClient.connect("127.0.0.1", 9090, Auth.token(NEW_KEY.encode()))
assert probe.namespace == "acme-prod", f"key resolves to {probe.namespace}"
let probe = BrainClient::connect(addr, Auth::Token(NEW_KEY.to_string().into_bytes())).await?;
if probe.namespace() != "acme-prod" {
    return Err(format!("key resolves to {:?}", probe.namespace()).into());
}

To retire a tenant, revoke its keys (DELETE /v1/api-keys/{key_hash_hex}) and delete the namespace. Revoked keys fail authentication immediately; a deleted namespace stops accepting reads and writes. Because keys are the entry point, revoking them is the fast kill switch even before deletion completes.

Migration and re-embedding

Brain is a single binary — there is no external database to attach and no pgvector to re-dimension. Brain owns its embedding model (BGE-small, 384-dim); clients send text, not vectors. There is no data-plane "reembed job" verb in the API. Operational migration and admin tooling (brainctl) is future work; for now, tenant lifecycle is dashboard creation plus schema declaration.

Set the tenant's schema before its first production write. Extraction persists typed-graph rows only for declared types, so declaring the schema after data has flowed leaves earlier writes without the typed structure you expected.

See also
Multi-tenantOne namespace per tenant, or a pooled key with act_as.Identity walkthroughKeys bind to a single namespace and space.Namespaces conceptWhen to create a boundary, and when not to.Identity by keyHow a key binds to a namespace and space.

Was this page helpful?

Identity walkthrough

How an API key carries identity — it binds a (namespace, space) scope at creation, the server derives everything from it, and the connected client reports it back.

Run

Operating Brain yourself — the two processes, the platform it requires, the memory it needs, and the three things it refuses to start without.

On this page

A namespace is a tenant boundary, not a folderStep-by-stepMigration and re-embedding
Suggest an editOpen in Playground