> ## Documentation Index
> Fetch the complete documentation index at: https://braintrust.dev/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Google Antigravity

> Trace Antigravity coding sessions to Braintrust and access your Braintrust data through the MCP server

[Google Antigravity](https://antigravity.google/) is Google's coding agent. You can connect it to Braintrust in two ways:

* **Trace Antigravity sessions** to record session, turn, model call, and tool spans in Braintrust.
* **Connect to Braintrust MCP** to work with Braintrust projects, experiments, logs, and other data from Antigravity.

<Note>
  The tracing instructions cover the Antigravity CLI (`agy`) on macOS and Linux, not IDE sessions. Native Windows tracing setup is not supported.
</Note>

## Trace Antigravity sessions

The [`braintrust-antigravity-tracing` plugin](https://github.com/braintrustdata/braintrust-antigravity-plugin) passes your interactions with Antigravity to `bt`, which in turn uses a background process to build and deliver the trace to Braintrust.

Antigravity continues to communicate directly with its model provider, and tracing failures do not stop your Antigravity session.

### Set up tracing

<Note>
  If you already use Antigravity tracing, follow [Update the tracing plugin](#update-the-tracing-plugin).
</Note>

<Steps>
  <Step title="Install Antigravity">
    If you haven't already, install the [Antigravity CLI](https://antigravity.google/product/antigravity-cli). Make sure its `agy` command and a Unix-compatible `sh` are available in your terminal.
  </Step>

  <Step title="Install and authenticate bt">
    Follow the [`bt` CLI quickstart](/docs/reference/cli/quickstart) to install `bt`, authenticate, and set your active context.
  </Step>

  <Step title="Enable tracing">
    Before starting Antigravity, run this command in a terminal:

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    bt trace enable antigravity --project <your-project>
    ```

    This command:

    * Installs (or updates) and enables [`braintrust-antigravity-tracing`](https://github.com/braintrustdata/braintrust-antigravity-plugin) through `agy`.
    * Writes `~/.gemini/config/braintrust.json`, which records whether tracing is enabled and which project receives traces.

    The tracing file stores settings, not credentials. These settings apply across projects during normal sessions.

    For more information, see [`bt trace enable`](/docs/reference/cli/trace#bt-trace-enable).
  </Step>

  <Step title="Restart Antigravity">
    Restart Antigravity so it loads the plugin and tracing settings.
  </Step>

  <Step title="Log a test trace">
    Ask Antigravity to do something simple in an `agy` session. When the session finishes, open your Braintrust project and confirm that the trace appears on the [**<Icon icon="activity" /> Logs**](https://www.braintrust.dev/app/~/logs) page.
  </Step>
</Steps>

### What Braintrust traces

Antigravity traces in Braintrust include:

* Session spans with conversation identifiers, available workspace and model metadata, and Git repository metadata when available.
* Turn spans with prompts and final responses.
* Model call spans reconstructed from the session transcript, with conversation input, response output, and available token metrics.
* Tool spans with available inputs, outputs, approval outcomes, and errors.

With `bt` v0.19.3 or later, session spans also include the local username when available.

Every span records its origin as `braintrust.plugin.antigravity`. Model inputs are reconstructed from transcripts rather than captured as raw provider requests. Imported sessions do not establish exact historical model-call latency.

### Common workflows

<AccordionGroup>
  <Accordion title="Change saved tracing settings">
    To change the saved destination, profile, or organization, rerun [`bt trace enable antigravity`](/docs/reference/cli/trace#bt-trace-enable) with the corresponding options. Running [`bt switch`](/docs/reference/cli/switch) does not change the saved tracing configuration.

    To add root-span metadata, pass `--additional-metadata '<JSON>'` to `bt trace enable` for future sessions. Standard session metadata takes precedence when keys conflict.

    With `bt` v0.19.3 or later, pass `--tag ci --tag release-validation` to `bt trace enable` to [tag session spans](/docs/reference/cli/trace#tag-traces).
  </Accordion>

  <Accordion title="Trace a saved Antigravity session">
    Antigravity stores session transcripts locally. Use [`bt trace import`](/docs/reference/cli/trace#bt-trace-import) with `antigravity` and the conversation ID to import a past session, even if tracing was not enabled when it ran.

    You can also attach an imported session to an existing span or experiment.
  </Accordion>

  <Accordion title="Resume an Antigravity session">
    When you resume an Antigravity session, new turns are added to its existing Braintrust trace.
  </Accordion>

  <Accordion title="Stop tracing Antigravity sessions">
    Use [`bt trace disable antigravity`](/docs/reference/cli/trace#bt-trace-disable) to uninstall the tracing plugin and remove its tracing configuration. Saved `bt` profiles and credentials are preserved. Restart Antigravity afterward.
  </Accordion>
</AccordionGroup>

### Update the tracing plugin

<Note>
  If `~/.gemini/config/hooks.json` contains a `braintrust-antigravity-tracing` entry, use "Migrate from a manual hook registration" below instead of the routine update steps.
</Note>

<Accordion title="Migrate from a manual hook registration">
  Record the profile, organization, project, metadata, tags, and custom settings you want to preserve from `~/.gemini/config/braintrust.json` (or your `BT_DAEMON_CONFIG` override). Then follow the [CLI migration guide](/docs/reference/cli/migrate) to update `bt` and complete the applicable migrations.

  Run this command with the profile, organization, and project you recorded:

  ```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
  bt trace enable antigravity \
    --profile <profile> \
    --org <organization> \
    --project <your-project>
  ```

  The command installs the plugin and removes the legacy hook entry. Other hook registrations are preserved. Unlike `bt trace update`, it rewrites your tracing settings.

  Compare the tracing file with the settings you recorded and restore any custom values. `route.flush_mode` resets to `fire_and_forget`, so restore its previous value if you customized it.

  Restart Antigravity, run a short `agy` session, and confirm that its trace appears on the [**<Icon icon="activity" /> Logs**](https://www.braintrust.dev/app/~/logs) page in the intended Braintrust project.
</Accordion>

For routine updates, follow these steps:

<Steps>
  <Step title="Update bt">
    Follow the [CLI migration guide](/docs/reference/cli/migrate) to update `bt` to the latest version and complete the applicable migrations.
  </Step>

  <Step title="Update the tracing plugin">
    ```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    bt trace update antigravity
    ```

    [`bt trace update`](/docs/reference/cli/trace#bt-trace-update) updates the installed plugin without changing your saved tracing configuration.
  </Step>

  <Step title="Restart and verify Antigravity">
    Restart Antigravity, run a short `agy` session, and confirm that its trace appears on the [**<Icon icon="activity" /> Logs**](https://www.braintrust.dev/app/~/logs) page in the intended Braintrust project.
  </Step>
</Steps>

### Troubleshooting tracing

First, run `bt trace doctor antigravity`. Then, review the following:

<AccordionGroup>
  <Accordion title="The tracing plugin is missing or disabled">
    Run `bt trace enable antigravity --project <your-project>` to install and enable the plugin. Restart Antigravity afterward.

    The doctor report checks tracing settings and authentication, not whether Antigravity loaded the plugin's hooks.
  </Accordion>

  <Accordion title="Traces do not appear after setup">
    If Antigravity was running when its plugin or configuration changed, restart it. Confirm that `bt` is available in the environment that launches `agy`.

    Run `bt trace doctor antigravity` and confirm that tracing is enabled and routed to the intended project.

    If authentication succeeds but traces do not appear, confirm that your account has [permission to write logs to the selected project](/docs/reference/cli/trace#project-log-permissions).

    For authentication, tracing destination, or endpoint problems, see [`bt trace` troubleshooting](/docs/reference/cli/trace#troubleshooting) and the [CLI migration troubleshooting guide](/docs/reference/cli/migrate#troubleshooting).

    Tracing failures do not interrupt the Antigravity session.
  </Accordion>

  <Accordion title="Antigravity uses an unexpected configuration directory">
    Tracing settings are saved in `~/.gemini/config/braintrust.json`. To use a different file, set `BT_DAEMON_CONFIG` to its path before both running `bt trace enable antigravity` and launching Antigravity.
  </Accordion>

  <Accordion title="Traces use unexpected settings">
    For normal sessions, the integration does not use `TRACE_TO_BRAINTRUST`, `BRAINTRUST_PROJECT`, or `BRAINTRUST_ADDITIONAL_METADATA` from the agent's environment to override the saved tracing settings.

    For environment variables accepted by the `bt` commands themselves, see [`bt trace`](/docs/reference/cli/trace).
  </Accordion>
</AccordionGroup>

## Connect to Braintrust MCP

The Braintrust MCP server lets Antigravity query and update Braintrust data. MCP is configured independently from the tracing plugin.

### Set up the MCP server

<Steps>
  <Step title="Install Antigravity">
    If you haven't already, install the [Antigravity CLI](https://antigravity.google/product/antigravity-cli).
  </Step>

  <Step title="Add the Braintrust MCP server">
    From the terminal, configure Antigravity's connection to the Braintrust MCP server:

    ```bash theme={"theme":{"light":"github-light","dark":"github-dark-dimmed"}}
    agy mcp add braintrust https://api.braintrust.dev/mcp
    ```

    See [Endpoints](/docs/integrations/developer-tools/mcp#endpoints) for EU and self-hosted URLs.
  </Step>

  <Step title="Authenticate">
    In an `agy` session, enter `/mcp`, select the Braintrust MCP server, and press **Enter**. Choose **Authenticate** and complete the sign-in in your browser.

    MCP authentication is separate from `bt login`, which authenticates the CLI and tracing integration.
  </Step>

  <Step title="Verify the connection">
    In Antigravity, ask it to list your recent Braintrust projects and confirm that it uses the Braintrust MCP server.
  </Step>
</Steps>

### Use MCP tools

Once connected, Antigravity can query logs, compare experiments, work with datasets, and use other Braintrust tools. For example:

* "Show me my recent Braintrust experiments."
* "Query the last 10 logged requests with errors."
* "Compare accuracy scores between my two latest experiments."

See [what the Braintrust MCP can do](/docs/integrations/developer-tools/mcp#what-the-mcp-can-do) for more workflows and example prompts.

### Troubleshooting MCP

<AccordionGroup>
  <Accordion title="Braintrust MCP tools do not appear">
    Enter `/mcp` in an `agy` session and confirm that the Braintrust server is listed. Use the MCP manager to reload the configuration after adding or changing the server.
  </Accordion>

  <Accordion title="MCP authentication or connection fails">
    To authenticate again, enter `/mcp` in an `agy` session, select the Braintrust MCP server, and press **Enter**. Choose **Authenticate** and complete the OAuth flow.

    If you previously configured API-key authentication, remove the `Authorization` header from the Braintrust server's entry in your MCP configuration before switching to OAuth.

    For authentication methods, regional and self-hosted endpoints, and network requirements, see the [Braintrust MCP guide](/docs/integrations/developer-tools/mcp#connect-your-client).
  </Accordion>
</AccordionGroup>

## Next steps

* **Learn the CLI**: See the full [`bt trace` reference](/docs/reference/cli/trace).
* **Run evaluations**: Follow the [evaluation guide](/docs/evaluate/run-evaluations).
* **Explore MCP tools**: See the [Braintrust MCP tool reference](/docs/integrations/developer-tools/mcp#tools).
* **Browse the source**: View the [coding-agent plugins repository](https://github.com/braintrustdata/braintrust-coding-agent-plugins).
