Skip to main content
The Google Antigravity SDK (google-antigravity) is a Python SDK for building agents on Antigravity. Braintrust traces each Agent.chat() turn, including the agent’s steps and tool calls.
Requires Braintrust Python SDK v0.51.0 or later and google-antigravity v0.1.23 or later. To trace sessions in the Antigravity coding agent instead, see Google Antigravity.

Setup

Install Braintrust alongside the Antigravity SDK, then set your environment variables.
1

Install packages

2

Set environment variables

.env

Auto-instrumentation

braintrust.auto_instrument() traces Antigravity agents alongside Braintrust’s other supported libraries. Call it before you create an Agent.
trace_antigravity_auto.py
To disable Antigravity SDK instrumentation when calling auto_instrument(), pass antigravity=False:

Manual instrumentation

setup_antigravity() traces the Antigravity SDK without auto-instrumenting other libraries. It initializes a Braintrust logger when one isn’t already active. Call it before you create an Agent.
trace_antigravity_manual.py
To instrument a specific Agent class instead, pass it to wrap_antigravity_agent(). The class is patched in place, including when you imported it before the call.

What Braintrust traces

Braintrust traces each Agent.chat() turn as a nested trace:
  • Chat turn spans (antigravity.chat), with the prompt as input, preceded by the agent’s system instructions when set. The output is the assistant’s final text or structured output. Metadata records the model, the enabled built-in tools and Python tool definitions (name, description, and parameters), and the conversation ID.
  • Model step spans (antigravity.<step type>), with the step’s assistant content and reasoning as output, and the trajectory ID and step index in metadata.
  • Built-in tool spans named after each tool, such as view_file, with the tool arguments as input.
  • Python tool spans named after each function tool, with the call arguments as input and the return value as output.
  • Images, documents, audio, and video in prompts and Python tool results, uploaded as attachments.
  • Token usage metrics (prompt, cached prompt, completion, reasoning, and total) and time to first token on the chat turn span.
  • Errors on the chat turn span, including cancelled turns, and on the step that failed.
The Antigravity SDK runs model requests in a separate process and reports token usage per turn. Braintrust records that usage on the antigravity.chat span, and model step spans show the agent’s progress within the turn.

Resources