Skip to content

Commit 0c78f03

Browse files
authored
Merge branch 'main' into feat/add-metadata-parameter
2 parents 4961417 + 82fa10b commit 0c78f03

File tree

58 files changed

+2748
-675
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+2748
-675
lines changed

contributing/samples/api_registry_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
mcp_server_name=MCP_SERVER_NAME,
2727
)
2828
root_agent = LlmAgent(
29-
model="gemini-2.0-flash",
29+
model="gemini-2.5-flash",
3030
name="bigquery_assistant",
3131
instruction=f"""
3232
You are a helpful data analyst assistant with access to BigQuery. The project ID is: {PROJECT_ID}

contributing/samples/application_integration_agent/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ This sample demonstrates how to use the `ApplicationIntegrationToolset` within a
77
## Prerequisites
88

99
1. **Set up Integration Connection:**
10-
* You need an existing [Integration connection](https://cloud.google.com/integration-connectors/docs/overview) configured to interact with your Jira instance. Follow the [documentation](https://google.github.io/adk-docs/tools/google-cloud-tools/#use-integration-connectors) to provision the Integration Connector in Google Cloud and then use this [documentation](https://cloud.google.com/integration-connectors/docs/connectors/jiracloud/configure) to create an Jira connection. Note the `Connection Name`, `Project ID`, and `Location` of your connection.
10+
* You need an existing [Integration connection](https://cloud.google.com/integration-connectors/docs/overview) configured to interact with your Jira instance. Follow the [documentation](https://google.github.io/adk-docs/tools/google-cloud-tools/#use-integration-connectors) to provision the Integration Connector in Google Cloud and then use this [documentation](https://cloud.google.com/integration-connectors/docs/connectors/jiracloud/configure) to create a Jira connection. Note the `Connection Name`, `Project ID`, and `Location` of your connection.
1111
*
1212

1313
2. **Configure Environment Variables:**
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Data Agent Sample
2+
3+
This sample agent demonstrates ADK's first-party tools for interacting with
4+
Data Agents powered by [Conversational Analytics API](https://docs.cloud.google.com/gemini/docs/conversational-analytics-api/overview).
5+
These tools are distributed via
6+
the `google.adk.tools.data_agent` module and allow you to list,
7+
inspect, and
8+
chat with Data Agents using natural language.
9+
10+
These tools leverage stateful conversations, meaning you can ask follow-up
11+
questions in the same session, and the agent will maintain context.
12+
13+
## Prerequisites
14+
15+
1. An active Google Cloud project with BigQuery and Gemini APIs enabled.
16+
2. Google Cloud authentication configured for Application Default Credentials:
17+
```bash
18+
gcloud auth application-default login
19+
```
20+
3. At least one Data Agent created. You could create data agents via
21+
[Conversational API](https://docs.cloud.google.com/gemini/docs/conversational-analytics-api/overview),
22+
its
23+
[Python SDK](https://docs.cloud.google.com/gemini/docs/conversational-analytics-api/build-agent-sdk),
24+
or for BigQuery data
25+
[BigQuery Studio](https://docs.cloud.google.com/bigquery/docs/create-data-agents#create_a_data_agent).
26+
These agents are created and configured in the Google Cloud console and
27+
point to your BigQuery tables or other data sources.
28+
4. Follow the official
29+
[Setup and prerequisites](https://docs.cloud.google.com/gemini/docs/conversational-analytics-api/overview#setup)
30+
guide to enable the API and configure IAM permissions and authentication for
31+
your data sources.
32+
33+
## Tools Used
34+
35+
* `list_accessible_data_agents`: Lists Data Agents you have permission to
36+
access in the configured GCP project.
37+
* `get_data_agent_info`: Retrieves details about a specific Data Agent given
38+
its full resource name.
39+
* `ask_data_agent`: Chats with a specific Data Agent using natural language.
40+
This tool maintains conversation state: if you ask multiple
41+
questions to the same agent in one session, it will use the same
42+
conversation, allowing for follow-ups. If you switch agents, a new
43+
conversation will be started for the new agent.
44+
45+
## How to Run
46+
47+
1. Navigate to the root of the ADK repository.
48+
2. Run the agent using the ADK CLI:
49+
```bash
50+
adk run --agent-path contributing/samples/data_agent
51+
```
52+
3. The CLI will prompt you for input. You can ask questions like the examples
53+
below.
54+
55+
## Sample prompts
56+
57+
* "List accessible data agents."
58+
* "Using agent
59+
`projects/my-project/locations/global/dataAgents/sales-agent-123`, who were
60+
my top 3 customers last quarter?"
61+
* "How does that compare to the quarter before?"
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
from . import agent
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Copyright 2026 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
import os
16+
17+
from google.adk.agents import Agent
18+
from google.adk.auth.auth_credential import AuthCredentialTypes
19+
from google.adk.tools.data_agent.config import DataAgentToolConfig
20+
from google.adk.tools.data_agent.credentials import DataAgentCredentialsConfig
21+
from google.adk.tools.data_agent.data_agent_toolset import DataAgentToolset
22+
import google.auth
23+
import google.auth.transport.requests
24+
25+
# Define the desired credential type.
26+
# By default use Application Default Credentials (ADC) from the local
27+
# environment, which can be set up by following
28+
# https://cloud.google.com/docs/authentication/provide-credentials-adc.
29+
CREDENTIALS_TYPE = None
30+
31+
if CREDENTIALS_TYPE == AuthCredentialTypes.OAUTH2:
32+
# Initiaze the tools to do interactive OAuth
33+
# The environment variables OAUTH_CLIENT_ID and OAUTH_CLIENT_SECRET
34+
# must be set
35+
credentials_config = DataAgentCredentialsConfig(
36+
client_id=os.getenv("OAUTH_CLIENT_ID"),
37+
client_secret=os.getenv("OAUTH_CLIENT_SECRET"),
38+
)
39+
elif CREDENTIALS_TYPE == AuthCredentialTypes.SERVICE_ACCOUNT:
40+
# Initialize the tools to use the credentials in the service account key.
41+
# If this flow is enabled, make sure to replace the file path with your own
42+
# service account key file
43+
# https://cloud.google.com/iam/docs/service-account-creds#user-managed-keys
44+
creds, _ = google.auth.load_credentials_from_file(
45+
"service_account_key.json",
46+
scopes=["https://www.googleapis.com/auth/cloud-platform"],
47+
)
48+
creds.refresh(google.auth.transport.requests.Request())
49+
credentials_config = DataAgentCredentialsConfig(credentials=creds)
50+
else:
51+
# Initialize the tools to use the application default credentials.
52+
# https://cloud.google.com/docs/authentication/provide-credentials-adc
53+
application_default_credentials, _ = google.auth.default()
54+
credentials_config = DataAgentCredentialsConfig(
55+
credentials=application_default_credentials
56+
)
57+
58+
tool_config = DataAgentToolConfig(
59+
max_query_result_rows=100,
60+
)
61+
da_toolset = DataAgentToolset(
62+
credentials_config=credentials_config,
63+
data_agent_tool_config=tool_config,
64+
tool_filter=[
65+
"list_accessible_data_agents",
66+
"get_data_agent_info",
67+
"ask_data_agent",
68+
],
69+
)
70+
71+
root_agent = Agent(
72+
name="data_agent",
73+
model="gemini-2.0-flash",
74+
description="Agent to answer user questions using Data Agents.",
75+
instruction=(
76+
"## Persona\nYou are a helpful assistant that uses Data Agents"
77+
" to answer user questions about their data.\n\n## Tools\n- You can"
78+
" list available data agents using `list_accessible_data_agents`.\n-"
79+
" You can get information about a specific data agent using"
80+
" `get_data_agent_info`.\n- You can chat with a specific data"
81+
" agent using `ask_data_agent`.\n"
82+
),
83+
tools=[da_toolset],
84+
)

contributing/samples/mcp_dynamic_header_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from google.adk.tools.mcp_tool.mcp_toolset import McpToolset
1919

2020
root_agent = LlmAgent(
21-
model='gemini-2.0-flash',
21+
model='gemini-2.5-flash',
2222
name='tenant_agent',
2323
instruction="""You are a helpful assistant that helps users get tenant
2424
information. Call the get_tenant_data tool when the user asks for tenant data.""",

contributing/samples/mcp_postgres_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
)
3232

3333
root_agent = LlmAgent(
34-
model="gemini-2.0-flash",
34+
model="gemini-2.5-flash",
3535
name="postgres_agent",
3636
instruction=(
3737
"You are a PostgreSQL database assistant. "

contributing/samples/mcp_service_account_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
SCOPES = {"https://www.googleapis.com/auth/cloud-platform": ""}
3030

3131
root_agent = LlmAgent(
32-
model="gemini-2.0-flash",
32+
model="gemini-2.5-flash",
3333
name="enterprise_assistant",
3434
instruction="""
3535
Help the user with the tools available to you.

contributing/samples/mcp_sse_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
)
2929

3030
root_agent = LlmAgent(
31-
model='gemini-2.0-flash',
31+
model='gemini-2.5-flash',
3232
name='enterprise_assistant',
3333
instruction=McpInstructionProvider(
3434
connection_params=connection_params,

contributing/samples/mcp_stdio_notion_agent/agent.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
})
3030

3131
root_agent = LlmAgent(
32-
model="gemini-2.0-flash",
32+
model="gemini-2.5-flash",
3333
name="notion_agent",
3434
instruction=(
3535
"You are my workspace assistant. "

0 commit comments

Comments
 (0)