Zhuoxi2000 opened a new issue, #1500:
URL: https://github.com/apache/flink-agents/issues/1500

   ### Search before asking
   
   - [x] I searched in the 
[issues](https://github.com/apache/flink-agents/issues) and found nothing 
similar.
   
   ### Description
   
   When a Python sub-agent returns a dict or a list, the tool message handed 
back to the model has every non-ASCII character escaped as `\uXXXX`.
   
   `to_chat_message_content` in 
`python/flink_agents/plan/actions/tool_result_utils.py` calls `json.dumps` 
without `ensure_ascii=False`, and `SubagentTool.call_async` uses it to build 
the tool message.
   
   Expected: `{"city": "北京"}` is rendered as `{"city":"北京"}`. That is what 
Java's `ToolResultUtils.toChatMessageContent` produces, and what 
`to_tool_response` in the same Python file does for ordinary tool returns.
   
   Actual: the Python side renders `{"city":"北京"}`. A string result is passed 
through unescaped, so the same text reaches the model in two forms depending on 
the result's shape.
   
   ### How to reproduce
   
   ```python
   from flink_agents.plan.actions.tool_result_utils import 
to_chat_message_content
   
   assert to_chat_message_content({"city": "北京"}) == '{"city":"北京"}'
   # AssertionError: '{"city":"\\u5317\\u4eac"}' == '{"city":"北京"}'
   ```
   
   ### Version and environment
   
   main at b3eb6ff0, Java 17 / Python 3.11, macOS
   
   ### Are you willing to submit a PR?
   
   - [x] I'm willing to submit a PR!
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to