Overview
SaaS products need tenant-level data isolation. A missingtenantId means a data leak. RadarOS provides TenantScopedStorage that transparently wraps any StorageDriver with tenant namespace prefixing.
Quick Start
Tenant-Scoped Storage
Wraps anyStorageDriver to prefix all keys with the tenant ID:
Isolation Modes
| Mode | Behavior |
|---|---|
"namespace" | Prefix all storage keys with t:{tenantId}: |
"strict" | Require separate storage instance per tenant |
Extracting Tenant ID
From Headers
From JWT Claims
Context Propagation
ThetenantId flows through the entire request lifecycle:
- RunOpts →
agent.run(input, { tenantId: "acme" }) - RunContext →
ctx.tenantIdavailable in hooks and tools - Storage → All reads/writes scoped automatically
- Events →
tenant.scopedevent emitted - Audit →
tenantIdrecorded in audit entries
Events
| Event | Payload |
|---|---|
tenant.scoped | { tenantId, agentName } |