# Remote GPU Integration Plan ## Overview Embed RemoteGPUExecutor into the quine system so compiled agents can rent and use remote GPUs autonomously. ## Changes Required ### 1. Dependencies (requirements.txt) **Add:** - `paramiko>=3.0.0 # SSH for remote GPU execution` **Location:** `_write_requirements()` function in agent_compiler.py ### 2. Embed RemoteGPUExecutor Class **Where:** After FelixBag class, before CapsuleAgent class (around line 8260) **What:** Copy entire RemoteGPUExecutor class from remote_gpu.py into the quine template ### 3. FelixBag Artifacts **Add new embedded docs:** - `remote_gpu_guide` - Documentation on using remote GPUs - Update `vast_gpu_rental_guide` - Add RemoteGPUExecutor usage examples **Location:** `_populate_bag()` function (around line 7795) ### 4. MCP Tool Definitions (Non-Proxy Mode) **Add vast.ai tools to normal MCP server:** - `vast_search` - Search for GPUs - `vast_rent` - Rent a GPU - `vast_connect` - Connect to rented GPU **Location:** After line 21106 where MCP tools are defined ### 5. Plug Command Integration **Modify plug command to:** - Detect if `self._remote_gpu` exists and is connected - If yes, load model on remote GPU instead of locally - Return remote execution handle **Location:** `on_input_submitted()` function, plug command handler ### 6. Quine Self-Replication **Ensure:** - RemoteGPUExecutor class is in the quine source - All offspring carry the remote GPU capability - Quine hash updates to reflect new code **Location:** Automatic - happens when class is embedded ### 7. Testing Requirements **Must verify:** - Compiled agent can rent GPU via MCP - SSH keys auto-generate - Connection works without passwords - Models load on remote GPU - Inference executes remotely - Results return to local TUI ## Integration Points ### agent_compiler.py - Line ~5301: `_write_requirements()` - Add paramiko - Line ~6339: After FelixBag class - Embed RemoteGPUExecutor - Line ~7795: `_populate_bag()` - Add remote GPU docs - Line ~15689: `_handle_mcp_request()` - Already has vast_connect (DONE) - Line ~21106: MCP tool definitions - Add vast.ai tools - Line ~15770: plug command - Add remote GPU detection ### remote_gpu.py - Entire file gets embedded into quine template - File can be deleted after embedding (optional) ## Risks 1. **Quine size** - Adding RemoteGPUExecutor increases file size (~200 lines) 2. **Dependency bloat** - paramiko adds SSH dependencies 3. **Breaking changes** - Existing compiled agents won't have this 4. **SSH key management** - Must work across all platforms (Windows/Linux/Mac) ## Rollback Plan If integration fails: 1. Remove RemoteGPUExecutor from template 2. Remove paramiko from requirements 3. Revert to external remote_gpu.py import 4. Keep vast.ai MCP tools (they're useful standalone) ## Success Criteria - [ ] Compiled agent has RemoteGPUExecutor embedded - [ ] paramiko in requirements.txt - [ ] SSH keys auto-generate on first use - [ ] No password prompts ever - [ ] Can rent GPU via MCP - [ ] Can load model on remote GPU - [ ] Can run inference remotely - [ ] FelixBag has remote GPU docs - [ ] Quine replicates with remote GPU capability