Build Better AI Agents with Google Antigravity Skills and Workflows

How to configure Antigravity AI agent workflows to resiliently automate critical code generation tasks: all without the need for third-party tools.



Build Better AI Agents with Google Antigravity Skills and Workflows
Image by Editor

 

Introduction

 
Chances are, you already have the feeling that the new, agent-first artificial intelligence era is here, with developers resorting to new tools that, instead of just generating code reactively, genuinely understand the unique processes behind code generation.

Google Antigravity has a lot to say in this matter. This tool holds the key to building highly customizable agents. This article unveils part of its potential by demystifying three cornerstone concepts: rules, skills, and workflows.

In this article, you'll learn how to link these key concepts together to build more robust agents and powerful automated pipelines. Specifically, we will perform a step-by-step process to set up a code quality assurance (QA) agent workflow, based on specified rules and skills. Off we go!

 

Understanding the Three Core Concepts

 
Before getting our hands dirty, it is convenient to break down the following three elements belonging to the Google Antigravity ecosystem:

  • Rule: These are the baseline constraints that dictate the agent's behavior, as well as how to adapt it to our stack and match our style. They are stored as markdown files.
  • Skill: Consider skills as a reusable package containing knowledge that instructs the agent on how to address a concrete task. They are allocated in a dedicated folder that contains a file named SKILL.md.
  • Workflow: These are the orchestrators that put it all together. Workflows are invoked by using command-like instructions preceded by a forward slash, e.g. /deploy. Simply put, workflows guide the agent through an action plan or trajectory that is well-structured and consists of multiple steps. This is the key to automating repetitive tasks without loss of precision.

 

Taking Action

 
Let's move on to our practical example. We will see how to configure Antigravity to review Python code, apply correct formatting, and generate tests — all without the need for additional third-party tools.

Before taking these steps, make sure you have downloaded and installed Google Antigravity on your computer first.

Once installed, open the desktop application and open your Python project folder — if you are new to the tool, you will be asked to define a folder in your computer file system to act as the project folder. Regardless, the way to add a manually created folder into Antigravity is through the "File >> Add Folder to Workspace..." option in the upper menu toolbar.

Say you have a new, empty workspace folder. In the root of the project directory (left-hand side), create a new folder and give it the name .agents. Inside this folder, we will create two subfolders: one called rules and one named skills. You may guess that these two are where we will define the two pillars for our agent's behavior: rules and skills.

 

Project folder hierarchy
The project folder hierarchy | Image by Author

 

Let's define a rule first, containing our baseline constraints that will ensure the agent's adherence to Python formatting standards. We don't need verbose syntax to do this: in Antigravity, we define it using clear instructions in natural language. Inside the rules subfolder, you'll create a file named python-style.md and paste the following content:

# Python Style Rule
Always use PEP 8 standards. When providing or refactoring code, assume we are using `black` for formatting. Keep dependencies strictly to free, open-source libraries to ensure our project remains free-friendly.

 

If you want to nail it, go to the agent customizations panel that activates on the right-hand side of the editor, open it, and find and select the rule we just defined:

 

Customizing activation of agent rules
Customizing the activation of agent rules | Image by Author

 

Customization options will appear above the file we just edited. Set the activation model to "glob" and specify this glob pattern: **/*.py, as shown below:

 

Setting Glob activation mode
Setting the glob activation mode | Image by Author

 

With this, you just ensured the agent that will be launched later always applies the rule defined when we are specifically working on Python scripts.

Next, it's time to define (or "teach") the agent some skills. That will be the skill of performing robust tests on Python code — something extremely useful in today's demanding software development landscape. Inside the skills subfolder, we will create another folder with the name pytest-generator. Create a SKILL.md file inside it, with the following content:

 

Defining agent skills
Defining agent skills within the workspace | Image by Author

 

Now it's time to put it all together and launch our agent, but not without having inside our project workspace an example Python file containing "poor-quality" code first to try it all on. If you don't have any, try creating a new .py file, calling it something like flawed_division.py in the root directory, and add this code:

def divide_numbers( x,y ):
  return x/y

 

You may have noticed this Python code is intentionally messy and flawed. Let's see what our agent can do about it. Go to the customization panel on the right-hand side, and this time focus on the "Workflows" navigation pane. Click "+Workspace" to create a new workflow we will call qa-check, with this content:

# Title: Python QA Check
# Description: Automates code review and test generation for Python files.

Step 1: Review the currently open Python file for bugs and style issues, adhering to our Python Style Rule.
Step 2: Refactor any inefficient code.
Step 3: Call the `pytest-generator` skill to write comprehensive unit tests for the refactored code.
Step 4: Output the final test code and suggest running `pytest` in the terminal.

 

All these pieces, when glued together by the agent, will transform the development loop as a whole. With the messy Python file still open in the workspace, we will put our agent to work by clicking the agent icon in the right-hand side panel, typing the qa-check command, and hitting enter to run the agent:

 

Putting the agent to work
Invoking the QA workflow via the agent console | Image by Author

 

After execution, the agent will have revised the code and automatically suggested a new version in the Python file, as shown below:

 

Code improvements generated by the agent
The refactored code suggested by the agent | Image by Author

 

But that's not all: the agent also comes with the comprehensive quality check we were looking for by generating a number of code excerpts you can use to run different types of tests using pytest. For the sake of illustration, this is what some of these tests could look like:

import pytest
from flawed_division import divide_numbers

def test_divide_numbers_normal():
    assert divide_numbers(10, 2) == 5.0
    assert divide_numbers(9, 3) == 3.0

def test_divide_numbers_negative():
    assert divide_numbers(-10, 2) == -5.0
    assert divide_numbers(10, -2) == -5.0
    assert divide_numbers(-10, -2) == 5.0

def test_divide_numbers_float():
    assert divide_numbers(5.0, 2.0) == 2.5

def test_divide_numbers_zero_numerator():
    assert divide_numbers(0, 5) == 0.0

def test_divide_numbers_zero_denominator():
    with pytest.raises(ValueError, match="Cannot divide by zero"):
        divide_numbers(10, 0)

 

All this sequential process performed by the agent has consisted of first analyzing the code under the constraints we defined through rules, then autonomously calling the newly defined skill to produce a comprehensive testing strategy tailored to our codebase.

 

Wrapping Up

 
Looking back, in this article, we have shown how to combine three key elements of Google Antigravity — rules, skills, and workflows — to turn generic agents into specialized, robust, and efficient workmates. We illustrated how to make an agent specialized in correctly formatting messy code and defining QA tests.
 
 

Iván Palomares Carrascosa is a leader, writer, speaker, and adviser in AI, machine learning, deep learning & LLMs. He trains and guides others in harnessing AI in the real world.


Get the FREE ebook 'KDnuggets Artificial Intelligence Pocket Dictionary' along with the leading newsletter on Data Science, Machine Learning, AI & Analytics straight to your inbox.

By subscribing you accept KDnuggets Privacy Policy


Get the FREE ebook 'KDnuggets Artificial Intelligence Pocket Dictionary' along with the leading newsletter on Data Science, Machine Learning, AI & Analytics straight to your inbox.

By subscribing you accept KDnuggets Privacy Policy

Get the FREE ebook 'KDnuggets Artificial Intelligence Pocket Dictionary' along with the leading newsletter on Data Science, Machine Learning, AI & Analytics straight to your inbox.

By subscribing you accept KDnuggets Privacy Policy

No, thanks!