Architecture

Multi-Tenant AI Agent Architecture

Building AI agents for enterprise? Learn how to isolate tenants, enforce per-customer policies, and maintain security at scale.

Veto TeamFebruary 5, 202613 min

Building AI agents for multiple tenants requires careful isolation. One tenant's agent should never access another tenant's data.

Tenant Isolation

tenant_isolation.pypython
from veto import Veto, Policy

veto = Veto(api_key="veto_live_xxx")

async def handle_request(request, tenant_id: str):
    # Set tenant context for this request
    with veto.tenant_scope(tenant_id):
        decision = await veto.validate({
            "tool": "query_database",
            "arguments": request.args,
        })

# Per-tenant policies
veto.register_tenant_policy(
    tenant_id="tenant_123",
    policy=Policy(
        tool="query_database",
        rules=[
            Policy.allow_if(table_prefix="tenant_123_"),
            Policy.deny_if(table_prefix="tenant_"),
        ]
    )
)

Best Practices

  • Always validate tenant context before tool execution
  • Use tenant-scoped policies
  • Log tenant ID with every decision
  • Rate limit per tenant, not globally

Ready to secure your agents?