Architecture: Should Computer Use sandboxes be persistent per-user (keep-a...
Documentation for Sessions
๐๏ธ Architecture: Should Computer Use sandboxes be persistent per-user (keep-a...
Date: 2026-02-24
Time: 19:11:25 UTC
Session: gspace1-139.4
Agent: backend
Confidence: 94%
Status: โ
Documented
๐ Decision Context
Question:
Should Computer Use sandboxes be persistent per-user (keep-alive) vs disposable per-task? And should Vitto orchestrate Computer Use?
Task: Persistent sandbox architecture for Computer Use
๐ฏ Decision Made
Chosen:
Persistent per-user sandboxes with TTL-based lifecycle. Vitto orchestration deferred to S140 but architecturally planned.
Options Considered:
- Disposable per-task (current)
- Persistent per-user with 30min TTL
- Persistent per-user with 24h TTL
- Pre-warmed sandbox pool (complex)
๐ญ Reasoning
Two critical architectural decisions: (1) PERSISTENT SANDBOXES: Current model spins up a fresh E2B Firecracker VM per task (~2-3s boot + Chrome launch + login = 35s overhead). For repeat tasks on the same service (Gmail, GitHub), the user must re-authenticate every time. With persistent sandboxes: first task boots and authenticates normally, subsequent tasks reuse the same VM with browser sessions intact. E2B supports long-running sandboxes (up to 24h). Implementation: Map<userId, { sandbox, lastUsed, createdAt }>. TTL of 30 minutes of inactivity. Max 1 sandbox per user (cost control). On new task: check if user has an active sandbox โ reuse it. On timeout: destroy sandbox. Trade-offs: +52% faster repeat tasks, +Jarvis-like continuity, -Higher E2B cost (sandbox alive while idle), -Security risk (browser sessions persist). Mitigation: 30min TTL is aggressive enough. E2B free tier handles this. (2) VITTO ORCHESTRATION: Computer Use should be a Vitto tool, not a standalone system. When user says 'send email' in Chat, Vitto's agent loop should dispatch to Computer Use. Current architecture bypasses Vitto entirely โ frontend calls backend-ai-api directly. Fix: register Computer Use as a Vitto tool in tool-registry. The ChatโVittoโComputerUse flow gives us: memory (Vitto remembers what tasks ran), learning (outcome tracking), proactive suggestions ('you usually check email at 9am'). Deferred to S140 because Computer Use infrastructure needed to be solid first.
๐ Files Involved
apis/backend-ai-api/src/app/infrastructure/services/e2b-desktop.service.tsapis/backend-ai-api/src/app/infrastructure/services/computer-use-loop.service.ts
๐ Related
- Decision ID:
dev_1771960285177_uolzzq1 - Session: 139
- Workspace: gspace1
Auto-generated by MCP Smart Consolidation