Accelerating Development with Antigravity CLI

1. Overview

This lab focuses on utilizing Antigravity CLI for common developer tasks. The Antigravity CLI is the lightweight Terminal User Interface surface of Antigravity. You will learn to use Antigravity CLI for various tasks, including understanding existing codebases, generating documentation and unit tests, refactoring both UI and backend components of a Python web application.

What you will learn

In this lab, you will learn how to do the following:

  • How to use Antigravity CLI for common developer tasks.

Prerequisites

  • This lab assumes familiarity with the Cloud Console and Cloud Shell environments.

2. Setup and Requirements

Cloud Project setup

  1. Sign-in to the Google Cloud Console and create a new project or reuse an existing one. If you don't already have a Gmail or Google Workspace account, you must create one.

295004821bab6a87.png

37d264871000675d.png

96d86d3d5655cdbe.png

  • The Project name is the display name for this project's participants. It is a character string not used by Google APIs. You can always update it.
  • The Project ID is unique across all Google Cloud projects and is immutable (cannot be changed after it has been set). The Cloud Console auto-generates a unique string; usually you don't care what it is. In most codelabs, you'll need to reference your Project ID (typically identified as PROJECT_ID). If you don't like the generated ID, you might generate another random one. Alternatively, you can try your own, and see if it's available. It can't be changed after this step and remains for the duration of the project.
  • For your information, there is a third value, a Project Number, which some APIs use. Learn more about all three of these values in the documentation.
  1. Next, you'll need to enable billing in the Cloud Console to use Cloud resources/APIs. Running through this codelab won't cost much, if anything at all. To shut down resources to avoid incurring billing beyond this tutorial, you can delete the resources you created or delete the project. New Google Cloud users are eligible for the $300 USD Free Trial program.

Environment Setup

Open Gemini chat.

329221919d8f7d77.png

Click "Get Gemini Cloud Assist at no cost":

5745297aab6bb520.png

Enable "Gemini Cloud Assist" on the next screen.

7596a92d6339fe40.png

Click "Start chatting" and follow one of the sample questions or type your own prompt to try it out.

b3260163759bdec5.png

Prompts to try:

  • Explain Cloud Run in 5 key points.
  • You are Google Cloud Run Product Manager, explain Cloud Run to a student in 5 short key points.
  • You are Google Cloud Run Product Manager, explain Cloud Run to a Certified Kubernetes Developer in 5 short key points.
  • You are Google Cloud Run Product Manager, explain when you would use Cloud Run versus GKE to a Senior Developer in 5 short key points.

Close the Gemini Cloud Assist chat window after you are done.

Check out Prompt Guide to learn more about writing better prompts.

How Gemini for Google Cloud uses your data

Google's privacy commitment

Google was one of the first in the industry to publish an AI/ML privacy commitment, which outlines our belief that customers should have the highest level of security and control over their data that's stored in the cloud. That commitment extends to Google Cloud generative AI products. Google helps ensure that its teams are following these commitments through robust data governance practices, which include reviews of the data that Google Cloud uses in the development of its products. You can find more details about how Google processes data in Customer Data Processing Addendum (CDPA) or the data processing agreement applicable to your Google Cloud service.

Data you submit and receive

The questions that you ask Gemini, including any input information or code that you submit to Gemini to analyze or complete, are called prompts. The answers or code completions that you receive from Gemini are called responses.

Gemini doesn't use your prompts or its responses as data to train its models. Some features are only available through the Gemini for Google Cloud Trusted Tester Program, which lets you optionally share data, but the data is used for product improvements, not for training Gemini models.

Because Gemini is an evolving technology, it can generate output that's plausible-sounding but factually incorrect. We recommend that you validate all output from Gemini before you use it. For more information, see Gemini for Google Cloud and responsible AI.

Encryption of prompts

When you submit prompts to Gemini, your data is encrypted in-transit as input to the underlying model in Gemini. For more information on Gemini data encryption, see Default encryption at rest and Encryption in transit.

Program data generated from Gemini

Gemini is trained on first-party Google Cloud code as well as selected third-party code. You're responsible for the security, testing, and effectiveness of your code, including any code completion, generation, or analysis that Gemini offers you.

Gemini also provides source citations when suggestions directly quote at length from a source to help you comply with any license requirements.

Because responses in Gemini are generated from a model that's trained on many lines of code, you should exercise the same care with Gemini-provided code that you would with any other code. Make sure that you test the code properly and check for security vulnerabilities, incompatibilities, and other potential issues.

Learn more how Google handles your prompts.

3. Options to test prompts

If you would like to test existing prompts, you have several options for that.

Agent Studio is a part of Gemini Enterprise Agent Platform, specifically designed to simplify and accelerate the development and use of generative AI models.

Google AI Studio is a web-based tool for prototyping and experimenting with prompt engineering and the Gemini API.

The Google Gemini web app (gemini.google.com) is a web-based tool designed to help you explore and utilize the power of Google's Gemini AI models.

4. Download and examine the application

Activate Cloud Shell by clicking on the icon to the right of the search bar.

ad59ad4bc06e63a6.png

Click "Continue":

fe34f8b6f9be3592.png

If prompted to authorize, click "Authorize" to continue.

bbc9a899d729e173.png

In the terminal, run the command to enable Agent Platform APIs.

gcloud services enable aiplatform.googleapis.com

Run the commands below to clone the Git repository locally.

git clone https://github.com/gitrey/calendar-app-lab
cd calendar-app-lab

Click "Cloud Shell Editor".

c945bbd9676b1c89.png

Open the "calendar-app-lab" folder.

2cb23c3ffff700cc.png

Start a new terminal in the Cloud Shell Editor.

8191a83f654ecd8b.png

Your environment should look similar to the screenshot below.

74f4166e5de92eee.png

5. Antigravity CLI Introduction

The Antigravity CLI is the lightweight Terminal User Interface surface of Antigravity. It brings the same core agentic capabilities as Antigravity, such as multi-step reasoning, multi-file editing, tool calling, and conversation history, directly to your terminal. It allows developers to perform various tasks directly from their terminal, such as understanding codebases, generating documentation and unit tests, and refactoring code.

The key benefit of Antigravity CLI is its ability to streamline development workflows by bringing the power of Gemini directly into the developer's command-line environment, reducing context switching and accelerating productivity.

Run the following command in the terminal to install Antigravity CLI:

curl -fsSL https://antigravity.google/cli/install.sh | bash

Verify the output and run provided command to enable global use of the ‘agy' CLI.

Example:

echo 'export PATH="/home/student_01_7c9be0de109d/.local/bin:$PATH"' >> ~/.bashrc && source ~/.bashrc

Check that you are in the root of the project folder:

cd ~/calendar-app-lab

Start Antigravity CLI:

agy

To sign in, select "Use a Google Cloud project" option:

168503134b579a5c.png

Click "Click here to authenticate" or select the complete url, copy it and open it in a new browser tab, follow the steps to generate the code. Return to the terminal to paste the code and set the Google Cloud project.

50a8a15555800fff.png

Set Google Cloud Location to "global".

Set your favorite color scheme and click "Next" to continue.

39c796d36ad65bab.png

Accept Terms of Service & Data Use:

2135d339377bfa25.png

Your environment should look similar to the screenshot below. The Gemini Code Assist panel has been dismissed, as it will not be required for this lab.

e1932cacebc491ad.png

To verify your setup, run following command:

/config

Select or type "Color Scheme", confirm your new selection.

6dd131e569767d6b.png

Run following command to verify available models:

/model

6. Codebase understanding

You can use the Antigravity CLI to quickly learn a new codebase by asking it to summarize the purpose of files or directories and explain complex functions or sections of code. This allows developers to rapidly onboard to new projects or grasp unfamiliar parts of existing code without deep manual exploration.

To learn more about the codebase, send the following prompt in the Antigravity CLI:

Explain this codebase to me, including its overall architecture, key dependencies, and the main entry points for the application.

Review the output:

80ace0edf6940819.png

7. Start the application

The Antigravity CLI can significantly simplify running your Python application locally by helping you auto-generate essential configuration files like requirements.txt or a basic Dockerfile. Moreover, it's excellent for managing Python dependencies and troubleshooting, as it can quickly explain traceback errors resulting from missing packages or version conflicts, and often suggest the precise pip install command to fix the issue.

To launch the application locally, enter the following prompt in the Antigravity CLI terminal:

Setup a local virtual environment and run this app locally.

Confirm tool calls, when application is running click on the link to open the preview:

2b3f62e76a982e01.png

Sample output:

eb48f69326cd6e6a.png

Type 25 and hit Enter.

2caebf7a3c9d0e42.png

8. Adding documentation

The Antigravity CLI streamlines documentation and commenting by enabling the instant generation of docstrings for your classes and functions. It also allows you to quickly insert explanatory inline comments into complex or unfamiliar code segments, which substantially boosts the maintainability and clarity of your codebase.

Execute the following command within the Antigravity CLI to automatically insert documentation into every Python file in your project:

Add detailed docstrings to all files.

Update the .gitignore file with the following prompt:

Update .gitignore: add __pycache__ and .venv folders.

Switch to Source Control view and review changes that you made so far:

2604f475d2771271.png

The following prompt allows you to verify all modifications directly in your terminal:

/diff

9. Adding Unit Tests

The Antigravity CLI significantly helps in the creation of unit tests by allowing developers to produce test functions derived from the signature and logic of existing functions. While it provides comprehensive initial assertions and mock configurations, it remains crucial for developers to evaluate and confirm the output. This ensures that the resulting tests offer robust coverage for complex edge cases rather than merely confirming basic execution paths.

For this task we will use one of the commands that come with Antigravity cli /goal - Run until the specified goal is completely finished.

Using the prompt below, to generate unit tests:

/goal Generate unit tests for @calendar.py

Accept the tools invocation and review the output.

795a6cdf623d91d4.png

To ensure code validation and successful test results, the Antigravity CLI monitors, repairs, and executes the generated code repeatedly until all tests are passed. Navigate to the Source Code view to inspect the most recent updates.

10. Identifying Logic Defects

The Antigravity CLI helps identify logical errors by reviewing and analyzing your code snippets. It can detect various issues, such as incorrect conditional handling, potential logical flaws, and off-by-one errors. By explaining the intended behavior of your code to the CLI, you can uncover subtle defects and address discrepancies before the code is executed.

To evaluate the conversion logic in your project, use the following prompt in the Antigravity CLI:

Are there any bugs in the conversion logic? Check if negative numbers are handled properly.

Review the output.

dee5f9c40f495173.png

11. Refactor UI

The Antigravity CLI streamlines UI refactoring by facilitating the transition from legacy patterns, such as class components, to modern functional paradigms like React hooks. It also identifies structural enhancements to increase maintainability. By leveraging the CLI to analyze and decompose existing UI code into modular, reusable components, developers can achieve a more standardized and cleaner interface design.

Using existing /plan command to plan the refactoring of the UI using the Bootstrap library:

/plan Refactor UI to use Bootstrap library

c2aa2bd629e4e161.png

Review implementation plan with /artifacts command:

8bb24b29fed097ea.png

ec6407c5b0679438.png

Start implementation by approving the plan.

61e2d6495c56477e.png

Review and accept the tools invocation:

da3efcdbad2641b1.png

Send a prompt to start the application.

Start the application

Reload the page and check the changes.

18476ae2456f8ceb.png

d5543f70d9b9c93d.png

Send a prompt to implement error handling to ensure an error page is displayed when issues arise.

Implement error handling to display an error page when issues occur.

Sample output:

514d6c1612d73cb8.png

Refresh the page to view the updates.

Open an endpoint (eg. /convert1 ) to verify the error page.

7ef057fa830d9573.png

12. Refactor Backend

The Antigravity CLI streamlines backend refactoring by facilitating the transition from outdated frameworks to modern stacks and helping in the decomposition of monoliths into microservices. By evaluating server-side logic, it recommends optimized database queries and superior API designs to uphold or boost system performance and scalability.

Modify the backend to save conversion requests in memory.

/goal Store requests in memory and create a page to display conversion history. Add links on all pages to view the history.

At any point you can view current context usage by sending /context command:

e2225cc6b39a0b17.png

Review and accept the changes in the chat:

f3473cef041944a.png

Review the output of implementation request:

887cc6714369867c.png

Submit several requests to the application, then review the conversion history page.

8b77403154eae05e.png

Review conversion requests history.

627fd253280c952a.png

13. Subagents in Antigravity CLI

Antigravity CLI features an asynchronous subagents framework that allows the main agent to delegate parallel work, perform background research, and run system tests without blocking your active conversation.

Utilize the /agents command to display active agents, or /tasks to monitor background processes that are not agent-based.

If you need to initiate a side discussion or pose a question, the /btw command is available for that purpose.

You can also send a long running task to the background by pressing Ctrl+b.

14. Aligning on the plan

The Antigravity CLI comes with the /grill-me command that you can use for detailed interview style planning before diving into the implementation.

Run this command in the terminal:

/grill-me Refactor UI to use Bootstrap library

Sample output:

Question 1/1: How would you like to structure the user flow and design theme for this Roman Numeral converter?

> 1. (Recommended) Keep the multi-page template structure with the majestic, imperial glassmorphic dark theme.
  2. Convert the flow into a modern Single-Page Application (SPA) using AJAX/Fetch, rendering results dynamically on the same page.
  3. Adopt a standard minimalist Bootstrap light/dark theme with corporate colors (blue primary, clean white cards) instead of the
imperial-themed style.
  4. Write-in...
.
.
Question 1/1: Which visual theme and color palette would you prefer for the Roman Numerals Converter?

> 1. (Recommended) Sleek Dark Mode with Glassmorphism: Deep space/midnight background, glowing neon blue/purple
gradients, and semi-transparent frosted-glass cards.
  2. Roman Antique / Golden-Ivory theme: Warm cream/marble background, rich gold highlights, deep crimson/burgundy
accents, and elegant serif typography.
  3. Clean Modern Tech: Slate gray and vibrant emerald green accents, minimalist clean white cards, and smooth micro-
interactions.
  4. Write-in...
.
.
Question 1/1: Which interactive features would you like to incorporate to make this a premium user experience? (Select
all that apply)

> 1. [ ] (Recommended) Dynamic Live Validation: Instantly validate input (range 1-3999) as the user types with helper
messages.
  2. [ ] (Recommended) "Surprise Me" Button: Instantly generates a random integer and converts it to its Roman numeral
counterpart.
  3. [ ] (Recommended) Quick-Copy Clipboard Button: A one-click button to copy the roman numeral result with a
toast/notification checkmark.
  4. [ ] (Recommended) Interactive Reference Table: A beautiful Cheat Sheet showing standard Roman numeral symbols (I, V,
X, etc.) with responsive hover effects.
  5. [ ] Keep it extremely minimal with only the conversion card.
  6. Write-in.

15. Update documentation

To update the README.md file with the current codebase state, send this prompt via Antigravity CLI:

/goal Analyze README.md file and update it with latest codebase changes.

Review the output in the console and also open README.md in Markdown preview mode for verification.

d960e8579e545dd4.png

16. Antigravity CLI Non-interactive Mode

When running Antigravity CLI in a non-interactive mode in a local environment or within a CI/CD pipeline, you can automate various tasks by passing prompts and commands directly to the CLI without requiring manual intervention. This allows for seamless integration into automated workflows for code analysis, documentation generation, and other development tasks.

Open a new terminal or close the existing Antigravity CLI session and run this command.

agy -p "Explain the architecture of this codebase"

Review the output.

By leveraging Antigravity CLI in non-interactive mode, you can significantly enhance the automation capabilities of your CI/CD pipelines, leading to more efficient development cycles and improved code quality.

17. Antigravity CLI Bash Mode

While Gemini handles complex tasks, direct commands are more efficient for straightforward actions. The ! prefix allows seamless switching between chat and traditional command-line interfaces. Type ! first followed by the git status command.

! git status

Review the output.

18. Antigravity CLI MCP support

Antigravity CLI, through the Model Context Protocol (MCP), can integrate with third-party systems like Jira, Confluence or GitHub. This is achieved via MCP server custom tool integrations, allowing Antigravity CLI to create or update JIRA tickets, fetch information from Confluence pages, create pull requests, etc.

Global and workspace server configs:

  • Global server setups: Configured in ~/.gemini/antigravity-cli/mcp_config.json.
  • Workspace local setups: Configured in your active project under .agents/mcp_config.json.

Run this command in the new terminal to create the configuration file or use shell mode.

echo '{
    "mcpServers": {
        "context7": {
            "serverURL": "https://mcp.context7.com/mcp"
        }
    }
}' > ~/.gemini/antigravity-cli/mcp_config.json

Start Antigravity CLI session:

agy

Verify configured MCP servers:

/mcp

Review the output:

6eb0f49e08d12574.png

Send the prompt to test configured MCP server:

Use context7 tools to look up how to implement flex grid in react mui library 

Approve the tools and review the output.

6bae4918cefd82f0.png

19. Example MCP servers configuration for your local environment

You can configure multiple MCP servers in your local environment using the following config.

{
    "mcpServers": {
        "Snyk Security Scanner": {
            "command": "snyk",
            "args": [
                "mcp",
                "-t",
                "stdio",
                "--experimental"
            ],
            "env": {}
        },
        "atlassian": {
            "command": "npx",
            "args": [
                "-y",
                "mcp-remote",
                "https://mcp.atlassian.com/v1/sse"
            ]
        },
        "playwright": {
            "command": "npx",
            "args": [
                "@playwright/mcp@latest"
            ]
        },
        "github": {
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-github"
            ],
            "env": {
                "GITHUB_PERSONAL_ACCESS_TOKEN": "******"
            }
        }
    }
}

The MCP servers in this configuration transform your Antigravity CLI agent into a dynamic development and collaboration tool by providing standardized access to external systems.

Specifically, the Snyk Security Scanner server allows the agent to check code and dependencies for vulnerabilities without leaving your current workspace, while the Atlassian server connects to Jira and Confluence, enabling the Antigravity CLI to create, search, and update issues or documentation using natural language.

The Playwright server grants the agent browser automation capabilities, allowing it to navigate and interact with the web for tasks like testing or data extraction. Finally, the Github server gives the agent direct, contextual access to your repositories, allowing it to manage PRs, triage issues, and analyze the codebase, significantly reducing context switching and boosting productivity across your entire development workflow.

20. The extensibility model

Antigravity CLI is designed for limitless customization. You can augment the shared agent harness by installing structured package modules called Plugins or creating localized markdown blueprints called Skills.

These customizations allow agents to access specialized proprietary commands, invoke domain-specific subagents, and consult customized style constraints.

Antigravity plugins

Plugins are namespaced bundles that package custom skills, background subagents, linting rules, Model Context Protocol definitions, and event hooks into a single deployable asset.

Agent skills

Skills are declarative, human-readable markdown files that outline explicit instruction protocols, scripts, and target resources for specialized engineering tasks.

Once registered, Skills convert automatically into slash commands inside the TUI, allowing you to invoke them manually (e.g., typing /refactor-ui).

Managing hooks

Hooks intercept agent actions right before or immediately after execution. They are useful for running automated pre-flight checks or post-generation formats (such as running prettier after writing files).

Hooks are defined inside a plugin's hooks.json or configured inside your primary settings.json file. You can inspect all loaded and active hooks inside the Antigravity CLI by typing: /hooks.

21. Conclusion

Ultimately, Antigravity CLI proves to be an adaptable and robust AI agent that works in tandem with Gemini models to accelerate developer productivity. This lab demonstrated its effectiveness in optimizing routine engineering workflows, such as learning new codebases, producing necessary documentation, and creating unit tests. We saw how it facilitates the refactoring of both client-side and server-side elements within a Python-based web app. By adopting Antigravity CLI, engineers can minimize context switching, automate manual tasks, and produce higher quality code more rapidly. Integrating Gemini intelligence directly into the terminal environment in this way fundamentally transforms modern development practices.

22. Congratulations!

Congratulations, you finished the codelab!

What we've covered:

  • Using Antigravity CLI for common developer tasks

What's next:

  • More hands-on sessions are coming!

Clean up

To avoid incurring charges to your Google Cloud account for the resources used in this tutorial, either delete the project that contains the resources, or keep the project and delete the individual resources.

Deleting the project

The easiest way to eliminate billing is to delete the project that you created for the tutorial.

©2025 Google LLC All rights reserved. Google and the Google logo are trademarks of Google LLC. All other company and product names may be trademarks of the respective companies with which they are associated.