Skip to content

Commit 345e478

Browse files
authored
Merge branch 'main' into motill/durable-support
2 parents 8234af3 + 2e370ea commit 345e478

11 files changed

Lines changed: 575 additions & 38 deletions

File tree

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: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
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+
"""Example agent demonstrating the use of SkillToolset with GCS.
16+
17+
Go to parent directory and run with `adk web --host=0.0.0.0`.
18+
"""
19+
20+
import asyncio
21+
import logging
22+
23+
from google.adk import Agent
24+
from google.adk import Runner
25+
from google.adk.plugins import LoggingPlugin
26+
from google.adk.skills import list_skills_in_gcs_dir
27+
from google.adk.skills import load_skill_from_gcs_dir
28+
from google.adk.tools.skill_toolset import SkillToolset
29+
30+
# Define the GCS bucket and skills prefix
31+
BUCKET_NAME = "sample-skills"
32+
SKILLS_PREFIX = "static-skills"
33+
34+
logging.info("Loading skills from gs://%s/%s...", BUCKET_NAME, SKILLS_PREFIX)
35+
36+
# List and load skills from GCS
37+
skills = []
38+
try:
39+
available_skills = list_skills_in_gcs_dir(
40+
bucket_name=BUCKET_NAME, skills_base_path=SKILLS_PREFIX
41+
)
42+
for skill_id in available_skills.keys():
43+
skills.append(
44+
load_skill_from_gcs_dir(
45+
bucket_name=BUCKET_NAME,
46+
skills_base_path=SKILLS_PREFIX,
47+
skill_id=skill_id,
48+
)
49+
)
50+
logging.info("Loaded %d skills successfully.", len(skills))
51+
except Exception as e: # pylint: disable=broad-exception-caught
52+
logging.error("Failed to load skills from GCS: %s", e)
53+
54+
# Create the SkillToolset
55+
my_skill_toolset = SkillToolset(skills=skills)
56+
57+
# Create the Agent
58+
root_agent = Agent(
59+
model="gemini-3-flash-preview",
60+
name="skill_user_agent",
61+
description="An agent that can use specialized skills loaded from GCS.",
62+
tools=[
63+
my_skill_toolset,
64+
],
65+
)
66+
67+
68+
async def main():
69+
# Initialize the plugins
70+
logging_plugin = LoggingPlugin()
71+
72+
# Create a Runner
73+
runner = Runner(
74+
agents=[root_agent],
75+
plugins=[logging_plugin],
76+
)
77+
78+
# Example run
79+
print("Agent initialized with GCS skills. Sending a test prompt...")
80+
# You can replace this with an interactive loop if needed.
81+
responses = await runner.run(
82+
user_input="Hello! What skills do you have access to?"
83+
)
84+
85+
if responses and responses[-1].content and responses[-1].content.parts:
86+
print(f"\nResponse: {responses[-1].content.parts[0].text}")
87+
88+
89+
if __name__ == "__main__":
90+
asyncio.run(main())

contributing/samples/toolbox_agent/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,14 @@ Before starting, ensure you have Python installed on your system.
1212

1313
### 1. Install Toolbox
1414

15-
Run the following command to download and install the toolbox:
15+
Run the following command to download and install the MCP Toolbox binary.
16+
17+
> [!NOTE]
18+
> You can find the latest version on the [Releases page](https://github.com/googleapis/genai-toolbox/releases) and update the version in the URL below.
1619
1720
```bash
1821
export OS="linux/amd64" # one of linux/amd64, darwin/arm64, darwin/amd64, or windows/amd64
19-
curl -O https://storage.googleapis.com/genai-toolbox/v0.5.0/$OS/toolbox
22+
curl -O https://storage.googleapis.com/genai-toolbox/v0.28.0/$OS/toolbox
2023
chmod +x toolbox
2124
```
2225

contributing/samples/toolbox_agent/agent.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,18 @@
1313
# limitations under the License.
1414

1515
from google.adk.agents.llm_agent import Agent
16+
from google.adk.apps import App
1617
from google.adk.tools.toolbox_toolset import ToolboxToolset
1718

1819
root_agent = Agent(
19-
model="gemini-2.0-flash",
20+
model="gemini-2.5-flash",
2021
name="root_agent",
2122
instruction="You are a helpful assistant",
2223
# Add Toolbox tools to ADK agent
23-
tools=[
24-
ToolboxToolset(
25-
server_url="http://127.0.0.1:5000", toolset_name="my-toolset"
26-
)
27-
],
24+
tools=[ToolboxToolset(server_url="http://127.0.0.1:5000")],
25+
)
26+
27+
app = App(
28+
root_agent=root_agent,
29+
name="app",
2830
)

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,12 +164,12 @@ extensions = [
164164
"llama-index-embeddings-google-genai>=0.3.0", # For files retrieval using LlamaIndex.
165165
"lxml>=5.3.0", # For load_web_page tool.
166166
"pypika>=0.50.0", # For crewai->chromadb dependency
167-
"toolbox-adk>=0.5.7, <0.6.0", # For tools.toolbox_toolset.ToolboxToolset
167+
"toolbox-adk>=0.7.0, <0.8.0", # For tools.toolbox_toolset.ToolboxToolset
168168
]
169169

170170
otel-gcp = ["opentelemetry-instrumentation-google-genai>=0.6b0, <1.0.0"]
171171

172-
toolbox = ["toolbox-adk>=0.5.7, <0.6.0"]
172+
toolbox = ["toolbox-adk>=0.7.0, <0.8.0"]
173173

174174
[tool.pyink]
175175
# Format py files following Google style-guide

src/google/adk/skills/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
from typing import Any
1818
import warnings
1919

20+
from ._utils import _list_skills_in_gcs_dir as list_skills_in_gcs_dir
2021
from ._utils import _load_skill_from_dir as load_skill_from_dir
22+
from ._utils import _load_skill_from_gcs_dir as load_skill_from_gcs_dir
2123
from .models import Frontmatter
2224
from .models import Resources
2325
from .models import Script
@@ -29,7 +31,9 @@
2931
"Resources",
3032
"Script",
3133
"Skill",
34+
"list_skills_in_gcs_dir",
3235
"load_skill_from_dir",
36+
"load_skill_from_gcs_dir",
3337
]
3438

3539

0 commit comments

Comments
 (0)