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
{{ message }}
Repository navigation
LlmAgent(mode="task") with a raw dict output_schema fails at construction with SchemaError: Unknown schema type: "object" #7935
Describe the Bug: SchemaType documents raw dict schemas as supported for output_schema, and an LlmAgent with a dict output_schema builds in the default mode and in mode="single_turn". With mode="task", construction fails: FinishTaskTool builds TypeAdapter(self.output_schema), and pydantic reads the dict as one of its own core schemas, so {"type": "object", ...} raises SchemaError and {} raises KeyError: 'type'. A pydantic model or list[str] works.
Steps to Reproduce:
pip install google-adk==2.13.0
Run the script below.
Expected Behavior:
The task-mode agent builds, as it does with a pydantic model, and its finish tool validates against the JSON schema (or accepts the result without validation).
Additional Context:
The same kind of failure for a dict output_schema was fixed in SetModelResponseTool (#5469); agents/llm/task/_finish_task_tool.py still passes the dict to TypeAdapter.
Hi! I was able to reproduce this locally on ADK 2.13.0. In FinishTaskTool.__init__, self.output_schema is passed directly to TypeAdapter, which causes Pydantic to misinterpret a raw JSON schema dictionary as a core schema and fail with SchemaError.
I'd like to work on this and submit a PR with regression tests, following the precedent established in SetModelResponseTool (#5516). Could you please assign this to me?
We were able to reproduce this issue, and we have also tested the linked PR which should resolve it. Could you please review the suggested changes and share your feedback?
Thanks for reproducing and testing it. I reviewed the diff of #7937 against the report, and it fixes the case I reported: the task-mode agent now builds with a dict output_schema, the declaration carries the schema unchanged (deep-copied, so the caller's dict is not mutated), and accepting the result without validation matches how validate_node_data treats dict schemas.
Activity
mohitdixit02 commentedon Nov 2, 2026
Hi! I was able to reproduce this locally on ADK 2.13.0. In
FinishTaskTool.__init__,self.output_schemais passed directly toTypeAdapter, which causes Pydantic to misinterpret a raw JSON schema dictionary as a core schema and fail withSchemaError.I'd like to work on this and submit a PR with regression tests, following the precedent established in
SetModelResponseTool(#5516). Could you please assign this to me?llalitkumarrr commentedon Nov 5, 2026
Hello @yifanxiong272,
We were able to reproduce this issue, and we have also tested the linked PR which should resolve it. Could you please review the suggested changes and share your feedback?
yifanxiong272 commentedon Nov 5, 2026
Thanks for reproducing and testing it. I reviewed the diff of #7937 against the report, and it fixes the case I reported: the task-mode agent now builds with a dict output_schema, the declaration carries the schema unchanged (deep-copied, so the caller's dict is not mutated), and accepting the result without validation matches how validate_node_data treats dict schemas.