fix(adk-middleware): Validate PR #1332 - #1379
Closed
contextablemark wants to merge 3 commits into
Closed
Conversation
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
```
…alization 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.
Conflicts in event_translator.py and test_lro_sse_id_remap.py due to PR #1334 renaming long_running_function_call to fc and adding a parallel LRO test. Resolution keeps both the serialize_tool_args fix (PR #1332) and the parallel LRO changes from main. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
Python Preview PackagesVersion
Install with uvAdd the TestPyPI index to your [[tool.uv.index]]
name = "testpypi"
url = "https://test.pypi.org/simple/"
explicit = trueThen install the packages you need: # Core SDK
uv add 'ag-ui-protocol==0.0.0.dev1774563134' --index testpypi
# Integrations (each already depends on the matching ag-ui-protocol preview)
uv add 'ag-ui-langgraph==0.0.0.dev1774563134' --index testpypi
uv add 'ag-ui-crewai==0.0.0.dev1774563134' --index testpypi
# NOTE: ag-ui-agent-spec depends on pyagentspec (git-only, not on PyPI).
# You will need to install pyagentspec separately from its git repo.
uv add 'ag-ui-agent-spec==0.0.0.dev1774563134' --index testpypi
uv add 'ag_ui_adk==0.0.0.dev1774563134' --index testpypi
uv add 'ag_ui_strands==0.0.0.dev1774563134' --index testpypiInstall with pippip install \
--index-url https://test.pypi.org/simple/ \
--extra-index-url https://pypi.org/simple/ \
ag-ui-protocol==0.0.0.dev1774563134
Commit: 960faf3 |
@ag-ui/a2a-middleware
@ag-ui/a2ui-middleware
@ag-ui/mcp-apps-middleware
@ag-ui/middleware-starter
@ag-ui/a2a
@ag-ui/adk
@ag-ui/ag2
@ag-ui/agno
@ag-ui/aws-strands
@ag-ui/claude-agent-sdk
@ag-ui/crewai
@ag-ui/langchain
@ag-ui/langgraph
@ag-ui/langroid
@ag-ui/llamaindex
@ag-ui/mastra
@ag-ui/pydantic-ai
@ag-ui/server-starter
@ag-ui/server-starter-all-features
@ag-ui/vercel-ai-sdk
create-ag-ui-app
@ag-ui/client
@ag-ui/core
@ag-ui/encoder
@ag-ui/proto
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
adk_request_credentialcausesTypeError: Object of type SecuritySchemeType is not JSON serializable#1331 —adk_request_credentialwith OAuth2AuthConfigcausesTypeError: Object of type SecuritySchemeType is not JSON serializableserialize_tool_args()helper using Pydantic'sTypeAdapterinstead ofjson.dumps, which handles Pydantic models and Python Enums nativelyjson.dumpswas used on tool args:translate_lro_function_calls,_translate_function_calls,_translate_function_calls_to_tool_calls,_execute_proxy_tool, andconvert_adk_event_to_ag_ui_messageAuthConfig/OAuth2/SecuritySchemeTypeobjectsTest plan
GOOGLE_API_KEY)test_serialization.pycovers plain dicts, enums, Pydantic models, nested enums, non-dict passthrough, empty dicttest_lro_adk_request_credential_oauth2regression test reproduces the exact failure from [Bug]: ADKadk_request_credentialcausesTypeError: Object of type SecuritySchemeType is not JSON serializable#1331🤖 Generated with Claude Code
Credit: original fix by @joar in #1332