Mandantenisolierte KI-Agenten
Hält KI-Gespräche, Retrieval, Werkzeugaktionen und Verbrauchsbudgets während des gesamten Laufs in geprüften Arbeitsbereichsgrenzen.
tenant-aware-ai-agents
Entdecke, wie der Skill hilftWann ist der Skill hilfreich?
Nutze ihn bei geteilter Agenteninfrastruktur mit möglichen mandantenübergreifenden Speicher-, Cache- oder Werkzeugpfaden.
Wobei hilft er dir?
- Filtert Retrieval vor Ähnlichkeitssuche nach geprüftem Arbeitsbereich.
- Begrenzt Gespräche, Gedächtnis, Checkpoints und Prompt-Caches.
- Bindet Werkzeugrechte serverseitig und erzwingt Mandantenbudgets.
Das könntest du fragen
Prüfe, dass zwei Arbeitsbereiche keine Dokumente oder Agenten-Caches teilen. Stelle dieselbe Frage in zwei Arbeitsbereichen mit unterschiedlichen vertraulichen Dokumenten. Retrieval, Cache-Antworten und Werkzeuge bleiben im anfragenden Bereich.
Ausführliche Dokumentation
Hier findest du die ursprüngliche Anleitung, Beispiele und Prüfschritte des Skills in ihrer Originalsprache.
Weniger anzeigen
Tenant-Aware AI Agents
When to Use
Use when designing, building, or reviewing LLM integrations, AI agents, RAG / vector search pipelines, conversation memory, or tool-calling execution in a multi-tenant SaaS application.
Why AI Agents Are High-Risk Cross-Tenant Vectors
An AI agent combines untrusted text inputs, semantic retrieval (where embeddings have no built-in access control), external tool execution, and long-running background state. A single unscoped vector query or tool handler allows prompt injection or semantic similarity to pull Tenant B's confidential data into Tenant A's response.
Five Mandatory AI Tenant Isolation Controls
1. RAG & Vector Database Isolation (pgvector, Qdrant, Pinecone, Milvus)
- Pre-Filter Before Similarity Search:
- Every vector chunk stored must include
tenant_id(and workspace-internal ACL metadata where applicable). - Wrap the vector query client so
tenant_id = ctx.tenantIdis injected automatically from the verified serverTenantContextas a hard pre-filter (or dedicated per-tenant namespace/collection)—never let the LLM or user prompt supply or overridetenantIdin a search tool call!
- Every vector chunk stored must include
- Ingestion & Re-Indexing Hygiene:
- When a document is moved, permission-restricted, or deleted in a workspace, immediately update or purge its vector chunks so stale embeddings cannot be retrieved.
2. Conversation Memory, Checkpoints & Prompt Caches
- Scope all conversation threads, agent checkpoints, long-term memory facts, and semantic response caches strictly by
(tenant_id, thread_id). - When using provider prompt caching, ensure system/workspace context prefixes never mix data from different tenants in a shared cache key.
3. Tool Calling & MCP / CLI Execution Guardrails (Zero Trust for LLM Arguments)
- Never Accept
tenantIdfrom LLM Tool Arguments:- When an LLM invokes a tool (
get_customer_invoice({ invoiceId }),search_projects({ query }),run_sql), bindtenantIdandactorIdfrom the server-sideTenantContextinside the tool executor—never exposetenant_idas a parameter the model can choose or hallucinate!
- When an LLM invokes a tool (
- Dual Authorization on Tool Calls:
- A tool call acting on behalf of a user in a workspace must enforce both the workspace's tenant boundary and the invoking user's role/permission within that workspace (e.g., a
viewercannot use an AI agent to trigger a write/delete tool that theviewercould not call via the REST API).
- A tool call acting on behalf of a user in a workspace must enforce both the workspace's tenant boundary and the invoking user's role/permission within that workspace (e.g., a
- Isolated Workspace Sandboxes:
- If agents execute CLI commands or read/write files, scope their working directory and credentials strictly to the target workspace's sandbox and tenant-owned integration tokens.
4. Per-Tenant Token Quotas, Rate Limits & Kill Switches
- Track LLM input/output tokens, tool calls, and dollar cost per
tenant_id. - Enforce per-workspace concurrency limits and budget ceilings so a runaway agent loop in one workspace cannot exhaust the platform's global LLM provider quota.
Enthaltene Dateien 1
SKILL.md
