You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm building a two-step workflow with Google ADK where the first agent gathers a year from the user and produces three historical facts, and the second agent asks the user a quiz question about those facts and grades the answer. Both are LlmAgent instances with mode="task" and a Pydantic output_schema, wired together in a Workflow.
fromgoogle.adkimportAgent, WorkflowfrompydanticimportBaseModel, FieldclassHistory(BaseModel):
facts: list[str] =Field(description="The facts of the year.")
historian=Agent(
name="historian",
mode="task",
output_schema=History,
instruction="You're a history expert. ""Chat with the user, get a year, and present the top 3 facts.",
)
classAnswerResult(BaseModel):
answer: str=Field(description="The answer to the question.")
correct: bool=Field(description="Whether the answer was correct.")
questioner=Agent(
name="questioner",
mode="task",
input_schema=History,
output_schema=AnswerResult,
instruction="You're a history test setter. ""Ask the user a question about one of the facts, ""wait for the answer, then respond if it is correct.",
)
root_agent=Workflow(
name="root_agent",
edges=[("START", historian, questioner)],
)
What I expect: The historian gathers the year (or accepts one the user has already given), calls finish_task with the facts, then the questioner emits its question and waits for the user's answer before grading it via finish_task.
What actually happens: The historian works as expected — it returns a finish_task call with the facts. The questioner then generates the question as a plain text message... and the workflow immediately advances to END without ever waiting for the user to respond. The attached screenshot shows the graph reaching END right after the questioner emits the question, and the question is never followed by a finish_task call.
Inspecting the logs, the questioner's LLM response is plain text:
LLM Response:
Text: "Which industrial catastrophe occurred in India in 1984..."
Function calls: (none)
and the next log line is:
node root_agent@1/questioner@1 end.
Both agents receive the same auto-injected task-mode system instruction telling them to call finish_task when done, so the framework appears to consider both to be in task mode. But only the historian actually invokes finish_task — the questioner emits a text question instead, and the workflow node exits.
Why does task mode work for the first agent but not the second? Is it expected that a task-mode LlmAgent placed directly in workflow edges won't pause for user input between turns? If so, what's the right pattern to make the second agent ask a question and wait for the user's reply within a Workflow?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
I'm building a two-step workflow with Google ADK where the first agent gathers a year from the user and produces three historical facts, and the second agent asks the user a quiz question about those facts and grades the answer. Both are
LlmAgentinstances withmode="task"and a Pydanticoutput_schema, wired together in aWorkflow.What I expect: The historian gathers the year (or accepts one the user has already given), calls
finish_taskwith the facts, then the questioner emits its question and waits for the user's answer before grading it viafinish_task.What actually happens: The historian works as expected — it returns a
finish_taskcall with the facts. The questioner then generates the question as a plain text message... and the workflow immediately advances to END without ever waiting for the user to respond. The attached screenshot shows the graph reaching END right after the questioner emits the question, and the question is never followed by afinish_taskcall.Inspecting the logs, the questioner's LLM response is plain text:
and the next log line is:
Both agents receive the same auto-injected task-mode system instruction telling them to call
finish_taskwhen done, so the framework appears to consider both to be in task mode. But only the historian actually invokesfinish_task— the questioner emits a text question instead, and the workflow node exits.Why does task mode work for the first agent but not the second? Is it expected that a task-mode
LlmAgentplaced directly in workflow edges won't pause for user input between turns? If so, what's the right pattern to make the second agent ask a question and wait for the user's reply within aWorkflow?ADK version:
google-adk 2.0.0b1.Beta Was this translation helpful? Give feedback.
All reactions