diff --git a/contributing/samples/skills_agent/agent.py b/contributing/samples/skills_agent/agent.py index 9caf0ad7..9232545a 100644 --- a/contributing/samples/skills_agent/agent.py +++ b/contributing/samples/skills_agent/agent.py @@ -17,6 +17,7 @@ import pathlib from google.adk import Agent +from google.adk.code_executors.unsafe_local_code_executor import UnsafeLocalCodeExecutor from google.adk.skills import load_skill_from_dir from google.adk.skills import models from google.adk.tools.skill_toolset import SkillToolset @@ -44,7 +45,12 @@ weather_skill = load_skill_from_dir( pathlib.Path(__file__).parent / "skills" / "weather-skill" ) -my_skill_toolset = SkillToolset(skills=[greeting_skill, weather_skill]) +# WARNING: UnsafeLocalCodeExecutor has security concerns and should NOT +# be used in production environments. +my_skill_toolset = SkillToolset( + skills=[greeting_skill, weather_skill], + code_executor=UnsafeLocalCodeExecutor(), +) root_agent = Agent( model="gemini-2.5-flash", diff --git a/contributing/samples/skills_agent/skills/weather-skill/SKILL.md b/contributing/samples/skills_agent/skills/weather-skill/SKILL.md index 67d87105..6893ef67 100644 --- a/contributing/samples/skills_agent/skills/weather-skill/SKILL.md +++ b/contributing/samples/skills_agent/skills/weather-skill/SKILL.md @@ -4,4 +4,5 @@ description: A skill that provides weather information based on reference data. --- Step 1: Check 'references/weather_info.md' for the current weather. -Step 2: Provide the weather update to the user. +Step 2: If humidity is requested, use run 'scripts/get_humidity.py' with the `location` argument. +Step 3: Provide the update to the user. diff --git a/contributing/samples/skills_agent/skills/weather-skill/scripts/get_humidity.py b/contributing/samples/skills_agent/skills/weather-skill/scripts/get_humidity.py new file mode 100644 index 00000000..a2e1dc47 --- /dev/null +++ b/contributing/samples/skills_agent/skills/weather-skill/scripts/get_humidity.py @@ -0,0 +1,29 @@ +# Copyright 2026 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import argparse + + +def get_humidity(location: str) -> str: + """Fetch live humidity for a given location. (Simulated)""" + print(f"Fetching live humidity for {location}...") + return "45% (Simulated)" + + +if __name__ == "__main__": + parser = argparse.ArgumentParser() + parser.add_argument("--location", type=str, default="Mountain View") + args = parser.parse_args() + + print(get_humidity(args.location))