File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2626 comedian.py # ex: Comedian agent implementation
2727 tools/
2828 get_current_datetime.py # ex: Date/time utility tool
29+ skills/
30+ greeting-skill/ # ex: Greeting skill (file-based ADK Skill)
31+ SKILL.md
32+ references/
33+ greeting_templates.md
34+ datetime-skill/ # ex: Datetime skill (file-based ADK Skill)
35+ SKILL.md
36+ references/
37+ default_timezones.md
2938scripts/
3039 deploy.sh # Helper script to deploy to Cloud Run
3140Dockerfile # Container definition for Cloud Run
Original file line number Diff line number Diff line change 11import os
22import json
3+ import pathlib
34import re
45import uuid
56from typing import List
1415from google .adk .agents import Agent
1516from google .adk .events .event import Event
1617from google .adk .runners import InMemoryRunner
18+ from google .adk .skills import load_skill_from_dir
19+ from google .adk .tools .skill_toolset import SkillToolset
1720# from google.adk.tools import google_search
1821
1922from .agents .comedian import comedian_agent
@@ -144,6 +147,16 @@ async def _populate_session_from_thread(
144147 await session_service .append_event (session = session , event = event_obj )
145148
146149
150+ # Load skills from directory
151+ _skills_dir = pathlib .Path (__file__ ).parent / "skills"
152+ greeting_skill = load_skill_from_dir (_skills_dir / "greeting-skill" )
153+ datetime_skill = load_skill_from_dir (_skills_dir / "datetime-skill" )
154+
155+ skill_toolset = SkillToolset (
156+ skills = [greeting_skill , datetime_skill ],
157+ additional_tools = [get_current_datetime ],
158+ )
159+
147160root_agent = Agent (
148161 name = "slack_bot_agent" ,
149162 model = MODEL_NAME ,
@@ -168,7 +181,7 @@ async def _populate_session_from_thread(
168181
169182Always structure your response clearly, using these rules so it renders correctly in Slack.""" ,
170183 tools = [
171- get_current_datetime ,
184+ skill_toolset ,
172185 ],
173186 sub_agents = [
174187 comedian_agent ,
Original file line number Diff line number Diff line change 1+ ---
2+ name : datetime-skill
3+ description : A skill that provides current date and time information for any timezone using the get_current_datetime tool.
4+ metadata :
5+ adk_additional_tools :
6+ - get_current_datetime
7+ ---
8+
9+ Step 1: Identify the timezone the user is asking about. If no timezone is specified, check 'references/default_timezones.md' for common defaults.
10+ Step 2: Use the ` get_current_datetime ` tool with the appropriate timezone identifier (e.g., "Asia/Tokyo", "America/New_York").
11+ Step 3: Format the result clearly for the user, including the timezone name and the current date/time.
Original file line number Diff line number Diff line change 1+ # Default Timezone Reference
2+
3+ ## Common Timezone Mappings
4+ - Japan / Tokyo: Asia/Tokyo
5+ - US East / New York: America/New_York
6+ - US West / Los Angeles / San Francisco: America/Los_Angeles
7+ - US Central / Chicago: America/Chicago
8+ - UK / London: Europe/London
9+ - Central Europe / Paris / Berlin: Europe/Paris
10+ - India / Mumbai: Asia/Kolkata
11+ - China / Beijing / Shanghai: Asia/Shanghai
12+ - Australia / Sydney: Australia/Sydney
13+ - Brazil / São Paulo: America/Sao_Paulo
14+
15+ ## Default Behavior
16+ If the user does not specify a timezone, default to "Asia/Tokyo" as the primary user base is in Japan.
Original file line number Diff line number Diff line change 1+ ---
2+ name : greeting-skill
3+ description : A friendly greeting skill that welcomes users and provides helpful onboarding information about the Slack bot.
4+ ---
5+
6+ Step 1: Read the 'references/greeting_templates.md' file to understand available greeting styles.
7+ Step 2: Identify the user's name from the ` [Speaker: <name>] ` tag in the message.
8+ Step 3: Return a warm, personalized greeting based on the reference, using the user's name.
9+ Step 4: Briefly mention key capabilities the bot offers (humor via comedian, current datetime lookup).
Original file line number Diff line number Diff line change 1+ # Greeting Templates
2+
3+ ## Standard Greeting
4+ Hello, {name}! I'm your Slack Bot assistant. How can I help you today?
5+
6+ ## Capabilities Introduction
7+ Here's what I can do:
8+ - Answer questions and have conversations
9+ - Tell jokes and bring humor (via the comedian skill)
10+ - Look up the current date and time in any timezone
11+
12+ ## Tips
13+ - Mention me in a thread to continue a conversation
14+ - Ask me to be funny if you want a laugh
15+ - Ask me what time it is in any city or timezone
You can’t perform that action at this time.
0 commit comments