Overview
Colab CLI is Google's official command-line interface for Google Colab. It provisions high-performance CPU, GPU and TPU runtimes, executes local code on them, manages remote files and orchestrates automated pipelines from a terminal — no notebook tab required. The stated design targets are developer productivity, headless automation and AI-agent integration, which is what makes it interesting beyond notebook users: a coding agent can request a real accelerator for one job and release it afterwards.
The command surface is small and predictable. `colab new` allocates a runtime, optionally with `--gpu` (T4, L4, G4, H100, A100), `--tpu` (v5e1, v6e1) or `--high-mem`. `colab exec` runs Python from stdin, a local `.py` file, or a `.ipynb` notebook; `colab repl` and `colab console` give an interactive Python REPL or a raw TTY shell; `colab ssh` opens a shell over WebSocket or acts as an OpenSSH `ProxyCommand` bridge for IDE remote development. `colab run` is the ephemeral job runner: fresh VM, run a local script with forwarded arguments, retrieve output files, tear the runtime down, in one command.
Around that sit the practical pieces — `upload`, `download`, `ls`, `rm` and `edit` for remote files, `drivemount` for Google Drive, `auth` for GCP credentials, and `install` which uses `uv` (falling back to pip) for dependencies. A background keep-alive daemon prevents idle termination without an open browser tab, and `colab log` exports session history to `.ipynb`, Markdown, plain text or JSONL. The project is Apache-2.0 and installs from PyPI as `google-colab-cli`; note that it supports Linux and macOS only — Windows is not supported.
What it does
- Provision CPU, GPU (T4, L4, G4, H100, A100) or TPU (v5e1, v6e1) runtimes in seconds, optionally high-RAM
- `colab run` is a one-shot job runner: fresh VM, run a local script with forwarded arguments, fetch outputs, tear down
- Execute local .py files, .ipynb notebooks or piped stdin remotely; interactive REPL and raw TTY console also available
- `colab ssh` over WebSocket, usable as an OpenSSH ProxyCommand bridge for IDE remote development
- Background keep-alive daemon stops idle VM termination without keeping a browser tab open
- Remote file operations, Google Drive mounting, GCP authentication and uv-based package installation
Getting started
Install the CLI, provision a session, run something on it, then stop it. When only one session is active you can omit -s.
Install
uv is the recommended installer; pip works too. Linux and macOS only.
# recommended
uv tool install google-colab-cli
# or
pip install google-colab-cliProvision, execute, clean up
The three-command loop for a CPU runtime.
colab new
echo "print('Hello from Google Colab!')" | colab exec
colab stopTrain on an A100 and pull the checkpoint back
Name the session, install dependencies on the VM with uv, run a local training script, download the weights, release the runtime.
colab new -s trainer --gpu A100
colab install -s trainer torch transformers
colab exec -s trainer -f train.py
colab download -s trainer checkpoints/model.bin ./model.bin
colab stop -s trainerRun a notebook against Drive and export a log
Outputs are written back into the notebook; colab log exports the session history as Markdown, .ipynb, .txt or .jsonl.
colab new -s analysis
colab drivemount -s analysis
colab exec -s analysis -f report.ipynb
colab log -s analysis -o execution_log.md
colab stop -s analysisUse it from a script or an agent
The interactive commands need a local TTY, so pipe stdin to trigger non-interactive mode inside automation.
echo "print(1)" | colab replCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Run a training or benchmarking script on a Colab A100 or H100 from your normal shell instead of a notebook
- Give a coding agent short-lived access to a real accelerator for one task, then release it automatically
- Attach an IDE to a Colab runtime for remote development over the SSH ProxyCommand bridge
- Script a repeatable pipeline — provision, install, execute, retrieve artefacts, tear down — in CI or a cron job
How Colab CLI compares
Colab CLI alongside other open-source gpu & compute clouds tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Ray | ★ 43.8k | A distributed computing framework that scales Python and ML workloads for training, tuning, data processing, and serving. |
| Prefect | ★ 23.8k | A Python-native workflow orchestration tool for scheduling, running, and monitoring data and ML pipelines. |
| Dagster | ★ 16.1k | A data and ML pipeline orchestrator with a declarative asset model, built-in lineage, and observability. |
| Kubeflow | ★ 15.9k | A Kubernetes toolkit that brings together pipelines, notebooks, and training operators for running ML workflows at scale. |
| Kedro | ★ 11k | Python framework for production-ready data engineering and data science pipelines, hosted by the LF AI & Data Foundation: a project template, a Data Catalog of connectors, and a dependency-resolving pipeline abstraction. |
| SkyPilot | ★ 10.6k | A framework that runs AI jobs across clouds and Kubernetes, automatically finding and provisioning the cheapest available GPUs. |
| Metaflow | ★ 10.3k | A Python framework from Netflix for building and running data science and ML workflows that scale from laptop to cloud. |
| Colab CLI | ★ 1.2k | Google's terminal client for Colab — provision a GPU or TPU runtime, run local scripts on it, move files back and forth, and tear it down, all without a browser tab |