Connect Antigravity to Observagent.
Keep using the Antigravity CLI while a lightweight Python adapter sends authenticated OTLP logs to your Observagent project.
Choose the telemetry coverage you need
Antigravity exposes structured stream-json events in non-interactive print mode. The adapter converts conversation, step, completion, timing, and available token information into OTLP logs. In interactive mode, the terminal must remain attached directly to Antigravity, so the wrapper records only session start and session end.
- Print mode: detailed structured events for one prompt, including available usage fields.
- Interactive mode: session ID, model label, working directory, duration, status, and exit code.
- Interactive prompts and token counts are not exposed by the documented CLI interface and are therefore not collected.
- The Model usage chart counts telemetry records containing a model attribute. It does not count unique prompts or sessions.
Minimum required plan
Antigravity Free (individual account).
- Sign in with a Google account eligible for Antigravity. CLI access is included across plans; model availability and usage limits depend on your plan.
Requirements reviewed on .
Integration steps
Select a platform to see commands and paths for your computer. Project setup and delivery verification are shared across platforms.
- Step 1
Check prerequisites
Confirm the Antigravity CLI and Python are available.
- Confirm that agy resolves to the executable you normally use before creating a wrapper or pipeline.
- Use a supported Python 3 release and keep its virtual environment local to this adapter.
PowerShellagy --help python --version - Step 2
Create the adapter environment
Place antigravity_to_observagent.py in this directory, then install its dependency.
- Download antigravity_to_observagent.py into the directory created by this step.
- Calling the virtual environment’s Python directly avoids dependence on shell activation.
PowerShellNew-Item -ItemType Directory -Force "$HOME\antigravity-observagent" Set-Location "$HOME\antigravity-observagent" python -m venv .venv .\.venv\Scripts\python.exe -m pip install opentelemetry-proto - Step 3
Configure and run
Keep the project key in the current terminal only. The adapter appends /v1/logs.
- Replace the placeholder endpoint if your Observagent deployment uses a different HTTPS hostname.
- The hidden key prompt keeps the credential out of terminal history on macOS and Linux.
- Print mode provides detailed streamed events; interactive mode may provide session boundaries only.
PowerShell$env:OBSERVAGENT_ENDPOINT = "https://dashboard.observagent.cloud" $env:OBSERVAGENT_API_KEY = (Read-Host "Project key").Trim() $env:OBSERVAGENT_USER_ID = "local-user" agy --model gemini-3.8-flash -p "Explain observability in one sentence" --output-format stream-json | & "$HOME\antigravity-observagent\.venv\Scripts\python.exe" "$HOME\antigravity-observagent\antigravity_to_observagent.py" - Step 4
Verify delivery
After the command completes, open Observagent Telemetry Data and filter for the Antigravity session and local-user identity.
- Allow a few seconds for the exporter to flush after the command exits.
- Confirm the session identity, timestamp, model, and event source before treating delivery as complete.
1. Prepare PowerShell and Python
You need the agy command, Python 3, an Observagent project, and a project API key with telemetry:write permission.
agy --help
python --versionCreate or select a project in Observagent, enable Logs, and generate a project key. Treat the complete key as a secret; never commit it to source control or paste it into public documentation.
2. Install the local adapter
Place antigravity_to_observagent.py in a local integration directory, create a virtual environment, and install the OTLP protobuf dependency.
New-Item -ItemType Directory -Force "$HOME\antigravity-observagent"
Set-Location "$HOME\antigravity-observagent"
python -m venv .venv
.\.venv\Scripts\python.exe -m pip install opentelemetry-protoUse the virtual environment's Python directly in wrappers so the integration does not depend on activation or the current shell's Python PATH.
3. Configure the destination securely
Set the ingestion base URL and project key in the PowerShell session that launches Antigravity. The adapter appends /v1/logs to the base URL.
$env:OBSERVAGENT_ENDPOINT = "https://dashboard.observagent.cloud"
$env:OBSERVAGENT_API_KEY = (Read-Host "Observagent project API key").Trim()
$env:OBSERVAGENT_USER_ID = "local-user"Environment variables set this way last only for the current PowerShell process. Do not store a live key in a committed profile or setup script.
4. Send detailed telemetry in print mode
$adapter = "$HOME\antigravity-observagent\antigravity_to_observagent.py"
agy --model gemini-3.8-flash -p "Explain observability in one sentence" --output-format stream-json |
& "$HOME\antigravity-observagent\.venv\Scripts\python.exe" $adapterThe adapter prints response text while exporting supported events. Do not add a second output-format option. Each emitted model-tagged log can contribute to Model usage, so the chart total is not necessarily one per prompt.
5. Preserve the interactive CLI
A PowerShell function can wrap the real executable without piping its terminal output. Capture the executable path before defining the function to avoid recursion. Send session-start, launch Antigravity normally, then send session-end in a finally block.
$script:AntigravityExe = (Get-Command agy -CommandType Application).Source
$script:Adapter = "$HOME\antigravity-observagent\antigravity_to_observagent.py"
$script:AdapterPython = "$HOME\antigravity-observagent\.venv\Scripts\python.exe"
function global:agy {
$sessionId = [guid]::NewGuid().ToString()
$started = Get-Date
$exitCode = 1
$model = "gemini-3.8-flash"
for ($i = 0; $i -lt $args.Count; $i++) {
if ($args[$i] -eq "--model" -and $i + 1 -lt $args.Count) { $model = $args[$i + 1]; break }
if ($args[$i] -is [string] -and $args[$i].StartsWith("--model=")) { $model = $args[$i].Substring(8); break }
}
& $script:AdapterPython $script:Adapter session-start --session-id $sessionId --cwd (Get-Location).Path --model $model
try {
& $script:AntigravityExe @args
$exitCode = $LASTEXITCODE
} finally {
$durationMs = ((Get-Date) - $started).TotalMilliseconds
& $script:AdapterPython $script:Adapter session-end --session-id $sessionId --exit-code $exitCode --duration-ms $durationMs --model $model
$global:LASTEXITCODE = $exitCode
}
}Run agy normally after loading the function. One open session emits one start record; exiting emits one end record. Sending six prompts inside that session still produces only those two records.
6. Verify records in Observagent
Open Telemetry Data, choose a time range that includes the new activity, clear old filters, and search for agent:antigravity-cli. Inspect the original attributes for event.name, session.id, model, and duration fields.
- Interactive start:
antigravity.session.started. - Interactive completion:
antigravity.session.completed. - Print conversation completion:
antigravity.response.completed. - Model usage counts records containing a recognized model field, not unique prompts.
Troubleshoot missing telemetry
- No records: confirm the endpoint, ensure the key has
telemetry:write, and enable Logs for the selected project. - Model usage shows one during an interactive session: only the start record exists until you exit Antigravity.
- Model usage shows two after many prompts: interactive mode records session boundaries, not prompt boundaries.
- Model not reported: reload the latest wrapper and either pass
--modelor configure the correct default model. - No token totals for interactive mode: the documented interactive CLI does not expose per-turn token usage to the wrapper.
- HTTP 401: replace the configured value with the complete raw project key. Never share the key in diagnostic output.