Building with Google Antigravity

1. Introduction

Google Antigravity (referred as Antigravity for the rest of the document) is an agentic IDE from Google. In Getting started with Antigravity codelab, you can learn the basics of Antigravity. In this codelab, we will use Antigravity to build real applications. We will move from simple web research to generating full-stack applications and enterprise-grade unit tests.

Prerequisites:

2. About the Use Cases

Since you have a basic understanding of Antigravity, let's dive into a few use cases to see it in action. Note that Antigravity is an Agent first platform. This means that in most cases, we are simply giving an instruction to the Agent and the Agent then goes off on its own, does its task, asks permissions if needed, produces the artifacts and then notifies us if the task is done. As a result of that, we cannot produce every single output of the Agent conversation in each of the following use cases. We will share the instructions and a few necessary screenshots of the expected results but your results might differ a bit.

The use cases that we will cover range from automating a few tasks with external sites, to generating and verifying unit test cases for a project, to a full web site development. Let's go.

3. News Highlights

This is a simple use case but it can be the basis via which you can use the web browser to visit web sites, extract information, do some actions and then return data to the user.

In this case, we are going to visit the Google News site and extract some information from there. But you can easily experiment with a site of your choice and see how it goes.

Ensure that you are in the Agent Manager and have selected the Playground, as shown below:

cffa12c98a68cb6c.png

Then give the following instruction:

8513d489eea0b014.png

This will kick off the Agent process and it will determine that it needs to launch the browser, etc. You should pay close attention to the Thinking process and see how the Agent goes about its work. If all goes well, it should launch the Antigravity browser and visit the site as shown below. The blue border around the site shows that the Agent is now controlling the browser and navigating the site to get the information.

9d594588f2ffe6bc.png

Once it's done with its work, you should also see the Artifacts getting generated, as shown below:

dc6cf4e7d8425df8.png

A sample execution by the Agent is shown below:

fb7397cd2cce0682.png

Notice that on the left, we have the Thought process, you can also scroll through the points and view the playback and other data.

Things to try out

  • Once you understand this, pick a website that is available and which you would like the Agent to go and get/summarize some data from. Consider some website that you know has Dashboards and charts and ask it to pick a few values.
  • Try the following prompt: Visit https://docs.cloud.google.com/release-notes and get me a summary of the release notes, categorized by product.

4. Generate a Dynamic Website with Python + Flask

Let's move now to generate a complete web application. The web application that we are going to create is a site which provides information on a 1-day technical event, which has talks across the day by multiple speakers.

Once again, ensure that you are in the Agent Manager and have selected the Playground.

Give the following prompt:

I would like to generate a website that is a 1-day technical conference informational site.

The website should have the following functionality:
        1. A home page that shows the current date, location, schedule and time table.
        2. The 1-day event is a list of 8 talks in total.
        3. Each talk has 1 or 2 max. speakers. 
        4. A talk has an ID, Title, Speakers, Category (1 or 2), Description and time of the talk.
        5. Each speaker has a First Name, Last Name and LinkedIn url.
        6. Allow for users to search by category, speaker, title.
        7. Give a lunch break of 60 minutes.
        8. Use dummy data for events and speakers, come up with a schedule, the event is about Google Cloud Technologies.
        9. Tech Stack: Python and Flask framework on server side. Front-end is basic HTML, CSS and JavaScript. 
        10. Test out the site on your own for all functionality and provide a detailed README on how to setup, run and make any further changes. 
11. Launch the web application for me to review. 

You can begin the conversation by giving the above prompt:

As the Agent goes about its task, it will proceed with creating the artifacts:

  • Task Artifact
  • Implementation Artifact
  • Walkthrough Artifact

The Task Artifact given below was the initial sequence of tasks that the Agent deciphered it should do based on the task given to it. A sample screenshot from the execution is shown below:

c95d82e1c040698f.png

You can then click on the Implementation Plan artifact. A sample screenshot is shown below:

632169a236bc62cc.png

And finally, you have the Walkthrough artifact. It contains all that the Agent did as shown below:

e3f6152d6f54d4f9.png

Notice that it has started the server and has provided me the URL, which I click and I have the application, a sample screenshot is shown below:

abf879f2ce53d055.png

If I switch to the Editor, notice in the screen that it contains the folder where the Python Flask application is generated. You will also notice that the Agent mode is tagged to the right and you can continue the conversation over there too.

b0fea8aa65c3a1c5.png

Now, let's say that we want to add some more talks to the event. We can stay in the Editor and in the Agent panel, give an instruction like Add two more talks to the schedule.

This will result in the Agent analyzing the requirement, updating the Task, Implementation Plan and then validating the updated functionality too. A sample conversation is shown below:

ba8455e6f68973e9.png

You can switch back to the Agent Manager if you'd like. This process should help you understand the process between shifting from Agent Manager to Editor, making changes accordingly and so on.

Things to try out

  • Add additional functionality that you would like to the application. Provide the details to the Agent and notice how it goes about its task by first modifying the task list, then implementation plan and so on.
  • Ask the Agent to generate a README or more documentation for the application.

5. Generate a simple productivity app

We are going to now generate a simple Pomodoro timer web application.

Ensure that you are in the Agent Manager and have selected the Playground. Give the following prompt:

Create a productivity app that features a Pomodoro timer. Give a calm and aesthetic look to the application.

Notice how it goes about creating the Task list, implementation plan and then goes about that. Keep paying attention to the flow, there might be situations in which it will prompt for your review. A sample run is shown below.

5be0a668e5a67d85.png

In this case, it should also launch the Antigravity browser, do its own testing and then confirm that the tests succeeded. One of the things that it generated was a Media Artifact that contains the video of its verification. This is a great way to see what it tested. I also suggested some style changes since it didn't take effect and it was able to do that.

The final app looked like the one below and it looks quite good.

c9ab6bca97a51a8c.png

How about we can add a nice timer image to the application. All we need to do is issue a follow up instruction as given below:

Add an image to the application that displays a timer.

This resulted in the agent adding a new task to the Task artifact:

498dd946d4e9ae55.png

It then generated an image as it went through its task:

c291da9bdb37ff96.png

Finally, the app had the image as we requested:

de8f418ba8e4600d.png

Things to try out

  • Notice the background for the hourglass icon in the application is not transparent. Try telling the agent to make that transparent.
  • Try out a few variations of any application that you would like to generate. Play with the styles, images, ask for changes, etc.

6. Generate Unit Tests, Mock Stubs and Validate Tests

The final use case that we will try here is that of generating unit tests for a specific code file that we have and for the Agent to also execute the tests and validate them.

For this, we are going to have a workspace that has a single Python file as shown below:

from typing import Dict

# --- Custom Exceptions ---
class InventoryShortageError(Exception):
    """Raised when there is not enough item stock."""
    pass

class PaymentFailedError(Exception):
    """Raised when the payment gateway rejects the transaction."""
    pass

class InvalidOrderError(Exception):
    """Raised when the order violates business rules."""
    pass

# --- External Service Interfaces (To be Mocked) ---
class InventoryService:
    def get_stock(self, product_id: str) -> int:
        """Connects to DB to check stock."""
        raise NotImplementedError("Real connection required")

    def decrement_stock(self, product_id: str, quantity: int):
        """Connects to DB to reduce stock."""
        raise NotImplementedError("Real connection required")

class PaymentGateway:
    def charge(self, amount: float, currency: str) -> bool:
        """Connects to Stripe/PayPal."""
        raise NotImplementedError("Real connection required")

# --- Main Business Logic ---
class Order:
    def __init__(self, 
                 inventory_service: InventoryService, 
                 payment_gateway: PaymentGateway,
                 customer_email: str,
                 is_vip: bool = False):
        
        self.inventory = inventory_service
        self.payment = payment_gateway
        self.customer_email = customer_email
        self.is_vip = is_vip
        self.items: Dict[str, Dict] = {} # {product_id: {'price': float, 'qty': int}}
        self.is_paid = False
        self.status = "DRAFT"

    def add_item(self, product_id: str, price: float, quantity: int = 1):
        """Adds items to the cart. Rejects invalid prices or quantities."""
        if price < 0:
            raise ValueError("Price cannot be negative")
        if quantity <= 0:
            raise ValueError("Quantity must be greater than zero")

        if product_id in self.items:
            self.items[product_id]['qty'] += quantity
        else:
            self.items[product_id] = {'price': price, 'qty': quantity}

    def remove_item(self, product_id: str):
        """Removes an item entirely from the cart."""
        if product_id in self.items:
            del self.items[product_id]

    @property
    def total_price(self) -> float:
        """Calculates raw total before discounts."""
        return sum(item['price'] * item['qty'] for item in self.items.values())

    def apply_discount(self) -> float:
        """
        Applies business logic:
        1. VIPs get flat 20% off.
        2. Regulars get 10% off if total > 100.
        3. No discount otherwise.
        """
        total = self.total_price
        
        if self.is_vip:
            return round(total * 0.8, 2)
        elif total > 100:
            return round(total * 0.9, 2)
        
        return round(total, 2)

    def checkout(self):
        """
        Orchestrates the checkout process:
        1. Validates cart is not empty.
        2. Checks stock for all items.
        3. Calculates final price.
        4. Charges payment.
        5. Updates inventory.
        """
        if not self.items:
            raise InvalidOrderError("Cannot checkout an empty cart")

        # 1. Check Inventory Logic
        for product_id, data in self.items.items():
            available_stock = self.inventory.get_stock(product_id)
            if available_stock < data['qty']:
                raise InventoryShortageError(f"Not enough stock for {product_id}")

        # 2. Calculate Final Price
        final_amount = self.apply_discount()

        # 3. Process Payment
        try:
            success = self.payment.charge(final_amount, "USD")
            if not success:
                raise PaymentFailedError("Transaction declined by gateway")
        except Exception as e:
            # Catching generic network errors from the gateway
            raise PaymentFailedError(f"Payment gateway error: {str(e)}")

        # 4. Decrement Stock (Only occurs if payment succeeded)
        for product_id, data in self.items.items():
            self.inventory.decrement_stock(product_id, data['qty'])

        self.is_paid = True
        self.status = "COMPLETED"
        
        return {"status": "success", "charged_amount": final_amount}

Ensure that you have the above Python file locally in a folder and you load that as a Workspace in Antigravity.

This is a simple Order service that has the following key functionality in the checkout function:

  1. Validates cart is not empty.
  2. Check stock for all items.
  3. Calculates final price.
  4. Charges payment.
  5. Updates inventory.

We are going to assign the Agent the task of generating unit test cases, providing Mock implementations and executing the tests to make sure that they succeed.

We will open our specific workspace folder and you will notice that we can now use the @ symbol too to reference the file. For example, we could do the following:

8368856e51a7561a.png

This comes up with some explanation of what this file is:

b69c217d3372d802.png

We can ask it to generate a better visualization via the prompt:

Can you visually show this class for better understanding

da5bd701323818d4.png

Our next step is to generate the unit tests and ask the Agent to test it out. I give the following prompt:

generate unit tests for this module and test it out with mock implementations.

It generated the following Task artifact and went about its task.

21425379db336dc6.png

You can also see the details of the tests that it ran:

48f3320cd76b5cd8.png

One of the files that it generated was the test file too. A screenshot of which is shown below:

f962061f115c040f.png

Things to try out

Take your own code and see what you can ask the Agent to do, right from adding more functionality to refactoring parts of your code.

7. Congratulations

Congratulations! You have successfully used Google Antigravity to:

  • Research the web autonomously.
  • Build and iterate on full-stack web applications.
  • Generate assets and refine UI aesthetics.
  • Write and validate complex unit tests with mocks.

You are now ready to let Antigravity handle the heavy lifting on your own projects.

Reference docs