feat: Add location for table in agent events in plugin BigQueryAgentAnalytics

Merge https://github.com/google/adk-python/pull/3784

Co-authored-by: Xuan Yang <xygoogle@google.com>
COPYBARA_INTEGRATE_REVIEW=https://github.com/google/adk-python/pull/3784 from lipinski:fix/add-location-to-bigqueryagentanalytics 8d88b2c3ad849b22e14a8d74185bfe348fd2503b
PiperOrigin-RevId: 839980070
This commit is contained in:
Łukasz Lipiński
2025-12-03 17:24:30 -08:00
committed by Copybara-Service
parent 92821b8dda
commit 507424acb9
@@ -321,6 +321,7 @@ class BigQueryAgentAnalyticsPlugin(BasePlugin):
dataset_id: str,
table_id: str = "agent_events",
config: Optional[BigQueryLoggerConfig] = None,
location: str = "US",
**kwargs,
):
"""Initializes the BigQueryAgentAnalyticsPlugin.
@@ -338,6 +339,7 @@ class BigQueryAgentAnalyticsPlugin(BasePlugin):
dataset_id,
table_id,
)
self._location = location
self._config = config if config else BigQueryLoggerConfig()
self._bq_client: bigquery.Client | None = None
self._write_client: BigQueryWriteAsyncClient | None = None
@@ -458,7 +460,10 @@ class BigQueryAgentAnalyticsPlugin(BasePlugin):
user_agent=f"google-adk-bq-logger/{version.__version__}"
)
self._bq_client = bigquery.Client(
project=self._project_id, credentials=creds, client_info=client_info
project=self._project_id,
credentials=creds,
client_info=client_info,
location=self._location,
)
# Ensure table exists (sync call in thread)