Architecture: How should AI agent file outputs be stored for multi-tenant ...
Documentation for Sessions
🏗️ Architecture: How should AI agent file outputs be stored for multi-tenant ...
Date: 2026-01-31
Time: 15:57:37 UTC
Session: editor2-75.16
Agent: backend
Confidence: 100%
Status: ✅ Documented
📋 Decision Context
Question:
How should AI agent file outputs be stored for multi-tenant isolation?
Task: Session 75.15: Fix multi-tenant file storage for agent system
🎯 Decision Made
Chosen:
Route cloud file storage through backend-api using SpaceDatabaseService with GridFS, following database-per-space pattern
Options Considered:
- No alternatives documented
💭 Reasoning
The previous implementation stored files directly in the shared ai-agents database, violating the platform's database-per-space multi-tenant architecture. Files generated by VITTO/agents must be stored in the user's personal Space database (space_{slug}_{id}) to ensure proper data isolation. backend-ai-api should NEVER directly access user Space databases - it must call backend-api via HTTP, which uses SpaceDatabaseService to resolve and access the correct user database. This follows the same pattern used for modules/universes.
📁 Files Involved
apis/backend-api/src/app/spaces/space-database.service.tsapis/backend-api/src/app/spaces/space-files.controller.tsapis/backend-ai-api/src/app/vitto/vitto-file-storage.service.tsapis/backend-ai-api/src/app/schemas/handoff.schema.tsMCP/mcp-gograb-ai/src/tools/handoff.ts
🔗 Related
- Decision ID:
dev_1769875053691_ty90oca - Session: 75
- Workspace: editor2
Auto-generated by MCP Smart Consolidation