diff --git a/src/uipath_langchain/agent/tools/static_args.py b/src/uipath_langchain/agent/tools/static_args.py index 923ad52e..41a8953a 100644 --- a/src/uipath_langchain/agent/tools/static_args.py +++ b/src/uipath_langchain/agent/tools/static_args.py @@ -236,7 +236,7 @@ def apply_static_args( # The array is empty. Updating it with jsonpath will leave it empty. # We instead replace the empty array with a single static value array_expr.update_or_create(sanitized_args, [value]) - return sanitized_args + continue expr.update_or_create(sanitized_args, value) diff --git a/tests/agent/tools/test_static_args.py b/tests/agent/tools/test_static_args.py index bd3f7e9a..003053ff 100644 --- a/tests/agent/tools/test_static_args.py +++ b/tests/agent/tools/test_static_args.py @@ -346,6 +346,24 @@ def test_apply_static_args_to_empty_array_replaces_with_static_value(self): result = apply_static_args(static_args, kwargs) assert result == {"files": [{"id": "uuid-123"}]} + def test_apply_static_args_empty_array_does_not_skip_other_args(self): + """Test empty array handling does not skip applying other static args.""" + static_args = { + "$['files'][*]": {"id": "uuid-123"}, + "meta.source": "static-source", + } + kwargs: dict[str, Any] = { + "files": [], + "meta": {"source": "dynamic"}, + } + + result = apply_static_args(static_args, kwargs) + + assert result == { + "files": [{"id": "uuid-123"}], + "meta": {"source": "static-source"}, + } + def test_apply_static_args_nested_property_in_array_element(self): """Test applying static args to nested property in array element - should replace property on every object.""" static_args = {"users[*].profile.verified": True}