This week, Google AI team released the ** Colab CLI**. The tool connects your local terminal to remote Colab runtimes. It lets developers and AI agents run code on cloud GPUs and TPUs. You stay in your terminal the entire time. The CLI is open source under the Apache 2.0 license.
What is Google Colab CLI
The Colab CLI is a command-line interface for Google Colab. You can create sessions, run code, and manage files from the terminal.
Any agent with terminal access can call the tool. That includes Claude Code, Codex, and Google’s Antigravity. Google ships a prepackaged skill file named COLAB_SKILL.md
. It gives agents built-in context on how to use the CLI.
Installation uses a single uv tool install
command from the GitHub repository.
uv tool install git+https://github.com/googlecolab/google-colab-cli
A minimal session looks like this:
colab new # provision a CPU session
echo "print('hello')" | colab exec # run code
colab stop # release the VM
How the Commands Work
The CLI groups commands into sessions, execution, files, and automation. colab new
provisions a session, with CPU as the default. Add --gpu T4
, --gpu L4
, --gpu A100
, or --gpu H100
for a GPU. TPU options are v5e1
and v6e1
.
colab exec
runs Python from stdin, a .py
file, or a notebook. The exec
reads files locally and ships their contents. Local edits therefore need no separate upload step. colab stop
terminates the session and releases the VM.
Other commands cover files and authentication. colab upload
and colab download
move files between local and remote. colab drivemount
mounts Google Drive, defaulting to /content/drive
. colab auth
authenticates the VM for Google Cloud services.
colab exec
and Artifact Recovery: The Core Loop
colab exec
and Artifact Recovery: The Core LoopThe core loop is short. You provision a runtime, run a script, then pull results back. colab download
retrieves models, datasets, and other files. colab log
exports session history as .ipynb
, .md
, .txt
, or .jsonl
.
So a remote run becomes a replayable notebook on your disk. colab repl
and colab console
give interactive access to the VM. colab install
adds packages with uv
, falling back to pip
. Session metadata is stored at ~/.config/colab-cli/sessions.json
.
Example: Fine-Tuning Gemma 3 1B
Google’s official release demonstrates an agent-driven fine-tuning job. The task fine-tunes google/gemma-3-1b-it
using QLoRA. It trains on a Text-to-SQL dataset to improve SQL generation. The Antigravity agent runs the full pipeline with five commands.
colab new --gpu T4
colab install transformers datasets peft trl bitsandbytes accelerate
colab exec -f finetune_run.py
colab log --output gemma_finetune_log.ipynb
colab stop
The agent then downloads the adapter model, adapter config, tokenizer config, and tokenizer. You can load and serve the fine-tuned model locally. No manual cloud provisioning command was typed by the user.
Use Cases
- Offload laptop-bound training to a remote GPU or TPU without leaving the terminal.
- Let agents like Claude Code, Codex, or Antigravity run end-to-end ML pipelines.
- Fine-tune small models, such as Gemma 3 1B, with QLoRA remotely.
- Script notebook execution and export replayable
.ipynb
logs for reproducibility. - Debug interactively on the VM through
colab repl
orcolab console
.
Colab CLI vs Browser-Based Colab
The CLI does not replace the notebook UI. It targets scripted, automated, and agent-driven work instead. Here is how the two workflows compare across common tasks.
| Dimension | Browser-Based Colab | Colab CLI |
|---|---|---|
| Interface | Web notebook UI | Local terminal |
| Accelerator selection | Runtime menu in the browser | --gpu / --tpu flags on colab new |
| Agent use | Manual, UI-driven | Any terminal agent via commands |
| Run local scripts | Paste or upload into cells | colab exec -f script.py |
| Artifact retrieval | Manual download or Drive | colab download , colab log |
| Package install | !pip inside a cell |
colab install (uv, then pip) |
| Session control | Browser-managed runtime | colab new , colab stop , colab status |
| Agent skill file | None | Bundled COLAB_SKILL.md |
Strengths and Considerations
Strengths:
- Terminal-native workflow fits scripts, CI, and agent loops.
- One command provisions T4, L4, A100, or H100 GPUs.
exec
ships local file contents, so no upload step is needed.- Logs export to replayable notebook formats for reproducibility.
- Open source under Apache 2.0, with a bundled agent skill file.
- Works with multiple agents, not a single vendor’s tool.
Considerations:
- Access requires authentication; the default strategy is
oauth2
. repl
andconsole
need a TTY when run interactively.- Pipe stdin to use those two commands inside scripts.
- Compute still runs on Colab’s backend and its runtime model.
Key Takeaways
- Google’s Colab CLI runs code on remote Colab GPUs and TPUs from your local terminal.
- One command provisions accelerators:
colab new --gpu T4
throughA100
andH100
, plus TPUs. colab exec
ships local.py
and.ipynb
files to the runtime without an upload step.- Any terminal agent — Claude Code, Codex, Antigravity — can drive it via a bundled
COLAB_SKILL.md
. - It is open source under Apache 2.0, and
colab log
exports replayable notebook logs.
Marktechpost Visual Explainer
Marktechpost — practitioner AI & ML coverage, no hype. Source: Marktechpost.com
Check out the ** Technical details** and
Also, feel free to follow us on
GitHub Repo here.and don’t forget to join ourTwitter
and Subscribe to
150k+ ML SubReddit. Wait! are you on telegram?
now you can join us on telegram as well.Need to partner with us for promoting your GitHub Repo OR Hugging Face Page OR Product Release OR Webinar etc.? Connect with us