Skip to content

Commit 8ad8bc9

Browse files
wukathcopybara-github
authored andcommitted
fix: Add a script to the sample skills agent
Added a get_humidity script to demo the new RunSkillScript tool Co-authored-by: Kathy Wu <wukathy@google.com> PiperOrigin-RevId: 875901416
1 parent 8a31612 commit 8ad8bc9

File tree

3 files changed

+38
-2
lines changed

3 files changed

+38
-2
lines changed

contributing/samples/skills_agent/agent.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import pathlib
1818

1919
from google.adk import Agent
20+
from google.adk.code_executors.unsafe_local_code_executor import UnsafeLocalCodeExecutor
2021
from google.adk.skills import load_skill_from_dir
2122
from google.adk.skills import models
2223
from google.adk.tools.skill_toolset import SkillToolset
@@ -44,7 +45,12 @@
4445
pathlib.Path(__file__).parent / "skills" / "weather-skill"
4546
)
4647

47-
my_skill_toolset = SkillToolset(skills=[greeting_skill, weather_skill])
48+
# WARNING: UnsafeLocalCodeExecutor has security concerns and should NOT
49+
# be used in production environments.
50+
my_skill_toolset = SkillToolset(
51+
skills=[greeting_skill, weather_skill],
52+
code_executor=UnsafeLocalCodeExecutor(),
53+
)
4854

4955
root_agent = Agent(
5056
model="gemini-2.5-flash",

contributing/samples/skills_agent/skills/weather-skill/SKILL.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ description: A skill that provides weather information based on reference data.
44
---
55

66
Step 1: Check 'references/weather_info.md' for the current weather.
7-
Step 2: Provide the weather update to the user.
7+
Step 2: If humidity is requested, use run 'scripts/get_humidity.py' with the `location` argument.
8+
Step 3: Provide the update to the user.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
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 argparse
16+
17+
18+
def get_humidity(location: str) -> str:
19+
"""Fetch live humidity for a given location. (Simulated)"""
20+
print(f"Fetching live humidity for {location}...")
21+
return "45% (Simulated)"
22+
23+
24+
if __name__ == "__main__":
25+
parser = argparse.ArgumentParser()
26+
parser.add_argument("--location", type=str, default="Mountain View")
27+
args = parser.parse_args()
28+
29+
print(get_humidity(args.location))

0 commit comments

Comments
 (0)