Skip to main content
Google Antigravity 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.
The tracing instructions cover the Antigravity CLI (agy) on macOS and Linux, not IDE sessions. Native Windows tracing setup is not supported.

Trace Antigravity sessions

The braintrust-antigravity-tracing 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

If you already use Antigravity tracing, follow Update the tracing plugin.
1

Install Antigravity

If you haven’t already, install the Antigravity CLI. Make sure its agy command and a Unix-compatible sh are available in your terminal.
2

Install and authenticate bt

Follow the bt CLI quickstart to install bt, authenticate, and set your active context.
3

Enable tracing

Before starting Antigravity, run this command in a terminal:
This command:
  • Installs (or updates) and enables braintrust-antigravity-tracing 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.
4

Restart Antigravity

Restart Antigravity so it loads the plugin and tracing settings.
5

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 Logs page.

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

To change the saved destination, profile, or organization, rerun bt trace enable antigravity with the corresponding options. Running bt 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.
Antigravity stores session transcripts locally. Use 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.
When you resume an Antigravity session, new turns are added to its existing Braintrust trace.
Use bt trace disable antigravity to uninstall the tracing plugin and remove its tracing configuration. Saved bt profiles and credentials are preserved. Restart Antigravity afterward.

Update the tracing plugin

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.
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 to update bt and complete the applicable migrations.Run this command with the profile, organization, and project you recorded:
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 Logs page in the intended Braintrust project.
For routine updates, follow these steps:
1

Update bt

Follow the CLI migration guide to update bt to the latest version and complete the applicable migrations.
2

Update the tracing plugin

bt trace update updates the installed plugin without changing your saved tracing configuration.
3

Restart and verify Antigravity

Restart Antigravity, run a short agy session, and confirm that its trace appears on the Logs page in the intended Braintrust project.

Troubleshooting tracing

First, run bt trace doctor antigravity. Then, review the following:
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.
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.For authentication, tracing destination, or endpoint problems, see bt trace troubleshooting and the CLI migration troubleshooting guide.Tracing failures do not interrupt the Antigravity session.
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.
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.

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

1

Install Antigravity

If you haven’t already, install the Antigravity CLI.
2

Add the Braintrust MCP server

From the terminal, configure Antigravity’s connection to the Braintrust MCP server:
See Endpoints for EU and self-hosted URLs.
3

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.
4

Verify the connection

In Antigravity, ask it to list your recent Braintrust projects and confirm that it uses the Braintrust MCP server.

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 for more workflows and example prompts.

Troubleshooting MCP

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.
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.

Next steps