While some of my recent posts have involved using the Colab extension for VS Code and the Antigravity IDE, I actually prefer working in the terminal and Vim. The new Colab CLI finally lets me work in my natural habitat, and it opens the door for autonomous workflows!
Setup
Currently, installation is handled via pip or uv. It's straightforward, though, I'm holding out hope for a brew formula in the future:
uv tool install google-colab-cli
I'm testing Version: 0.6.dev7+g510115b0c inside Ghostty. The Colab CLI is pretty solid, but I do have some feedback and nitpicks I'd like to share (but more on that later).
Creating a new session
Creating a session is simple: colab new [-s SESSION_NAME] [--gpu T4|L4|A100|H100] [--tpu v5e1|v6e1]:
-
SESSION_NAME: This is optional. If you leave it blank, the CLI generates a random unique ID for you. -
--gpuand--tpu: The hardware accelerator flags are optional, but omitting them defaults to a standard CPU-only instance. The specific accelerator chips you can request depend on your Colab tier, which you can check via colab pay.
NOTE: If you only have one active session, the CLI targets it by default. This makes the -s flag unnecessary for subsequent commands.
Testing Colab CLI's capabilities
CLI certainly sounds cool, but how does it handle artifacts and images? More importantly, how debuggable is it? I decided to find out by running a Fashion MNIST PyTorch example.
Handling artifacts
To get started, I installed my requirements using colab install torch torchvision matplotlib. If you prefer a more standard approach, you can also use colab install -r requirements.txt.
Once the environment was ready, I executed the training script using colab exec -f ./fashion_mnist_TRAIN.py and here's the output:
[colab] Using unique session '8c860c'.
Using CUDA device.
Shape of X [N, C, H, W]: torch.Size([64, 1, 28, 28])
Shape of y: torch.Size([64]) torch.int64
NeuralNetwork(
(flatten): Flatten(start_dim=1, end_dim=-1)
(linear_relu_stack): Sequential(
(0): Linear(in_features=784, out_features=512, bias=True)
(1): ReLU()
(2): Linear(in_features=512, out_features=512, bias=True)
(3): ReLU()
(4): Linear(in_features=512, out_features=10, bias=True)
)
)
Epoch 1
----------------------------------
loss: 2.299284 [ 64/60000]
loss: 2.296870 [ 6464/60000]
loss: 2.278877 [12864/60000]
loss: 2.274183 [19264/60000]
loss: 2.266371 [25664/60000]
loss: 2.233031 [32064/60000]
loss: 2.227577 [38464/60000]
loss: 2.201082 [44864/60000]
loss: 2.191893 [51264/60000]
loss: 2.167733 [57664/60000]
Test Error:
Accuracy: 52.6%, Avg loss: 2.163899
...
...
Epoch 25
----------------------------------
loss: 0.495004 [ 64/60000]
loss: 0.619403 [ 6464/60000]
loss: 0.404403 [12864/60000]
loss: 0.658543 [19264/60000]
loss: 0.587690 [25664/60000]
loss: 0.565604 [32064/60000]
loss: 0.592686 [38464/60000]
loss: 0.675307 [44864/60000]
loss: 0.645753 [51264/60000]
loss: 0.571738 [57664/60000]
Test Error:
Accuracy: 79.9%, Avg loss: 0.574529
Done!
Saved PyTorch Model State to 01_mnist_model.pth
When the training finished, the PyTorch model is saved in the Colab instance. To manage these files, you have two solid options:
-
Google Drive: Use
colab drivemount [PATH]to mount your Google Drive to save artifacts directly to a persistent cloud filesystem. -
Local Download: Use
colab download REMOTE_FILE LOCAL_FILEto pull the model back to your local machine.
Working with images
I was pleasantly surprised to find that images displayed just fine! Despite being a self-proclaimed shell aficionado, I had rarely worked with images in a terminal environment and didn't realize how seamless this could be.
When I ran the inference script with colab exec -f ./fashion_mnist_PREDICT.py, and the CLI automatically handled the visual output:
NOTE: Here are the links to the training script and inference script.
Debugging
Debugging Colab jobs is arguably easier than before because you can jump directly into a running instance using colab console:
Once you shell into the environment, you can inspect downloaded files, verify artifacts, or install additional dependencies on the fly.
If you need to keep a record of your work, you can export your logs and session history using colab log -o SESSION_HISTORY_FILE. This is particularly useful if you want to save your history directly into a mounted Google Drive filesystem for long-term storage or later review.
COLAB_SKILL.md
The resurgence of CLI tools is driven by their efficiency over traditional GUIs. While GUIs are designed for human intuition and rely on visual cues, these elements represent noise that an AI agent must filter out.
LLMs are already great with text and hence the input & output formats of a CLI are ideal for agents and machines to interpret. In fact, the most powerful way to leverage the Colab CLI is through autonomous agents! Colab CLI's repo provides a COLAB_SKILL.md file for you to get started for that agentic integration.
Issues & nitpicks
As previously mentioned, the Colab CLI is still being developed, so there's bound some issues here and there. Here are some that I've noticed and would love to see fixed:
- Session Timeouts: Relatively short timeouts and automatic pruning can disrupt productivity. While my personal impact has been minimal, this can be a significant hurdle for users with longer running tasks.
- Interface Disconnects: CLI sessions shows up as "Unknown notebook" in Colab Web and are invisible in the Antigravity IDE or VS Code extension. I've filed a GitHub Issue detailing this lack of cross-tool visibility.
- Hardware Parity: Colab Web and IDE extension now offers NVIDIA G4 (Blackwell) instances with 96GB of VRAM. To support high-performance AI workloads, the CLI should offer parity with these newer hardware tiers.
Summary
The Colab CLI is a significant step forward for developers who prefer the speed and focus of the terminal over a traditional browser-based UI or IDE. By bringing the power of Google's cloud hardware into a local, shell-based environment, it successfully bridges the gap between high-performance computing and a minimalist local workflow.
While the tool is clearly still in its early stages and has a few rough edges to smooth out, the core functionality is already impressive. The ability to manage remote instances, handle graphical output, and shell into a VM as easily as a local process makes it a formidable addition to any developer's toolkit.
Whether you are looking to automate your training pipelines or simply want to stay inside Vim while you scale your models, the Colab CLI offers a glimpse into a more efficient, autonomous future.



Top comments (0)