colab-autopilot
Enables AI agents to autonomously manage Google Colab GPU sessions, submit and monitor training jobs, and debug/fix issues via an encrypted tunnel without requiring a browser tab.
README
colab-autopilot
Give Claude Code (or any MCP-compatible AI agent) autonomous access to your Google Colab GPU — no browser tab needed after setup.
Built for long-running RL training workflows where you want the agent to monitor, detect issues, stop, debug, fix, and restart training while you're away.
How It Works
┌─────────────────┐ cloudflared tunnel (E2E encrypted) ┌──────────────────┐
│ Your Machine │ ──────── HTTPS ─────────────────────────► │ Google Colab │
│ │ │ (GPU Runtime) │
│ Claude Code │ ◄── compact metrics summary ────────────── │ Flask API │
│ ↕ MCP Server │ ──── kill job / write fix ────────────────► │ Job Manager │
│ │ ◄── job status ─────────────────────────── │ Training Loop │
└─────────────────┘ └──────────────────┘
No browser tab needed after initial setup.
No Google Drive sync delays.
Sub-second round-trip communication.
Key Features
- No browser tab needed — Colab runs headless after you start the tunnel
- Token-safe — Training output never floods the agent's context. A
/training_summaryendpoint returns ~500 tokens with metrics digest + anomaly detection - Background jobs — Submit training via
/submit_job, monitor with/job_logs, kill with/kill_job - Autonomous debug loop — Agent can: detect NaN/reward collapse → stop run → read code → write fix → restart
- E2E encrypted — Fernet AES-128 encryption. Cloudflare only sees ciphertext
- 12 MCP tools — Status, training summary, raw logs, exec, python, submit/kill/monitor jobs, file read/write, upload/download, checkpoints
Setup
1. Install locally (one time)
pip install git+https://github.com/Emile-Andre/colab-autopilot.git
2. Add to Claude Code config
Edit ~/.claude/settings.json:
{
"mcpServers": {
"colab-autopilot": {
"command": "colab-autopilot",
"args": ["mcp-serve"]
}
}
}
3. Set up Colab (each new session)
Copy the 3 setup cells from notebooks/autopilot_setup.ipynb into the TOP of your Colab notebook, before any model code. Or just paste them manually:
Cell 1: Install deps
!pip install -q flask cryptography
!wget -q https://github.com/cloudflare/cloudflared/releases/latest/download/cloudflared-linux-amd64 -O /usr/local/bin/cloudflared 2>/dev/null
!chmod +x /usr/local/bin/cloudflared
Cell 2: Start server (see notebooks/colab_autopilot_server.py)
Cell 3: Open tunnel — prints the cc://... connection string
4. Connect (each new session)
colab-autopilot connect cc://TOKEN:KEY@host
5. Close the browser tab
Your Colab runtime keeps running. Claude Code now has full GPU access.
Configuration
Edit these variables in the Cell 2 server code to match your notebook:
TRAINING_LOG_PATH = "/content/drive/MyDrive/world_model/training_logs.jsonl"
CHECKPOINT_DIR = "/content/drive/MyDrive/world_model/weights"
WORK_DIR = "/content"
Token Budget
The system is designed to keep agent context usage minimal:
| Operation | ~Tokens |
|---|---|
colab_training_summary |
300-500 |
colab_job_logs(n_lines=20) |
200-400 |
colab_status |
100-200 |
colab_exec (small output) |
200-500 |
| Full training stdout (raw) | 50,000+ ❌ |
The summary endpoint does the heavy lifting server-side: it reads your JSONL logs, computes rolling averages, samples the loss curve to 10 points, and runs anomaly detection — all before sending anything to the agent.
Compared to ColabWatcher4aiAgents
| Feature | ColabWatcher | colab-autopilot |
|---|---|---|
| Transport | Google Drive sync | Cloudflare tunnel (HTTPS) |
| Latency | 15-60+ seconds | Sub-second |
| Browser needed | No (Drive-based) | No (tunnel-based) |
| Real-time logs | No (file-based) | Yes (ring buffer) |
| Token management | No | Yes (summary endpoint) |
| Background jobs | Sequential queue | Parallel with kill/monitor |
| Anomaly detection | No | Yes (NaN, collapse, stagnation) |
| File editing | Via Drive | Direct API |
| Encryption | No | Fernet E2E |
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。