Google’s New Colab CLI Lets Developers and AI Agents Run Python on Remote Colab GPUs and TPUs From the Terminal
Google released the Colab CLI, a command-line tool that connects your local terminal to remote Colab runtimes, enabling developers and AI agents to run code on cloud GPUs and TPUs. Open source under Apache 2.0, it supports session creation, code execution, file management, and agent integration with built-in context via COLAB_SKILL.md.
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.
Copy CodeCopiedUse a different Browser
uv tool install git+https://github.com/googlecolab/google-colab-cli
A minimal session looks like this:
Copy CodeCopiedUse a different Browser
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
The 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.
Copy CodeCopiedUse a different Browser
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 or colab 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.
DimensionBrowser-Based ColabColab CLI
InterfaceWeb notebook UILocal terminal
Accelerator selectionRuntime menu in the browser--gpu / --tpu flags on colab new
Agent useManual, UI-drivenAny terminal agent via commands
Run local scriptsPaste or upload into cellscolab exec -f script.py
Artifact retrievalManual download or Drivecolab download, colab log
Package install!pip inside a cellcolab install (uv, then pip)
Session controlBrowser-managed runtimecolab new, colab stop, colab status
Agent skill fileNoneBundled 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 and console 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 through A100 and H100, 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
Google Colab CLI — Terminal Guide 1 / 8
Overview
Run Colab GPUs and TPUs from your terminal
The Google Colab CLI connects your local terminal to remote Colab runtimes. Developers and AI agents run code on cloud accelerators without leaving the shell.
Announced June 5, 2026 • Open source under Apache 2.0
Step 1
What it is
A command-line interface for Google Colab.
It connects your local terminal to remote Colab runtimes.
You create sessions, run code, and manage files from the terminal.
Any terminal-based AI agent can call it too.
Step 2
Install and quick start
Install with a single command, then run a first session.
uv tool install git+https://github.com/googlecolab/google-colab-cli
colab new # provision a CPU session echo "print('hello')" | colab exec # run code colab stop # release the VM
Step 3
Provision GPUs and TPUs
Request an accelerator when you create the session. CPU is the default.
colab new --gpu T4 colab new --gpu A100 colab new --tpu v6e1
Accelerator availability depends on your active Colab plan.
Step 4
Run local scripts remotely
The exec command reads your file locally and ships its contents. No separate upload step is needed.
colab exec -f train.py
exec runs Python from stdin, a .py file, or a notebook.
Step 5
Retrieve models and logs
Pull results back to your machine after the run.
colab download -s NAME checkpoints/model.bin ./model.bin colab log -o report.ipynb
Logs export as .ipynb, .md, .txt, or .jsonl.
Step 6
Example: fine-tune Gemma 3 1B
Google’s blog shows an agent running a QLoRA pipeline on a Text-to-SQL dataset.
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
Step 7
Built for AI agents
Any agent with terminal access can call the CLI.
It works with Claude Code, Codex, and Antigravity.
A bundled COLAB_SKILL.md gives agents built-in context.
The result: scriptable, agent-ready Colab compute.
Marktechpost — practitioner AI & ML coverage, no hype. Source: Marktechpost.com
Check out the Technical details and GitHub Repo here. Also, feel free to follow us on Twitter and don’t forget to join our 150k+ ML SubReddit and Subscribe to our Newsletter. 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
The post Google’s New Colab CLI Lets Developers and AI Agents Run Python on Remote Colab GPUs and TPUs From the Terminal appeared first on MarkTechPost.