# Use VAIL from Google Antigravity

> Connect Google Antigravity to VAIL, then scan, probe, and harden an agent from the repository you have open. This covers the Antigravity App, Antigravity IDE, and Antigravity CLI. The page for people is https://agents.projectvail.com/docs/guides/antigravity; all guides: https://agents.projectvail.com/docs/guides.md

## Before you start

- A VAIL account. Sign up at [agents.projectvail.com](https://agents.projectvail.com); VAIL approves each new organization before its scans run. Accounts, approval, and tokens are explained in [auth.md](https://agents.projectvail.com/auth.md).
- The repository of the agent you want to test, open in Google Antigravity.
- A sandboxed copy of that agent, if you will probe it. Probes try to make it break its rules, and its tool calls are real.

## Connect with a prompt

1. Ask Google Antigravity to add VAIL's MCP server and skills for you:

   ```
   Read https://agents.projectvail.com/docs/guides/antigravity.md and add the VAIL Agent Assurance Engine MCP server ("vail", serverUrl "https://agents.projectvail.com/mcp") to ~/.gemini/config/mcp_config.json without overwriting my existing servers. Also install the agent-assurance and agent-improvement skills under ~/.gemini/config/skills/. Do not ask for or write an access token; I will sign in with OAuth 2.1 in the browser.
   ```

2. Sign in with OAuth 2.1. Antigravity discovers VAIL's OAuth metadata automatically via Client ID Metadata Documents (CIMD) or Dynamic Client Registration (DCR), so no client ID or personal token is needed:

   - **Antigravity App:** Open **Customizations → Installed → MCP Servers**, click **Authenticate** next to `vail`, approve access in your browser, and paste the authorization code if prompted.
   - **Antigravity IDE:** Click **Authenticate** next to `vail` in the **MCP Servers** panel and approve access in your browser.
   - **Antigravity CLI:** Run `/mcp`, select `vail`, and complete sign-in in your browser.

## Or configure manually

1. Add VAIL to `~/.gemini/config/mcp_config.json` (global across workspaces) or `.agents/mcp_config.json` (one workspace). In Antigravity IDE, open **... → MCP Servers → Manage MCP Servers → View raw config**; in the Antigravity App, open **Customizations → Installed → MCP Servers** and click **Copy Config File Path** (Antigravity CLI also manages servers with `agy mcp` and `/mcp`):

   ```json
   {
     "mcpServers": {
       "vail": {
         "serverUrl": "https://agents.projectvail.com/mcp"
       }
     }
   }
   ```

2. Sign in with OAuth 2.1. Antigravity discovers VAIL's OAuth metadata automatically via Client ID Metadata Documents (CIMD) or Dynamic Client Registration (DCR), so no client ID or personal token is needed:

   - **Antigravity App:** Open **Customizations → Installed → MCP Servers**, click **Authenticate** next to `vail`, approve access in your browser, and paste the authorization code if prompted.
   - **Antigravity IDE:** Click **Authenticate** next to `vail` in the **MCP Servers** panel and approve access in your browser.
   - **Antigravity CLI:** Run `/mcp`, select `vail`, and complete sign-in in your browser.

3. Optional: add the VAIL skills under `~/.gemini/config/skills/` (shared across Antigravity App, IDE, and CLI) or `.agents/skills/` in the repository.

   ```sh
   mkdir -p ~/.gemini/config/skills/agent-assurance ~/.gemini/config/skills/agent-improvement
   curl -fsSL https://raw.githubusercontent.com/projectvail/vail-agent-assurance/main/plugins/vail-agent-assurance/skills/agent-assurance/SKILL.md -o ~/.gemini/config/skills/agent-assurance/SKILL.md
   curl -fsSL https://raw.githubusercontent.com/projectvail/vail-agent-assurance/main/plugins/vail-agent-assurance/skills/agent-improvement/SKILL.md -o ~/.gemini/config/skills/agent-improvement/SKILL.md
   ```

## For CI or headless machines

For headless use where no browser can open. Create a token under [Access tokens](https://agents.projectvail.com/settings/tokens). Because `mcp_config.json` does not expand OS environment variables in `headers`, place the bearer token only in your global `~/.gemini/config/mcp_config.json` (never in a committed `.agents/mcp_config.json` file) and restrict permissions with `chmod 600 ~/.gemini/config/mcp_config.json`:

```json
{
  "mcpServers": {
    "vail": {
      "serverUrl": "https://agents.projectvail.com/mcp",
      "headers": {
        "Authorization": "Bearer <your VAIL token>"
      }
    }
  }
}
```

## Check the connection

Ask Google Antigravity:

```
Which VAIL organization am I connected to?
```

It calls `get_identity`, which names your organization and whether it may scan yet. Until VAIL approves a new organization, it can create agents and upload source, but scans and probe generation wait.

## Onboard your agent

Open the agent's repository in Google Antigravity, and ask:

```
Use VAIL to onboard the AI agent in this repository: create it in VAIL, upload its source, scan it for behaviors, and generate probes. Then summarize the vulnerability and control behaviors it found.
```

It creates the agent in VAIL, shows you the files it will upload, uploads them with its own shell tools, scans the agent, and generates probes. Scans take several minutes. You approve probes and schedule them against the running agent in the [web app](https://agents.projectvail.com/agents).

## Test and fix the agent locally

The `agent-improvement` skill tests the agent's risks against a copy running on your machine, graded the way VAIL grades them, then fixes what the tests show and runs them again. It works for LangGraph, Hermes, and OpenClaw agents. Ask:

```
Use the agent-improvement skill to test this agent's VAIL behaviors against a local copy, and fix what fails.
```

You choose which risks to address and approve every change. The skill installs VAIL's grading package in a virtual environment of its own, and keeps results in `.vail/` in the agent's repository. Keep that directory out of version control, since it holds the agent's replies.

## Troubleshooting

- The `vail` tools are missing or disconnected: in the Antigravity App open **Customizations → Installed → MCP Servers** and click **More actions → Restart** or **Authenticate**; in Antigravity CLI run `/mcp` to reload and inspect logs.
- OAuth calls stop authenticating: re-authenticate `vail` from **MCP Servers** or `/mcp` (tokens are cached in `~/.gemini/antigravity/mcp_oauth_tokens.json`).
- A tool call hits Antigravity's default 3-minute timeout: add `"timeoutSeconds": 600` to the `vail` entry in `mcp_config.json`.
- A tool returns `organization_not_approved`: your organization is still pending. Uploads work; scans and probe generation start once VAIL approves it. Questions: contact@projectvail.com.
