Terminal-First Cloud Compute

Google’s Colab CLI provides a command-line interface to interact with Google Colab runtimes, shifting the workflow from a browser-based notebook UI to a terminal-centric experience. This tool is designed for scripted, automated, and agent-driven tasks, allowing any terminal-accessible AI agent to manage cloud resources without manual intervention.

Core Workflow and Capabilities

The CLI simplifies the lifecycle of a remote compute session into a few standard commands:

  • Provisioning: Use colab new with specific flags like --gpu A100 or --tpu v6e1 to request hardware. CPU is the default.
  • Execution: The colab exec command reads local files and ships them to the remote runtime, eliminating the need for manual upload steps. It supports execution from stdin, .py files, or notebooks.
  • Artifact Retrieval: Users can pull results back using colab download or export session history as .ipynb, .md, .txt, or .jsonl files via colab log.
  • Agent Integration: The tool includes a COLAB_SKILL.md file, which provides agents with the necessary context to operate the CLI effectively. This enables complex, multi-step pipelines—such as fine-tuning models like google/gemma-3-1b-it—to be run entirely by an agent using a sequence of CLI commands.

CLI vs. Browser-Based Colab

While the browser-based UI remains useful for interactive exploration, the CLI is optimized for automation. Key differences include:

  • Accelerator Selection: Handled via flags (--gpu, --tpu) rather than a runtime menu.
  • Package Management: Uses colab install (leveraging uv or pip) instead of !pip inside notebook cells.
  • Workflow: Designed for headless execution and programmatic artifact retrieval, making it a better fit for CI/CD pipelines and autonomous agent tasks.