Task sub-agent with a date/datetime/Decimal/UUID field in input_schema crashes the turn: validate_node_data dumps in python mode, to_user_content cannot json.dumps it
Les mainteneurs répondent en général sous 3 jours
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 1-2 jours
- Accessibilité débutants
- 48/100
Piste de recherche
Read google/adk/utils/_schema_utils.py at validate_node_data and trace how its result reaches run_llm_agent_as_node and google/adk/utils/content_utils.py at to_user_content. Reproduce with the supplied fake model and date schema; compare the serialization paths discussed in the issue. Done means task-mode delegation passes the date as "2026-10-17" and the parent turn completes, while accounting for the noted in-memory output compatibility concern.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Describe the Bug:
A task-mode sub-agent whose input_schema has a date, datetime, Decimal or UUID field fails every delegation. validate_node_data (google/adk/utils/_schema_utils.py) validates the call's arguments into the model and then dumps it with model_dump(exclude_none=True), which is Pydantic's python mode, so the dict keeps the datetime.date. run_llm_agent_as_node then hands that dict to to_user_content (google/adk/utils/content_utils.py), whose json.dumps(value, ensure_ascii=False) raises TypeError: Object of type date is not JSON serializable. The sub-agent node fails, and so does the parent's turn.
The model did nothing wrong here: it sent "2026-10-17", which is what a date field accepts.
This is the same python-mode dump as #6747. #6750 fixed it in d1e61e5 on 2026-10-01 and 731ea30 (same title, 23:05 UTC) reverted that evening, so main still has it (line 426 of _schema_utils.py today, and the same _to_serializable in validate_node_data in 2.14.1). #7480 (cause 2) and #7591 cover the sibling validate_schema, which AgentTool uses; neither touches validate_node_data, which is the path a task sub-agent takes.
Steps to Reproduce:
pip install google-adk==2.11.0(also reproduced on 2.14.1)- Run the script below. It needs no network or API key: the model is a fake.
import asyncio
import datetime
from google.adk.agents import LlmAgent
from google.adk.models import LlmResponse
from google.adk.models.base_llm import BaseLlm
from google.adk.runners import InMemoryRunner
from google.genai import types
from pydantic import BaseModel
class Request(BaseModel):
start: datetime.date
class Fake(BaseLlm):
model: str = "fake"
async def generate_content_async(self, llm_request, stream=False):
if "SUB" in str(llm_request.config.system_instruction):
call = types.FunctionCall(name="finish_task", args={})
else:
call = types.FunctionCall(name="sub", args={"start": "2026-10-17"})
yield LlmResponse(
content=types.Content(role="model", parts=[types.Part(function_call=call)])
)
async def main():
sub = LlmAgent(
name="sub",
model=Fake(),
mode="task",
instruction="SUB",
description="A helper.",
input_schema=Request,
)
root = LlmAgent(name="root", model=Fake(), instruction="ROOT", sub_agents=[sub])
runner = InMemoryRunner(agent=root, app_name="repro")
session = await runner.session_service.create_session(app_name="repro", user_id="u")
message = types.Content(role="user", parts=[types.Part(text="go")])
try:
async for _ in runner.run_async(
user_id="u", session_id=session.id, new_message=message
):
pass
print("turn completed")
except Exception as exc:
print(f"turn failed: {type(exc).__name__}: {exc}")
asyncio.run(main())
Expected Behavior:
The sub-agent receives its input, with the date as "2026-10-17", and the turn completes (turn completed).
Observed Behavior:
turn failed: TypeError: Object of type date is not JSON serializable
The traceback ends in to_user_content (content_utils.py, json.dumps), reached from run_llm_agent_as_node.
Environment Details:
- ADK Library Version: 2.11.0, and 2.14.1 (same code in
validate_node_data) - Python Version: 3.12
- Are you using LiteLLM: No (fake model)
Possible fix:
Either dump with mode="json" in validate_node_data._to_serializable, as #6750 did (its commit message flags it as a breaking change for in-memory node outputs, which may be why it was reverted), or leave validate_node_data alone and make to_user_content serialize what it is given the way Pydantic does (for example pydantic_core.to_json, or json.dumps(..., default=...)), since that is the one place the value has to be JSON.
How often has this issue occurred?:
- Always (100%)
- Langage dominant
- Python
- Étoiles
- 22.3k
- Forks
- 4.4k
- Merge moyen
- 1 j 2 h
- PR mergées (30 j)
- 6
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de google/adk-python
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
google/adk-python#8360 ·
Les mainteneurs répondent en général sous 3 jours
-
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
google/adk-python#8359 ·
Les mainteneurs répondent en général sous 3 jours
-
Can pin to litellm version be changed?Peut-être pris @llalitkumarrr l’a pris il y a 10 jours. Ouvertemodels
Difficulté 1/5 Moins d'une heure Accessibilité débutants 65/100
google/adk-python#8129 · 2 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
OpenAPI tools ignore operation- and path-level server overridesPeut-être pris @sanketpatil06 l’a pris il y a 14 jours. Ouvertetools
Difficulté 2/5 1-3 heures Accessibilité débutants 75/100
google/adk-python#8064 · 4 commentaires · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
-
Two docstrings in openapi_tool document parameters the signatures do not acceptPeut-être pris @surajksharma07 l’a pris il y a 17 jours. Ouverte
Difficulté 1/5 Moins d'une heure Accessibilité débutants 88/100
google/adk-python#8024 · 1 commentaire · 1 personne assignée ·
Les mainteneurs répondent en général sous 3 jours
Toutes les issues de google/adk-python
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
vllm-project/vllm#70030 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
TigreGotico/tugaphone#408 ·
Les mainteneurs répondent en général sous 1 jour
-
needs-triage
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
gke-labs/kube-agents#7308 ·
Les mainteneurs répondent en général sous 1 jour
-
t: bug
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
Les mainteneurs répondent en général sous 3 jours
-
chore
Difficulté 1/5 1-3 heures Accessibilité débutants 88/100
lugassawan/swe-workbench#841 ·