Skip to content

fix(eval): serialize non-json-native tool args when simulating - #1832

Merged
radu-mocanu merged 1 commit into
mainfrom
fix/mocker-uuid-serialization
Jul 28, 2026
Merged

fix(eval): serialize non-json-native tool args when simulating#1832
radu-mocanu merged 1 commit into
mainfrom
fix/mocker-uuid-serialization

Conversation

@radu-mocanu

Copy link
Copy Markdown
Collaborator

Summary

  • a simulated tool call no longer fails when a tool argument is not json-native (uuid.UUID, datetime, Enum, set)
  • applies to both simulation paths: the LLMMocker prompt and the simulate-component payload

Why

tool args_schema models can type a field as any python type, and langchain hands the tool the validated value, so the mocker receives real objects rather than the strings the model emitted. both paths encoded that with a bare json.dumps, which raised TypeError: Object of type UUID is not JSON serializable and surfaced verbatim as the tool's output. the IXP extraction tool types its attachment id as uuid.UUID, so every simulated call to it failed before the simulating LLM was even reached.

serialization now goes through the existing helpers in uipath.core.serialization, so payloads that already encoded cleanly are unchanged.

Copilot AI review requested due to automatic review settings July 28, 2026 13:35
@github-actions github-actions Bot added test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime test:uipath-integrations labels Jul 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes simulation-time failures when tool-call arguments include non-JSON-native Python objects by routing serialization through shared helpers in uipath.core.serialization, and adds regression tests to cover the simulation paths.

Changes:

  • Use serialize_defaults as the json.dumps(..., default=...) handler when building the LLMMocker prompt.
  • Normalize the simulate-component request payload before passing it to httpx’s json= encoding.
  • Add tests covering UUID and other non-JSON-native tool args, and bump package version to 2.13.17.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
packages/uipath/src/uipath/eval/mocks/_llm_mocker.py Uses serialize_defaults to ensure prompt JSON encoding doesn’t fail on validated Python objects (UUID/datetime/Enum/etc.).
packages/uipath/src/uipath/eval/mocks/_simulate_component_service.py Normalizes simulate-component payload prior to httpx JSON encoding (but see review comments re: serialize_object coverage).
packages/uipath/tests/cli/eval/mocks/test_mocker_arg_serialization.py Adds regression tests for tool-arg serialization across both simulation paths.
packages/uipath/pyproject.toml Bumps package version to 2.13.17.
packages/uipath/uv.lock Updates lockfile entry for the uipath package version bump.
Comments suppressed due to low confidence (1)

packages/uipath/src/uipath/eval/mocks/_simulate_component_service.py:32

  • Even after calling serialize_object(payload), set/Enum values can remain non-serializable. Passing a JSON-native object to httpx is safest by converting with serialize_json() and parsing back to a dict/list tree.
            json=serialize_object(payload),

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread packages/uipath/tests/cli/eval/mocks/test_mocker_arg_serialization.py Outdated
@radu-mocanu
radu-mocanu force-pushed the fix/mocker-uuid-serialization branch from 4263ab5 to dfc82e1 Compare July 28, 2026 13:43
@radu-mocanu
radu-mocanu force-pushed the fix/mocker-uuid-serialization branch from dfc82e1 to 66b42fe Compare July 28, 2026 13:58
@radu-mocanu
radu-mocanu force-pushed the fix/mocker-uuid-serialization branch from 66b42fe to 600f190 Compare July 28, 2026 13:59
@sonarqubecloud

Copy link
Copy Markdown

@radu-mocanu
radu-mocanu merged commit 49b881d into main Jul 28, 2026
172 of 173 checks passed
@radu-mocanu
radu-mocanu deleted the fix/mocker-uuid-serialization branch July 28, 2026 14:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

test:uipath-integrations test:uipath-langchain Triggers tests in the uipath-langchain-python repository test:uipath-runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants