fix: adapt oauth calendar agent and bigquery agent to new Google API toolset interface

PiperOrigin-RevId: 759298612
This commit is contained in:
Xiang (Sean) Zhou
2025-05-15 14:20:59 -07:00
committed by Copybara-Service
parent 4c6820e78c
commit fccd17df6f
2 changed files with 13 additions and 15 deletions

View File

@@ -16,7 +16,7 @@ import os
from dotenv import load_dotenv
from google.adk import Agent
from google.adk.tools.google_api_tool import bigquery_toolset
from google.adk.tools.google_api_tool import BigQueryToolset
# Load environment variables from .env file
load_dotenv()
@@ -24,8 +24,6 @@ load_dotenv()
# Access the variable
oauth_client_id = os.getenv("OAUTH_CLIENT_ID")
oauth_client_secret = os.getenv("OAUTH_CLIENT_SECRET")
bigquery_toolset.configure_auth(oauth_client_id, oauth_client_secret)
tools_to_expose = [
"bigquery_datasets_list",
"bigquery_datasets_get",
@@ -34,8 +32,10 @@ tools_to_expose = [
"bigquery_tables_get",
"bigquery_tables_insert",
]
bigquery_toolset.set_tool_filter(
lambda tool, ctx=None: tool.name in tools_to_expose
bigquery_toolset = BigQueryToolset(
client_id=oauth_client_id,
client_secret=oauth_client_secret,
tool_filter=tools_to_expose,
)
root_agent = Agent(