Skip to content

usage_metadata field is not being written to the session database #3686

@marttinslucas

Description

@marttinslucas

When running the ADK using a session database (session store), the usage_metadata field is not being persisted.
This happens even though the model returns response normally.

Expected behavior
The usage_metadata object should be saved in the session entry, just like other session-related fields generated during a run.

Current behavior
The session database entry is created or updated, but the usage_metadata field is always missing.
No errors are thrown during the operation.

Steps to reproduce
1. Configure ADK with a session database (e.g., Firestore, SQL, or other supported backends).
2. Execute any workflow or agent call that returns usage metadata.
3. Inspect the session record in the database.
4. Notice that usage_metadata is not present.

Additional context
• The model usage is correctly returned inside the ADK execution result.
• Only the persistence layer seems to ignore this field during write operations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    core[Component] This issue is related to the core interface and implementation

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions