Problem
The Python ADK integration currently maps Google UsageMetadata as:
prompt_tokens = prompt_token_count
completion_tokens = candidates_token_count
completion_reasoning_tokens = thoughts_token_count
tokens = total_token_count
This leaves thoughts_token_count out of the completion total and ignores tool_use_prompt_token_count. For reasoning or tool-using calls, the emitted prompt/completion breakdown can therefore disagree with the provider total and with Braintrust instrumentation semantics.
Current implementation: py/src/braintrust/integrations/adk/tracing.py
Provider reference: Google GenerateContent UsageMetadata
Expected behavior
Align ADK usage extraction with the Python Google GenAI integration:
prompt_tokens = prompt_token_count + (tool_use_prompt_token_count or 0)
completion_tokens = candidates_token_count + (thoughts_token_count or 0)
- retain
completion_reasoning_tokens = thoughts_token_count as the reasoning breakdown
- retain
tokens = total_token_count when Google reports it
- preserve any useful provider-specific modality/detail breakdowns as metadata rather than adding nonstandard metrics
- preserve zero values and omit values Google did not report
Acceptance criteria
- Add VCR-backed ADK coverage using real Google response shapes for reasoning and tool-use prompt usage.
- Assert the aggregate prompt/completion metrics and the reasoning detail metric.
- Assert
tokens == prompt_tokens + completion_tokens when all components are reported.
- Validate every configured
google-adk version in the Python provider matrix, accounting for version-specific field availability.
This is a Python ADK integration change; no instrumentation-spec update should be needed because all emitted metric keys are already standard.
Problem
The Python ADK integration currently maps Google
UsageMetadataas:prompt_tokens = prompt_token_countcompletion_tokens = candidates_token_countcompletion_reasoning_tokens = thoughts_token_counttokens = total_token_countThis leaves
thoughts_token_countout of the completion total and ignorestool_use_prompt_token_count. For reasoning or tool-using calls, the emitted prompt/completion breakdown can therefore disagree with the provider total and with Braintrust instrumentation semantics.Current implementation:
py/src/braintrust/integrations/adk/tracing.pyProvider reference: Google GenerateContent
UsageMetadataExpected behavior
Align ADK usage extraction with the Python Google GenAI integration:
prompt_tokens = prompt_token_count + (tool_use_prompt_token_count or 0)completion_tokens = candidates_token_count + (thoughts_token_count or 0)completion_reasoning_tokens = thoughts_token_countas the reasoning breakdowntokens = total_token_countwhen Google reports itAcceptance criteria
tokens == prompt_tokens + completion_tokenswhen all components are reported.google-adkversion in the Python provider matrix, accounting for version-specific field availability.This is a Python ADK integration change; no instrumentation-spec update should be needed because all emitted metric keys are already standard.