Skip to content

Multi-tenant support for Cortex #2652

Open

Description

@mrsabath

Sub-issue of #2514. Owner: TBD.

Goal

Make one Cortex serve many identities safely: per-tenant credentials, per-tenant sessions and
cost attribution, and isolation strong enough that one tenant cannot see, spend or influence
another's traffic.

This is the prerequisite the other two shared-deployment substreams lean on. #2650 cannot label a
metric by tenant that does not exist, and #2651 cannot put Cortex on a shared host without it. Worth
sequencing first even though it is the least visible of the four.

Where Cortex is today

Single-tenant by construction, and reasonably so: one laptop, one user, one set of credentials, one
trust store. Several things are implicitly global — the CA, the credential store, the session list,
the config — and each becomes a cross-tenant leak the moment two identities share a process.

There is a working design to start from, not a blank page

The MOCA SBX work has already specified connection-bound multi-tenancy for exactly this proxy:

  • cortex#1476 (P0) — caller identity from the connection, carried into every bridged request
    and every plugin. The key idea worth adopting generally: identity comes from how the connection
    arrived
    (the per-VM Unix socket), never from a header the client could forge. Model-influenced code
    cannot fake it
  • cortex#1478 (P0) — credential keyed by (identity, host), resolved from a token endpoint
    rather than held per-install
  • cortex#1479 (P0) — inject into the header the credential declares, always overwriting, so a
    tenant's placeholder can never pass through
  • cortex#1480, fix(chat): Forward A2A contextId on every turn, adopt once #1481 (P1) — fail closed on hosts that have a credential; refuse to send one over
    plain HTTP
  • cortex#1482 (P1) — exactly one audit event per injection
  • cortex#1485 (P2) — per-VM connection cap and per-session request cap (429) — i.e. per-tenant
    quotas
    , so one tenant cannot exhaust the proxy
  • cortex#1486 (P2) — session recording and the session API on a shared host: the
    multi-tenant form of what agentop does locally

The generalization this issue owns is that cortex#1476's identity source is deliberately specific
(a Unix socket path on a KVM host). A shared team host, a VM or a CI runner has no such socket, so
multi-tenancy in general needs the same connection-bound property from a different mechanism —
mTLS client certs, or a local socket per tenant. The interface cortex#1476 defines should survive that
substitution; if it does not, it is the wrong interface.

Open questions

  • What is a tenant? A user, a team, a project, or an agent instance? Cost attribution, quotas and
    the session list may not want the same answer, and saying so early avoids retrofitting
  • One Cortex or one per tenant? Process isolation is far easier to defend than in-process
    separation. If the answer is a process per tenant, most of this issue becomes a supervisor problem
    instead — a cheaper outcome, and worth ruling in or out first
  • The CA, which is the hardest part: a shared proxy terminating TLS for several tenants holds one
    key that decrypts all of them. cortex#1033 (per-sandbox $HOME giving each sandbox its own CA, now
    fixed) is the small version of this
  • Who stores credentials? Per-install today; cortex#1478 moves to a resolved token endpoint
  • Does agentop become multi-tenant, or does each tenant get their own scoped view? (cortex#1486)

Work

  • Define "tenant" and the isolation claim, explicitly, before any code
  • Decide in-process vs. process-per-tenant — this determines the shape of everything else
  • Generalize connection-bound identity (cortex#1476) beyond the SBX Unix-socket mechanism
  • Per-tenant credential resolution — cortex#1478, feat: E2E tests — deferred MVP validation criteria (#5, #9, #10, #11) #1479
  • Per-tenant cost attribution and session scoping, consistent with the local semantics of cortex#950/chore(deps-dev): Bump vite from 7.3.1 to 8.0.0 in /kagenti/ui-v2 #953
  • Per-tenant quotas and caps — cortex#1485
  • Audit: one event per injection, attributable to a tenant — cortex#1482
  • CA strategy and key blast radius for a shared terminator
  • A negative test suite: one tenant attempting to read, spend or influence another's traffic, and failing
  • Docs: the isolation claim and, just as importantly, what it does not claim

Related

Assisted-By: Claude (Anthropic AI) [email protected]

Activity

  1. added
    enhancement
    Identity
    on Oct 23, 2026
  2. changed the title [-]Cortex Local: multi-tenant support for Cortex[/-] [+]Multi-tenant support for Cortex[/+] on Nov 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Identityenhancement

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions