Skip to content

Architecture multi-tenant

Commander isole les tenants à chaque couche.

Flux de requête

Request → HttpServer

           ├─ authenticate()           ← Bearer → mapping tenant
           ├─ resolveTenantFromAuth()  ← API key → tenantId

           └─ execute({ tenantId }) → AgentRuntime

                                        ├─ TenantProvider.getTenantConfig(tenantId)
                                        │   → tokenBudget, maxConcurrency, maxRunsPerMinute

                                        ├─ Rate limit / Concurrency

                                        └─ Instances scopées tenant :
                                            SamplesStore / TraceStore / StateCheckpointer
                                            ThreeLayerMemory / ToolResultCache(tenantId inclus)

Couches d’isolation

CoucheMécanisme
Rate limitsReq/min par tenant
ConcurrencyRuns concurrent max par tenant
StorageRépertoires par tenant
MemoryThreeLayerMemory par instance
CacheClé SHA-256 avec tenantId
MetricsLabel tenant partout

Providers

ProviderComportement
NullTenantProviderPas d’isolation (mono-tenant)
SimpleTenantProviderMap statique tenant → config

TenantConfig

typescript
interface TenantConfig {
  tenantId: string;
  tokenBudget: number;
  maxConcurrency: number;
  maxRunsPerMinute: number;
  enabled: boolean;
  workspacePath?: string;
}

Ops

bash
export COMMANDER_API_KEY="long-random-secret"
npx tsx packages/core/src/cliEntry.ts doctor
curl -s http://localhost:4000/health/detailed

CLI local mono-machine : souvent NullTenantProvider. Prod partagée : Simple (ou custom) + quotas.

Voir aussi

MIT — Conçu pour l’orchestration multi-agents.