Skip to main content
← PROBLEMS / SYSTEM-DESIGN
An end-to-end domain learning journey

Design a Multi-Tenant Enterprise
Skill-Based Agent Platform.

Design a multi-tenant enterprise agent platform hosting 1,000+ versioned skills across 500 organizations with <50ms skill routing, zero-trust RBAC/secret isolation, and immutable compliance auditing.
Start the journey7 stages· Last modified Nov 24, 2026
FIRST PRINCIPLES. PRODUCTION SCALE.
The idea to keep with you

If model quality drifts from offline training baselines, pair a versioned, CI-scanned Skill Registry with an RBAC-filtered semantic router, lazy-load context hydrator, per-tenant secret vault, and isolated MCP execution workers.

TL;DR30-second simplified summary
▾

The platform stores immutable, SHA-256-addressed skill bundles in S3 and regional Redis, with Postgres pointers enabling instant rollbacks. An RBAC-pre-filtered vector router selects top-10 permitted skills in <50ms, and a deduplicating Context Hydrator enforces token ceilings.

A Per-Tenant Secret Vault mints 60-second delegated OAuth tokens for bulkhead-isolated MCP Proxy Workers.

Before you begin · Building blocksAlready know these? Jump to Stage 01 ↓
Enterprise Skill-Based Agent Architecture
An Enterprise Skill-Based Agent Architecture replaces bloated 200-tool system prompts with a compact skill index and progressive-disclosure SKILL.md bundles that lazy-load instructions, scripts, and RBAC-scoped MCP tools on demand.
Full walkthrough · 7 stages
01
foundation

Multi-Tenant Skill Registry & Digest Versioning.

Why this matters: Store global platform skills and tenant-private overrides with instant rollback.

Think of Multi-Tenant Skill Registry & Digest Versioning as the intuition layer for Design a Multi-Tenant Enterprise Skill-Based Agent Platform: Store global platform skills and tenant-private overrides with instant rollback.

PostgreSQL stores skill metadata (tenant_id, skill_name, semver, sha256_digest, status), while immutable skill tarballs (SKILL.md, scripts/, assets/) live in S3 keyed by sha256_digest. Tenants inherit global skills and override specific names via (tenant_id, skill_name) precedence, allowing instant zero-downtime rollbacks by flipping the active pointer.

Stage 1 - Skill Registry

Content-Addressed Skill Registry

Tenant / GlobalAuthorsourcePostgres MetadatastorageS3 Content StorecacheRegional RedisCachesinkStore immutable tarball

1.Digest Immutability: Caching by sha256_digest means cached bundles never go stale.

2.Tenant Precedence: Resolve conflicts deterministically: User > Tenant > Global.

Content-addressed S3 storage and pointer-based Postgres metadata give instant rollbacks.

02
foundation

CI Security Scanner & Supply-Chain Admission.

Why this matters: Automatically vet every tenant-uploaded skill before it can execute in production.

Think of CI Security Scanner & Supply-Chain Admission as the intuition layer for Design a Multi-Tenant Enterprise Skill-Based Agent Platform: Automatically vet every tenant-uploaded skill before it can execute in production.

Before a skill version transitions from DRAFT to ACTIVE, an async CI pipeline runs Semgrep/Bandit AST scans on bundled scripts (blocking subprocess, raw sockets, eval), checks SKILL.md with a prompt-injection classifier, and verifies declared MCP scopes against the tenant's allowed connector list.

Stage 2 - CI Gate

Automated Skill Admission Pipeline

Skill SubmissionsourceSemgrep / AST ScanprocessorInjectionClassifierrouterSigned ACTIVE SkillsinkScan SKILL.md

1.Deterministic Blocks: Reject skills referencing undeclared environment variables or external IPs.

2.Quarantine Mode: Flagged skills require explicit Security Admin sign-off.

Automated AST and prompt-injection gates stop poisoned skills before deployment.

Engineering Decision Framework
Problem
How to implement Design a Multi-Tenant Enterprise Skill-Based Agent Platform without hitting unbounded tail latency, state divergence, or operational fragility.
Naive Solution
Use a single unpartitioned path with unbounded retries and synchronous global coordination.
Why It Fails
Global coordination serializes throughput under load, while unbounded retries amplify transient stalls into full outages.
Alternatives
Compare synchronous strict-consistency paths against bounded asynchronous replication, local caching, or partitioned ownership.
Engineering Decision
If model quality drifts from offline training baselines, pair a versioned, CI-scanned Skill Registry with an RBAC-filtered semantic router, lazy-load context hydrator, per-tenant secret vault, and isolated MCP execution workers.
Trade-Offs
Gains predictable p99 latency and fault isolation in exchange for explicit bounding, observability, and slightly higher implementation complexity.
Decision Exercise · Make the Call

When Design a Multi-Tenant Enterprise Skill-Based Agent Platform experiences a sudden 5x traffic spike alongside a slow downstream dependency, which engineering choice best protects system stability?

03
intermediate

RBAC-Filtered Semantic Skill Router (<50ms).

Why this matters: Retrieve the top-K relevant and authorized skills from 1,000+ candidates in milliseconds.

Think of RBAC-Filtered Semantic Skill Router (<50ms) as the intuition layer for Design a Multi-Tenant Enterprise Skill-Based Agent Platform: Retrieve the top-K relevant and authorized skills from 1,000+ candidates in milliseconds.

Each skill's description is embedded into a 384-dim vector stored in Qdrant/pgvector with payload attributes (tenant_id, allowed_groups). At query time, the router embeds the user's intent (~5ms) and runs a filtered ANN search (tenant_id IN ('global', caller_tenant) AND allowed_groups && caller_groups), returning the top-10 permitted skills to the agent.

Stage 3 - Semantic Router

RBAC-Filtered Vector Skill Router

User Turn + JWTsourceONNX EmbedderprocessorFiltered VectorIndexcacheTop-10 ShortlistsinkANN with RBAC filter

1.Pre-Filter Security: Never post-filter vector results; pre-filtering guarantees zero forbidden leakage.

2.Pinning Support: Allow workflows to pin explicit skill_ids, bypassing semantic search.

RBAC-pre-filtered vector search scales to 1,000+ skills per tenant under 50ms.

04
intermediate

Lazy-Load Context Hydrator & Token-Budget Guard.

Why this matters: Inject only needed SKILL.md sections and assets without blowing the model's context window.

Think of Lazy-Load Context Hydrator & Token-Budget Guard as the intuition layer for Design a Multi-Tenant Enterprise Skill-Based Agent Platform: Inject only needed SKILL.md sections and assets without blowing the model's context window.

When the agent calls lookup_skills(['incident-triage']), the Context Hydrator fetches the bundle from Redis, verifies its SHA-256 signature, enforces a per-skill token ceiling (e.g., max 4K tokens for SKILL.md), and tracks hydrated skills in session state so repeat calls in the same conversation return a lightweight reference rather than duplicating text.

Stage 4 - Context Hydrator

Deduplicated Skill Context Hydrator

lookup_skills()sourceRedis Bundle CachecacheSession Dedup MaprouterInjected PromptsinkCheck session history

1.Idempotent Hydration: Prevent the agent from wasting tokens by re-loading the same skill twice.

2.Asset On-Demand: Expose get_skill_asset() as a separate call for heavy reference docs.

Session-deduplicated hydration prevents redundant skill injections across multi-turn loops.

05
intermediate

Per-Tenant Policy & Secret Vault (Delegated OAuth).

Why this matters: Authenticate MCP tool calls across 500 enterprises without storing long-lived god keys.

Think of Per-Tenant Policy & Secret Vault (Delegated OAuth) as the intuition layer for Design a Multi-Tenant Enterprise Skill-Based Agent Platform: Authenticate MCP tool calls across 500 enterprises without storing long-lived god keys.

The Per-Tenant Secret Vault (HashiCorp Vault / KMS) stores tenant OAuth app credentials and per-user encrypted refresh tokens. When an execution worker runs an MCP tool, the Vault mints a short-lived (60s), scope-narrowed access token for that specific user and connector, ensuring Salesforce/Jira audit logs record the exact human principal.

Stage 5 - Secret Vault

Delegated OAuth & Vault Broker

MCP Tool RequestsourceTenant OPA PolicyrouterPer-Tenant VaultcacheEnterprise SaaS APIsinkExchange user OAuth

1.Zero Shared Secrets: Separate KMS encryption keys per tenant enforce cryptographic isolation.

2.Step-Up Auth: Require interactive confirmation for destructive scopes like delete or transfer.

Delegated OAuth token brokering preserves enterprise identity attribution end-to-end.

06
advanced

Isolated Tool Execution Workers & MCP Connection Pooling.

Why this matters: Execute bundled skill scripts and high-throughput MCP calls safely per tenant.

Think of Isolated Tool Execution Workers & MCP Connection Pooling as the intuition layer for Design a Multi-Tenant Enterprise Skill-Based Agent Platform: Execute bundled skill scripts and high-throughput MCP calls safely per tenant.

Bundled skill scripts run inside tenant-tagged gVisor/Firecracker sandboxes with read-only skill mounts and zero cross-tenant network reachability. Meanwhile, stateless MCP Proxy Workers maintain TLS connection pools to enterprise SaaS endpoints with per-tenant circuit breakers so a slow Tenant A Jira instance never stalls Tenant B.

Stage 6 - Isolated Workers

Tenant-Isolated Execution Plane

Worker DispatcherroutergVisor/FirecrackerprocessorMCP Proxy PoolcacheTenant InternalAPIssinkCall SaaS / Internal

1.Bulkhead Isolation: Dedicated worker queues and circuit breakers per tenant prevent noisy neighbors.

2.PrivateLink Support: Support AWS PrivateLink / mTLS for enterprise on-prem MCP connectors.

Bulkhead-isolated MCP pools and sandboxed script workers eliminate cross-tenant interference.

07
advanced

Immutable Compliance Audit Log & Tenant FinOps.

Why this matters: Deliver SOC2/HIPAA-grade immutable audit trails and per-skill cost attribution.

Think of Immutable Compliance Audit Log & Tenant FinOps as the intuition layer for Design a Multi-Tenant Enterprise Skill-Based Agent Platform: Deliver SOC2/HIPAA-grade immutable audit trails and per-skill cost attribution.

Every skill load, policy decision, and MCP tool invocation writes a hash-chained AuditEvent (tenant_id, user_id, skill_digest, tool_name, redacted_args, outcome) to Kafka -> S3 Object Lock (WORM) + ClickHouse. Tenants query real-time dashboards for adoption, failure hotspots, and token spend per department.

Stage 7 - Immutable Audit

WORM Compliance & ClickHouse FinOps

Policy & Tool HookssourceKafka Audit BusprocessorS3 Object Lock(WORM)storageClickHouseDashboardssinkArchive immutable log

1.Tamper Evidence: Hash-chaining events per tenant detects any missing or altered audit records.

2.PII Masking: Redact sensitive fields before indexing into ClickHouse analytics.

Hash-chained WORM audit logs satisfy enterprise compliance while powering FinOps analytics.

Practice · Explain the consequences

Practice: Make the trade-off yourself.

Question 1 of 3
Score: 0/3

When retrieving candidate skills from a 1,000-skill vector index across 500 tenants, why must RBAC and tenant filtering happen inside the vector query (pre-filtering) rather than after?

Recommended Learning Flow