Skip to content

feat(bigquery): Add labels support to BigQueryToolConfig for job tracking and monitoring #3582

@Faraaz1994

Description

@Faraaz1994

** Please make sure you read the contribution guide and file the issues in the right place. **
Contribution guide.

Is your feature request related to a problem? Please describe.
Currently, the BigQuery tool in ADK does not provide a way for developers to add custom labels to BigQuery jobs created by their agents. This makes it difficult to:

  • Track and monitor BigQuery costs associated with specific agents or use cases
  • Organize and filter BigQuery jobs in the Google Cloud Console
  • Implement billing attribution and resource organization strategies
  • Differentiate between jobs from different environments (dev, staging, production)

While the tool automatically adds an internal adk-bigquery-tool label with the caller_id, there's no mechanism for users to add their own custom labels for tracking and monitoring purposes.

Describe the solution you'd like
Add a labels configuration field to BigQueryToolConfig that allows users to specify custom key-value pairs to be applied to all BigQuery jobs executed by the agent. The solution should:

  • Configuration Option: Add an optional labels parameter to BigQueryToolConfig accepting a dictionary of string key-value pairs
  • Validation: Ensure labels follow BigQuery's requirements (non-empty string keys, string values)
  • Job Application: Automatically apply configured labels to all BigQuery jobs alongside the existing internal labels Documentation: Provide clear documentation on how to use labels for tracking and monitoring

Example usage:

from google.adk.tools.bigquery import BigQueryToolConfig

config = BigQueryToolConfig(
    labels={
        "environment": "production",
        "team": "data-analytics",
        "agent": "sales-insights"
    }
)

Metadata

Metadata

Assignees

Labels

planned[Status] This issue is planned to be work on by ADK eng teamtools[Component] This issue is related to tools

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions