Skip to content

Throw err when work with ag-ui-adk #5026

@tiyee

Description

@tiyee

🔴 Required Information

The latest version, both v1 and v2-alp

Describe the Bug:
{
"type": "RUN_ERROR",
"message": "Event encoding failed: Unable to serialize unknown type: <class 'google.adk.tools.function_tool.FunctionTool'>",
"code": "ENCODING_ERROR"
}

full trackback:

{
  "textPayload": "❌ Event encoding error: Unable to serialize unknown type: <class 'google.adk.tools.function_tool.FunctionTool'>\nTraceback (most recent call last):\n  File \"/layers/google.python.uv/uv-dependencies/.venv/lib/python3.13/site-packages/ag_ui_adk/endpoint.py\", line 148, in event_generator\n    encoded = encoder.encode(event)\n  File \"/layers/google.python.uv/uv-dependencies/.venv/lib/python3.13/site-packages/ag_ui/encoder/encoder.py\", line 26, in encode\n    return self._encode_sse(event)\n           ~~~~~~~~~~~~~~~~^^^^^^^\n  File \"/layers/google.python.uv/uv-dependencies/.venv/lib/python3.13/site-packages/ag_ui/encoder/encoder.py\", line 32, in _encode_sse\n    return f\"data: {event.model_dump_json(by_alias=True, exclude_none=True)}\\n\\n\"\n                    ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/layers/google.python.uv/uv-dependencies/.venv/lib/python3.13/site-packages/pydantic/main.py\", line 528, in model_dump_json\n    return self.__pydantic_serializer__.to_json(\n           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^\n        self,\n        ^^^^^\n    ...<13 lines>...\n        serialize_as_any=serialize_as_any,\n        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n    ).decode()\n    ^\npydantic_core._pydantic_core.PydanticSerializationError: Unable to serialize unknown type: <class 'google.adk.tools.function_tool.FunctionTool'>",
  "insertId": "xxxxxxxxx",
  "httpRequest": {},
  "resource": {
    "type": "cloud_run_revision",
    "labels": {
      "location": "us-central1",
      "revision_name": "xxxxxxxxxxxxxx",
      "configuration_name": "xxxxxxxxxxxx",
      "project_id": "xxxxxxxxxxxx",
      "service_name": "xxxxxx"
    }
  },
  "timestamp": "2026-03-27T11:28:33.823288Z",
  "severity": "ERROR",
  "labels": {
    "python_logger": "ag_ui_adk.endpoint",
    "instanceId": "008c15ff08665ddd84585a93dad34184dcaadd76cb011a55dbd282d83de55894dfb8d8f27a44206112e4dc07ae385b6b7a9da0d50666b961db465929b6d4225180ee528808a26f939062402ae5"
  },
  "logName": "projects/xxxxxxxxxxxxxxxxxx/logs/run.googleapis.com%2Fstderr",
  "sourceLocation": {
    "file": "/layers/google.python.uv/uv-dependencies/.venv/lib/python3.13/site-packages/ag_ui_adk/endpoint.py",
    "line": "153",
    "function": "event_generator"
  },
  "receiveTimestamp": "2026-03-27T11:28:33.986197905Z",
  "errorGroups": [
    {
      "id": "xxxxxxxxxxxxxxxxxxxx"
    }
  ]
}

Steps to Reproduce:
Please provide a numbered list of steps to reproduce the behavior:

  1. Install '...'
  2. Run '....'
  3. Open '....'
  4. Provide error or stacktrace

Expected Behavior:
A clear and concise description of what you expected to happen.

Observed Behavior:
What actually happened? Include error messages or crash stack traces here.

Environment Details:

  • ADK Library Version (pip show google-adk):
  • Desktop OS:** [e.g., macOS, Linux, Windows]
  • Python Version (python -V):

Model Information:

  • Are you using LiteLLM: Yes/No
  • Which model is being used: (e.g., gemini-2.5-pro)

🟡 Optional Information

Providing this information greatly speeds up the resolution process.

Regression:
Did this work in a previous version of ADK? If so, which one?

Logs:
Please attach relevant logs. Wrap them in code blocks (```) or attach a
text file.

// Paste logs here

Screenshots / Video:
If applicable, add screenshots or screen recordings to help explain
your problem.

Additional Context:
Add any other context about the problem here.

Minimal Reproduction Code:
Please provide a code snippet or a link to a Gist/repo that isolates the issue.

// Code snippet here

How often has this issue occurred?:

  • Always (100%)
  • Often (50%+)
  • Intermittently (<50%)
  • Once / Rare

Metadata

Metadata

Assignees

No one assigned

    Labels

    web[Component] This issue will be transferred to adk-web

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions