-
Hello, I am following Tutorial ( https://google.github.io/adk-docs/get-started/tutorial/#step-5-adding-safety-input-guardrail-with-before_model_callback ) and I am not sure if I am encountering bug or if it's intended but following logs are generated using the provided code. This is the agent definition: weather_agent_team = Agent(
name="weather_agent_v5",
model=root_agent_model,
description="The main coordinator agent. Handles weather requests and delegates greetings/farewells to specialists.",
instruction="You are the main Weather Agent coordinating a team. Your primary responsibility is to provide weather information. "
"Use the 'get_weather' tool ONLY for specific weather requests (e.g., 'weather in London'). "
"You have specialized sub-agents: "
"1. 'greeting_agent': Handles simple greetings like 'Hi', 'Hello'. Delegate to it for these. "
"2. 'farewell_agent': Handles simple farewells like 'Bye', 'See you'. Delegate to it for these. "
"Analyze the user's query. If it's a greeting, delegate to 'greeting_agent'. If it's a farewell, delegate to 'farewell_agent'. "
"If it's a weather request, handle it yourself using 'get_weather'. "
"For anything else, respond appropriately or state you cannot handle it.",
tools=[
get_weather_stateful
],
sub_agents=[greeting_agent, farewell_agent],
output_key="last_weather_report",
before_model_callback=block_keyword_guardrail,
) Now these are the logs I get when testing callbacks:
What is the reason for callbacks not being triggered until I prompt the agent with a prompt that asks for the tool call? I am thinking that it had something to do with execution order and the fact that the Greeting agent itself doesn't have |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
It seems that you have only set the callback on |
Beta Was this translation helpful? Give feedback.
It seems that you have only set the callback on
weather_agent_team
agent, so it's not applied when other agents are replying. You will need to set the callback on all the agents you want it to apply.