Google’s new Colab CLI lets developers and AI agents run Python on remote Colab GPUs and TPUs from the terminal

by ai-intensify
0 comments
Google's new Colab CLI lets developers and AI agents run Python on remote Colab GPUs and TPUs from the terminal

This week, the Google AI team released colab cli. The tool connects your local terminal to the remote Colab runtime. It lets developers and AI agents run code on cloud GPUs and TPUs. You are in your terminal the whole 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 from the terminal.

Any agent with terminal access can call the tool. This includes Cloud Code, Codex, and Google’s AntiGravity. Google ships a prepackaged skills file named COLAB_SKILL.md. This gives agents built-in context on how to use the CLI.

installation uses single uv tool install Command from 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 commands work

The CLI groups commands into sessions, execution, files, and automation. colab new Provisions a session with the CPU as default. Add --gpu T4, --gpu L4, --gpu A100Or --gpu H100 For a GPU. there are tpu options v5e1 And v6e1.

colab exec Runs Python from stdin, a .py file, or a notebook. exec Reads files locally and sends their contents. So local edits do not require a 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 By default, mounts Google Drive /content/drive. colab auth Certifies the VM for Google Cloud services.

colab exec and Artifact Recovery: The Core Loop

The core loop is small. You provision a runtime, run a script, then pull back the results. colab download Retrieves models, datasets, and other files. colab log Exports session history as .ipynb, .md, .txtOr .jsonl.

So a remote run becomes a rerunable notebook on your disk. colab repl And colab console Grant interactive access to the VM. colab install adds package with uvfall back pip. Session metadata is stored here ~/.config/colab-cli/sessions.json.

Example: Fine-Tuning Gemma 3 1B

Google’s official release showcases the fine-tuning work conducted by the agent. work is organized google/gemma-3-1b-it Using QLoRA. It trains on text-to-SQL datasets to improve SQL generation. The AntiGravity Agent runs the entire 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 configuration, tokenizer configuration, and tokenizer. You can load and serve fine-tuned models locally. No manual cloud provisioning commands were typed by the user.

use cases

  • Offload laptop-bound training to a remote GPU or TPU without leaving the terminal.
  • Let agents like Cloud Code, Codex, or AntiGravity run end-to-end ML pipelines.
  • Remotely fine-tune small models like the Gemma 3 1B with QLORA.
  • Script Notebook Execution and Export Rerunable .ipynb Log for reproducibility.
  • Debug interactively on VM colab repl Or colab console.

Colab CLI vs browser-based Colab

The CLI does not replace the Notebook UI. Instead it targets scripted, automated and agent-driven work. Here’s how both workflows compare in general terms.

Dimensions Browser-Based Collab colab cli
interface web notebook ui local terminal
accelerator selection runtime menu in browser --gpu / --tpu flags are up colab new
use of agent Manual, UI-driven Orders through any terminal agent
run local script Paste or upload into cells colab exec -f script.py
artifact recovery manual download or drive colab download, colab log
install package !pip inside a cell colab install (uv, then pip)
session control Browser-Managed Runtime colab new, colab stop, colab status
Agent Skills File nobody bundle COLAB_SKILL.md

strength and thoughts

Strength:

  • Fits into terminal-native workflow scripts, CI, and agent loops.
  • One command provisions a T4, L4, A100, or H100 GPU.
  • exec Sends local file content, so no upload step is required.
  • Export logs in playable notebook formats for reproduction.
  • Open source under Apache 2.0, with a bundled agent skills file.
  • Works with multiple agents, not any single vendor’s tools.

Idea:

  • Access requires authentication; the default strategy is oauth2.
  • repl And console Requires TTY when running interactively.
  • Pipe stdin to use those two commands inside the script.
  • 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.
  • An order provisioning accelerator: colab new --gpu T4 Through A100 And H100Plus TPU.
  • colab exec local ship .py And .ipynb Files at runtime without upload step.
  • Any terminal agent – ​​Cloud Code, Codex, AntiGravity – can run it through the bundle COLAB_SKILL.md.
  • It is open source under Apache 2.0, and colab log Exports playable notebook logs.

MarketTechPost Visual Explainer

Google Colab CLI – Terminal Guide
1 / 8

overview

Run Colab GPU and TPU from your terminal

Google Colab CLI connects your local terminal to the remote Colab runtime. Developers and AI agents run code on Cloud Accelerator without leaving the shell.

Announced on June 5, 2026 • Open source under Apache 2.0

step 1

What is this

  • A command-line interface for Google Colab.
  • This connects your local terminal to the remote Colab runtime.
  • You create sessions, run code, and manage files from the terminal.
  • Any terminal-based AI agent can also call it.

step 2

Install and get started quickly

Install with a single command, then run the 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 GPU and TPU

Request an accelerator when you create a 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 script remotely

The exec command reads your file locally and sends its contents. No separate upload steps required.

colab exec -f train.py

exec Runs Python from stdin, a .py file, or a notebook.

Step 5

Recover models and logs

Pull the results back to your machine after the run.

colab download -s NAME checkpoints/model.bin ./model.bin
colab log -o report.ipynb

Logs are exported 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

Designed for AI agents

  • Any agent with terminal access can call the CLI.
  • It works with Cloud Code, Codex and AntiGravity.
  • A bundle provides built-in references to COLAB_SKILL.md agents.
  • The result: scriptable, agent-ready Colab calculations.

MarkTechPost – Practitioner AI and ML coverage, no promotions.
Source: marktechpost.com


check it out technical details And GitHub repo here. Also, feel free to follow us Twitter And don’t forget to join us 150k+ ml subreddit and subscribe our newsletter. wait! Are you on Telegram? Now you can also connect with us on Telegram.

Do you need to partner with us to promote your GitHub repo or Hugging Face page or product release or webinar, etc? join us


Related Articles

Leave a Comment