Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Last active June 17, 2025 23:01
Show Gist options
  • Save kuc-arc-f/1a70d0d164aa7150e68b193856886d9d to your computer and use it in GitHub Desktop.
Save kuc-arc-f/1a70d0d164aa7150e68b193856886d9d to your computer and use it in GitHub Desktop.
tool_sample_agent , Agent Development Kit example
GOOGLE_GENAI_USE_VERTEXAI=FALSE
GOOGLE_API_KEY="key"
from . import agent
import datetime
import random
from google.adk.agents import Agent
# get_random_number
# Returns a random number between 1 and 6
def get_random_number() -> str:
"""Returns a random number between 1 and 6.
Returns:
dict: status and result with random number.
"""
random_num = random.randint(1, 6)
return f"ランダムな数字: {random_num}"
# get_now_date
# Returns the current date in YYYY-MM-DD format
def get_now_date() -> str:
"""Returns the current date in YYYY-MM-DD format.
Returns:
dict: status and result with current date.
"""
current_date = datetime.datetime.now().strftime("%Y-%m-%d")
return f"今日の日付: {current_date}"
root_agent = Agent(
name="tool_sample_agent",
model="gemini-2.0-flash",
description=(
"Agent that provides random numbers and current date information."
),
instruction=(
"You are a helpful agent who can generate random numbers between 1 and 6, and provide the current date."
),
tools=[get_random_number, get_now_date],
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment