Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Live Mode is missing usage_metadata and telemetry tracing #2323

Copy link
Copy link
@emilmilow

Description

@emilmilow
Issue body actions

Describe the bug
When using ADK with Gemini Live API, the usage_metadata field is always None in Event objects, making it impossible to track token usage for cost monitoring and observability. Additionally, telemetry tracing doesn't work properly for live events, with token usage data being lost instead of creating individual spans for each event.

To Reproduce
Steps to reproduce the behavior:

  1. Install google-adk
  2. Create a voice agent using gemini-live-2.5-flash model:
    from google.adk.agents import Agent
    agent = Agent(
        name="voice_assistant_agent",
        model="gemini-live-2.5-flash", # or any other live model
        tools=[some_tool]
    )
  3. Run the agent and process live events:
    async for event in live_events:
        print(f"Usage metadata: {event.usage_metadata}")  # Always None
  4. CheckOpenTelemetry traces for token usage
  5. Observe that token usage is not tracked in telemetry spans

Expected behavior

  • event.usage_metadata should contain actual token usage data from the Gemini Live API response
  • Each live event should create a separate OpenTelemetry span with token usage metrics (gen_ai.usage.input_tokens, gen_ai.usage.output_tokens, gen_ai.usage.total_tokens)
Reactions are currently unavailable

Metadata

Metadata

Assignees

Labels

live[Component] This issue is related to live, voice and video chat[Component] This issue is related to live, voice and video chatneeds review[Status] The PR/issue is awaiting review from the maintainer[Status] The PR/issue is awaiting review from the maintainer

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.