Google's New Colab CLI Allows Developers and AI Agents to Run Python on Remote Colab GPUs and TPUs from a Terminal

This week, the Google AI team released a Exchange CLI shares. The tool connects your local terminal to the remote Colab runtime. It allows developers and AI agents to run code on cloud GPUs and TPUs. You stay in your terminal all the time. The CLI is open source under the Apache 2.0 license.
What is Google Colab CLI
Colab CLI is a command line interface for Google Colab. You can create sessions, run code, and manage files in the terminal.
Any agent with terminal access can call the tool. That includes Claude Code, Codex, and Google's Antigravity. Google sends a precompiled skill file named COLAB_SKILL.md. It provides agents with a built-in context for how to use the CLI.
Installation uses one uv tool install command from the GitHub repository.
uv tool install git+
A mini session looks like this:
colab new # provision a CPU session
echo "print('hello')" | colab exec # run code
colab stop # release the VM
How Commands Work
The CLI groups commands into sessions, executions, files, and automation. colab new provides session, and CPU as default. Add --gpu T4, --gpu L4, --gpu A100or --gpu H100 of the GPU. TPU options are v5e1 again v6e1.
colab exec uses Python from stdin, a .py file, or notebook. I exec reads files locally and sends their contents. Local editing therefore does not require a separate loading step. colab stop terminates the session and exits the VM.
Other commands cover files and authentication. colab upload again colab download move files between local and remote. colab drivemount it installs Google Drive, by default /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 provide a runtime, run the script, and return the results. colab download finds models, datasets, and other files. colab log sends the session history as .ipynb, .md, .txtor .jsonl.
So the remote run becomes a notebook that is replayed on your disk. colab repl again colab console grant interactive access to the VM. colab install you add packages with uvgoing back pip. Time metadata is stored in ~/.config/colab-cli/sessions.json.
Example: Gemma for fine tuning 3 1B
Google's official release shows an agent-driven fine-tuning function. The task is simple google/gemma-3-1b-it using QLoRA. It is trained on Text-to-SQL datasets to improve SQL productivity. The Antigravity agent uses a pipeline full of 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 configuration, tokenizer configuration, and tokenizer. You can upload and render a fine-tuned model locally. There is no manual cloud provisioning command by the user.
Use Cases
- Upload training bound to a laptop 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 smaller models, such as the Gemma 3 1B, with QLoRA remote.
- Using script notebook and export playable as well
.ipynbtimber for regeneration. - Debug by interacting with the VM by using
colab replorcolab console.
Colab CLI vs Browser-Based Colab
The CLI does not replace the notebook UI. It directs scripted, automated, and agent-driven work instead. Here's how the two workflows compare across common tasks.
| Size | Browser Based Colab | Exchange CLI shares |
|---|---|---|
| Interface | Web notebook UI | Local terminal |
| Choosing an accelerator | A runtime menu in a browser | --gpu / --tpu the flags are open colab new |
| Use of agent | Manual, UI driven | Any terminal agent with commands |
| Run local scripts | Paste or load into cells | colab exec -f script.py |
| Finding the artifact | Manual download or Drive | colab download, colab log |
| Package installation | !pip inside the cell |
colab install (uv, then pipe) |
| Time management | Runtime managed by the browser | colab new, colab stop, colab status |
| Agent skill file | Nothing | Combined COLAB_SKILL.md |
Powers and Considerations
Power:
- Native terminal workflows are compatible with scripts, CI, and agent loops.
- Single command rendering for T4, L4, A100, or H100 GPUs.
execit sends the contents of local files, so no upload step is required.- Export logs to playable notebook formats for playback.
- Open source under Apache 2.0, with an integrated agent capability file.
- It works with multiple agents, not a single broker tool.
Assumptions:
- Access requires authentication; the default strategy is
oauth2. replagainconsoleneed a TTY if you run collaboratively.- Pipe stdin to run those two commands inside scripts.
- Compute still works 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 provides accelerators:
colab new --gpu T4by usingA100againH100and TPUs. colab execlocal ships.pyagain.ipynbfiles at runtime without the upload step.- Any killer agent – Claude Code, Codex, Antigravity – can drive it in bulk
COLAB_SKILL.md. - It's open source under Apache 2.0, too
colab logexports replayable logs.
Marktechpost Visual Explainer
Google Colab CLI – Terminal guide
1/8
Marktechpost – AI and ML expert, no hype.
Source: Marktechpost.com
Check it out Technical details again GitHub Repo here. Also, feel free to follow us Twitter and don't forget to join our 150k+ ML SubReddit and Subscribe to Our newspaper. Wait! are you on telegram? now you can join us on telegram too.
Need to work with us on developing your GitHub Repo OR Hug Face Page OR Product Release OR Webinar etc.? contact us



