googlecolab /google-colab-cli
A CLI for interacting with Google Colab runtimes
★ 2,192⑂ 308👁 22⑃ 134● 68▤ 0◈ 20
2,192
stars
+88
308
forks
22
watchers
134
prs
68
issues
0
releases
20
discussions
README
Colab CLI
A command-line interface for Google Colab. Provision high-performance CPU, GPU, and TPU runtimes, execute local code, manage remote files, and orchestrate automated cloud pipelines — directly from your terminal.
Designed to support seamless developer productivity, headless automation, and AI agent integrations.
Demo
[!NOTE]
Platform support: the Colab CLI currently supports Linux and macOS only. Windows is not supported at this time.
[!TIP]
Looking for in-notebook, interactive agent-assisted coding instead of a terminal workflow? See the Colab MCP Server.
---
Key Features
Instant VM Provisioning: Spin up CPU, GPU (T4, L4, G4, H100, A100), or TPU (v5e1, v6e1) runtimes in seconds.
Robust Code Execution: Run local Python scripts, Jupyter Notebooks (.ipynb), or piped stdin code; launch interactive REPLs or raw TTY console shells.
Ephemeral Job Runner (colab run): Provision a fresh VM, execute a local script with forwarded arguments, retrieve output files, and automatically tear down the runtime in a single command.
Activity-Based Liveness: Sessions stay alive as long as the kernel is active, with the Colab backend automatically maintaining liveness.
Seamless Workspace Automation: Mount Google Drive, authenticate Google Cloud Platform (GCP) credentials, and install dependencies with high-performance uv package management.
State & Log Archival: Inspect local session states or export interactive history logs to standard Jupyter Notebooks, Markdown, or structured JSONL.
---
Installation
Install the package using uv (recommended) or standard pip:
bash
Using uv (recommended)
uv tool install google-colab-cli
Using pip
pip install google-colab-cli
---
Quick Start
Run a CPU-based VM runtime, execute some code, and clean up:
bash
1. Provision a new session
colab new
2. Execute code from stdin
echo 'print("Hello from Google Colab!")' | colab exec
3. Stop and release the VM resource
colab stop
[!NOTE]
When only one session is active, you can omit the -s, --session option;
the CLI automatically knows it.
---
Command Index
Run colab --help to view specific options, defaults, and detailed help.
Session Management
| Command | Description |
| --- | --- |
| colab new [-s NAME] [--gpu GPU] [--tpu TPU] [--high-mem] | Allocate a new CPU, GPU, or TPU VM runtime (optionally high-RAM) |
| colab sessions | List all active sessions currently active on the backend |
| colab status [-s NAME] | Display hardware, machine shape, status, and local metadata for active sessions |
| colab restart-kernel [-s NAME] | Restart the active session's Jupyter kernel |
| colab stop [-s NAME] | Terminate a session VM and release its resources |
| colab url [-s NAME] [--open] | Print or open a browser URL connecting to the active session |
Execution
| Command | Description |
| --- | --- |
| colab run [--gpu GPU] [--tpu TPU] [--high-mem] [--keep] SCRIPT [ARGS...] | Run a local script on a fresh VM, forwarding arguments, then release iTop issues
#24colab url doesn't work as intended6 comments · 2026-05-24#47Improve runtime shape selection, resource reporting and allocation error handling in Colab CLI5 comments · 2026-06-06#100[Bug]: Windows compatibility crashes ('termios' ModuleNotFoundError & KernelClient AttributeError)4 comments · 2026-08-06#74Support `.ipynb` with `colab run`.4 comments · 2026-07-02#103drivemount fails with "Error propagating: 400" when the authenticated account is not authuser=03 comments · 2026-08-09#116[Bug]: Partial (granular) consent breaks login and then forces a browser re-login every hour on --auth=oauth22 comments · 2026-08-27#108Feature Request: Automatically open Drive authorization URL in system browser2 comments · 2026-08-12#90Colab cli termux2 comments · 2026-07-27
Discussions
#219G4 assignment disappears after ~23 minutes during active inference despite HTTP 200 keep-alive0 comments · 2026-11-07#208Add a `colab logout` command to sign out and switch accounts0 comments · 2026-11-03#180Native Windows support: incremental SSH fixes and a validation plan0 comments · 2026-10-20#168`ssh --proxy-mode` prints the update banner to stdout, breaking OpenSSH ProxyCommand1 comments · 2026-10-12#165`colab drivemount`: root cause of #113 ("Connection was lost" / mount failed after ~120 s) and a tested fix, plus native Windows console1 comments · 2026-10-07#161session lifetime unde tmux + ssh3 comments · 2026-10-01#141Bug: assign ReadTimeout can leave a live orphan assignment; reconcile before retrying1 comments · 2026-09-24#127`--auth` default is documented as `adc` but defaults to `oauth2` — and the ADC recommendation should stay0 comments · 2026-09-08
相关报道 (3)
News & coverage (6)
noteTrying out the Google Colab CLI from WSL2: Running Colab GPUs from the terminal alone2026-09-21Help Net SecurityGoogle Colab CLI opens runtimes to Claude Code and Codex2026-06-07marktechpostGoogle’s New Colab CLI Lets Developers and AI Agents Run Python on Remote Colab GPUs and TPUs From the Terminal2026-06-06infoq.comGoogle Launches Colab CLI for Developers, Automation, and AI Agents2026-06-12Developer Tech NewsGoogle Colab CLI fuses local terminals with cloud GPUs2026-06-08Google for Developers BlogIntroducing the Google Colab CLI2026-06-05