Commit 16e559e
* Validate 1332 (#1380)
* fix(adk-middleware): "SecuritySchemeType is not JSON serializable"
this solves the issue of the built-in `adk_request_credentials` function call failing with
```
Traceback (most recent call last):
File "/Users/joar.wandborg/git/myproject/.venv/lib/python3.14/site-packages/ag_ui_adk/adk_agent.py", line 2132, in _run_adk_in_background
async for ag_ui_event in event_translator.translate_lro_function_calls(
...<5 lines>...
logger.debug(f"Event queued: {type(ag_ui_event).__name__} (thread {input.thread_id}, queue size after: {event_queue.qsize()})")
File "/Users/joar.wandborg/git/myproject/.venv/lib/python3.14/site-packages/ag_ui_adk/event_translator.py", line 763, in translate_lro_function_calls
args_str = json.dumps(long_running_function_call.args) if isinstance(long_running_function_call.args, dict) else str(long_running_function_call.args)
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/joar.wandborg/.local/share/uv/python/cpython-3.14.3-macos-aarch64-none/lib/python3.14/json/__init__.py", line 235, in dumps
return _default_encoder.encode(obj)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^
File "/Users/joar.wandborg/.local/share/uv/python/cpython-3.14.3-macos-aarch64-none/lib/python3.14/json/encoder.py", line 202, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/Users/joar.wandborg/.local/share/uv/python/cpython-3.14.3-macos-aarch64-none/lib/python3.14/json/encoder.py", line 263, in iterencode
return _iterencode(o, 0)
File "/Users/joar.wandborg/.local/share/uv/python/cpython-3.14.3-macos-aarch64-none/lib/python3.14/json/encoder.py", line 182, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
f'is not JSON serializable')
TypeError: Object of type SecuritySchemeType is not JSON serializable
```
* refactor(adk-middleware): introduce serialize_tool_args for JSON serialization
Added a new utility function `serialize_tool_args` to handle JSON serialization of tool-call arguments, addressing issues with non-standard types like Pydantic models and Enums. Updated relevant code in `client_proxy_tool`, `event_translator`, and `converters` to utilize this new function, ensuring consistent serialization across the application. Added comprehensive tests for the new serialization functionality.
---------
Co-authored-by: Joar Wandborg <joar@wandborg.se>
* docs(adk-middleware): add changelog entry for #1331 serialization fix
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
---------
Co-authored-by: Joar Wandborg <joar@wandborg.se>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e07e85b commit 16e559e
1 file changed
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
32 | 37 | | |
33 | 38 | | |
34 | 39 | | |
| |||
0 commit comments