-
-
Save kuc-arc-f/1a70d0d164aa7150e68b193856886d9d to your computer and use it in GitHub Desktop.
tool_sample_agent , Agent Development Kit example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
GOOGLE_GENAI_USE_VERTEXAI=FALSE | |
GOOGLE_API_KEY="key" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from . import agent |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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