0
# Google Cloud Integration
1
2
Specialized toolsets for Google Cloud services including BigQuery, Bigtable, Spanner, and Google APIs (Calendar, Gmail, Sheets, Docs, YouTube).
3
4
## Capabilities
5
6
### Database Toolsets
7
8
Toolsets for Google Cloud database services with authentication and query capabilities.
9
10
```python { .api }
11
class BigQueryToolset:
12
"""BigQuery database interaction toolset."""
13
14
def __init__(
15
self,
16
project_id: str,
17
credentials_config: 'BigQueryCredentialsConfig' = None,
18
**kwargs
19
):
20
"""
21
Initialize BigQuery toolset.
22
23
Args:
24
project_id (str): Google Cloud project ID
25
credentials_config (BigQueryCredentialsConfig, optional): Authentication configuration
26
**kwargs: Additional configuration parameters
27
"""
28
pass
29
30
class BigQueryCredentialsConfig:
31
"""BigQuery credentials configuration."""
32
33
def __init__(
34
self,
35
service_account_key: str = None,
36
service_account_path: str = None,
37
**kwargs
38
):
39
"""
40
Initialize BigQuery credentials.
41
42
Args:
43
service_account_key (str, optional): Service account key JSON string
44
service_account_path (str, optional): Path to service account key file
45
**kwargs: Additional credential parameters
46
"""
47
pass
48
49
class BigtableToolset:
50
"""Bigtable interaction toolset."""
51
52
def __init__(
53
self,
54
project_id: str,
55
instance_id: str,
56
credentials_config: 'BigtableCredentialsConfig' = None,
57
**kwargs
58
):
59
"""
60
Initialize Bigtable toolset.
61
62
Args:
63
project_id (str): Google Cloud project ID
64
instance_id (str): Bigtable instance ID
65
credentials_config (BigtableCredentialsConfig, optional): Authentication configuration
66
**kwargs: Additional configuration parameters
67
"""
68
pass
69
70
class BigtableCredentialsConfig:
71
"""Bigtable credentials configuration."""
72
73
def __init__(
74
self,
75
service_account_key: str = None,
76
service_account_path: str = None,
77
**kwargs
78
):
79
"""
80
Initialize Bigtable credentials.
81
82
Args:
83
service_account_key (str, optional): Service account key JSON string
84
service_account_path (str, optional): Path to service account key file
85
**kwargs: Additional credential parameters
86
"""
87
pass
88
89
class SpannerToolset:
90
"""Spanner database interaction toolset."""
91
92
def __init__(
93
self,
94
project_id: str,
95
instance_id: str,
96
database_id: str,
97
credentials_config: 'SpannerCredentialsConfig' = None,
98
**kwargs
99
):
100
"""
101
Initialize Spanner toolset.
102
103
Args:
104
project_id (str): Google Cloud project ID
105
instance_id (str): Spanner instance ID
106
database_id (str): Spanner database ID
107
credentials_config (SpannerCredentialsConfig, optional): Authentication configuration
108
**kwargs: Additional configuration parameters
109
"""
110
pass
111
112
class SpannerCredentialsConfig:
113
"""Spanner credentials configuration."""
114
115
def __init__(
116
self,
117
service_account_key: str = None,
118
service_account_path: str = None,
119
**kwargs
120
):
121
"""
122
Initialize Spanner credentials.
123
124
Args:
125
service_account_key (str, optional): Service account key JSON string
126
service_account_path (str, optional): Path to service account key file
127
**kwargs: Additional credential parameters
128
"""
129
pass
130
```
131
132
### Google API Integration
133
134
Toolsets for Google APIs including Workspace applications and YouTube.
135
136
```python { .api }
137
class GoogleApiToolset:
138
"""Generic Google API toolset."""
139
140
def __init__(
141
self,
142
service_name: str,
143
version: str,
144
credentials_config: dict = None,
145
**kwargs
146
):
147
"""
148
Initialize Google API toolset.
149
150
Args:
151
service_name (str): Google API service name
152
version (str): API version
153
credentials_config (dict, optional): Authentication configuration
154
**kwargs: Additional configuration parameters
155
"""
156
pass
157
158
class GoogleApiTool:
159
"""Individual Google API tool."""
160
161
def __init__(
162
self,
163
api_method: str,
164
service_name: str,
165
version: str,
166
**kwargs
167
):
168
"""
169
Initialize Google API tool.
170
171
Args:
172
api_method (str): Specific API method to call
173
service_name (str): Google API service name
174
version (str): API version
175
**kwargs: Additional configuration parameters
176
"""
177
pass
178
179
class CalendarToolset:
180
"""Google Calendar integration toolset."""
181
182
def __init__(self, credentials_config: dict = None, **kwargs):
183
"""
184
Initialize Calendar toolset.
185
186
Args:
187
credentials_config (dict, optional): Authentication configuration
188
**kwargs: Additional configuration parameters
189
"""
190
pass
191
192
class GmailToolset:
193
"""Gmail integration toolset."""
194
195
def __init__(self, credentials_config: dict = None, **kwargs):
196
"""
197
Initialize Gmail toolset.
198
199
Args:
200
credentials_config (dict, optional): Authentication configuration
201
**kwargs: Additional configuration parameters
202
"""
203
pass
204
205
class SheetsToolset:
206
"""Google Sheets integration toolset."""
207
208
def __init__(self, credentials_config: dict = None, **kwargs):
209
"""
210
Initialize Sheets toolset.
211
212
Args:
213
credentials_config (dict, optional): Authentication configuration
214
**kwargs: Additional configuration parameters
215
"""
216
pass
217
218
class SlidesToolset:
219
"""Google Slides integration toolset."""
220
221
def __init__(self, credentials_config: dict = None, **kwargs):
222
"""
223
Initialize Slides toolset.
224
225
Args:
226
credentials_config (dict, optional): Authentication configuration
227
**kwargs: Additional configuration parameters
228
"""
229
pass
230
231
class DocsToolset:
232
"""Google Docs integration toolset."""
233
234
def __init__(self, credentials_config: dict = None, **kwargs):
235
"""
236
Initialize Docs toolset.
237
238
Args:
239
credentials_config (dict, optional): Authentication configuration
240
**kwargs: Additional configuration parameters
241
"""
242
pass
243
244
class YoutubeToolset:
245
"""YouTube API integration toolset."""
246
247
def __init__(self, credentials_config: dict = None, **kwargs):
248
"""
249
Initialize YouTube toolset.
250
251
Args:
252
credentials_config (dict, optional): Authentication configuration
253
**kwargs: Additional configuration parameters
254
"""
255
pass
256
```
257
258
## Usage Examples
259
260
### BigQuery Integration
261
262
```python
263
from google.adk.tools.bigquery import BigQueryToolset, BigQueryCredentialsConfig
264
from google.adk.agents import Agent
265
266
# Configure BigQuery credentials
267
credentials = BigQueryCredentialsConfig(
268
service_account_path="/path/to/service-account.json"
269
)
270
271
# Create BigQuery toolset
272
bq_toolset = BigQueryToolset(
273
project_id="my-project",
274
credentials_config=credentials
275
)
276
277
# Use with agent
278
agent = Agent(
279
name="data_analyst",
280
model="gemini-2.0-flash",
281
instruction="Help analyze data using BigQuery",
282
tools=bq_toolset.get_tools()
283
)
284
285
# Example query through agent
286
response = agent.run("Query the sales table to find top 10 products by revenue")
287
```
288
289
### Gmail Integration
290
291
```python
292
from google.adk.tools.google_api_tool import GmailToolset
293
from google.adk.agents import Agent
294
295
# Configure Gmail toolset
296
gmail_toolset = GmailToolset(
297
credentials_config={
298
"type": "oauth2",
299
"client_id": "your-client-id",
300
"client_secret": "your-client-secret",
301
"refresh_token": "your-refresh-token"
302
}
303
)
304
305
# Create email assistant
306
email_agent = Agent(
307
name="email_assistant",
308
model="gemini-2.0-flash",
309
instruction="Help manage emails efficiently",
310
tools=gmail_toolset.get_tools()
311
)
312
313
# Use agent to manage emails
314
response = email_agent.run("Send an email to john@example.com about the meeting tomorrow")
315
```
316
317
### Google Sheets Integration
318
319
```python
320
from google.adk.tools.google_api_tool import SheetsToolset
321
from google.adk.agents import Agent
322
323
# Configure Sheets toolset
324
sheets_toolset = SheetsToolset(
325
credentials_config={
326
"service_account_path": "/path/to/credentials.json"
327
}
328
)
329
330
# Create spreadsheet assistant
331
sheets_agent = Agent(
332
name="sheets_assistant",
333
model="gemini-2.0-flash",
334
instruction="Help manage and analyze Google Sheets data",
335
tools=sheets_toolset.get_tools()
336
)
337
338
# Use agent to work with sheets
339
response = sheets_agent.run(
340
"Update the budget spreadsheet with Q4 projections: "
341
"https://docs.google.com/spreadsheets/d/spreadsheet-id"
342
)
343
```
344
345
### Calendar Integration
346
347
```python
348
from google.adk.tools.google_api_tool import CalendarToolset
349
from google.adk.agents import Agent
350
351
# Configure Calendar toolset
352
calendar_toolset = CalendarToolset(
353
credentials_config={
354
"oauth2_credentials": "path/to/oauth2.json"
355
}
356
)
357
358
# Create calendar assistant
359
calendar_agent = Agent(
360
name="calendar_assistant",
361
model="gemini-2.0-flash",
362
instruction="Help manage calendar events and scheduling",
363
tools=calendar_toolset.get_tools()
364
)
365
366
# Schedule meetings
367
response = calendar_agent.run(
368
"Schedule a team meeting for next Tuesday at 2 PM, "
369
"invite team@company.com, and set up a video call"
370
)
371
```
372
373
### Multi-Service Integration
374
375
```python
376
from google.adk.tools.bigquery import BigQueryToolset
377
from google.adk.tools.google_api_tool import SheetsToolset, GmailToolset
378
from google.adk.agents import Agent
379
380
# Configure multiple Google services
381
bq_toolset = BigQueryToolset(project_id="my-project")
382
sheets_toolset = SheetsToolset()
383
gmail_toolset = GmailToolset()
384
385
# Create comprehensive business assistant
386
business_agent = Agent(
387
name="business_assistant",
388
model="gemini-2.0-flash",
389
instruction="Help with business operations using Google services",
390
tools=[
391
*bq_toolset.get_tools(),
392
*sheets_toolset.get_tools(),
393
*gmail_toolset.get_tools()
394
]
395
)
396
397
# Complex business workflow
398
response = business_agent.run(
399
"Generate a sales report from BigQuery data, "
400
"create a summary in Google Sheets, "
401
"and email it to the sales team"
402
)
403
```
404
405
### Bigtable Usage
406
407
```python
408
from google.adk.tools.bigtable import BigtableToolset, BigtableCredentialsConfig
409
from google.adk.agents import Agent
410
411
# Configure Bigtable
412
credentials = BigtableCredentialsConfig(
413
service_account_path="/path/to/service-account.json"
414
)
415
416
bigtable_toolset = BigtableToolset(
417
project_id="my-project",
418
instance_id="my-instance",
419
credentials_config=credentials
420
)
421
422
# Create NoSQL data agent
423
nosql_agent = Agent(
424
name="nosql_assistant",
425
model="gemini-2.0-flash",
426
instruction="Help manage Bigtable data operations",
427
tools=bigtable_toolset.get_tools()
428
)
429
430
# Query Bigtable
431
response = nosql_agent.run(
432
"Retrieve user activity data for user ID 12345 from the last 30 days"
433
)
434
```
435
436
### YouTube API Integration
437
438
```python
439
from google.adk.tools.google_api_tool import YoutubeToolset
440
from google.adk.agents import Agent
441
442
# Configure YouTube toolset
443
youtube_toolset = YoutubeToolset(
444
credentials_config={
445
"api_key": "your-youtube-api-key"
446
}
447
)
448
449
# Create content manager agent
450
content_agent = Agent(
451
name="content_manager",
452
model="gemini-2.0-flash",
453
instruction="Help manage YouTube content and analytics",
454
tools=youtube_toolset.get_tools()
455
)
456
457
# Analyze channel performance
458
response = content_agent.run(
459
"Analyze the performance of my latest videos and suggest improvements"
460
)
461
```
462
463
### Custom Google API Integration
464
465
```python
466
from google.adk.tools.google_api_tool import GoogleApiToolset
467
from google.adk.agents import Agent
468
469
# Create custom Google API toolset
470
custom_api_toolset = GoogleApiToolset(
471
service_name="customsearch",
472
version="v1",
473
credentials_config={
474
"api_key": "your-api-key"
475
}
476
)
477
478
# Use with agent
479
search_agent = Agent(
480
name="custom_search_agent",
481
model="gemini-2.0-flash",
482
tools=custom_api_toolset.get_tools()
483
)
484
```