joeyutong opened a new pull request, #1074: URL: https://github.com/apache/flink-agents/pull/1074
Linked issue: #956 ### Purpose of change Java can distinguish whether a Tool invocation returned from whether the returned `ToolResponse` represents a successful Tool operation. Python previously exposed only raw return values, so every normal return was recorded as a successful Tool operation. This change aligns the Java and Python Tool outcome contracts: - adds Python `ToolResponse` with explicit success and failure results while preserving raw Python returns as successful results; - normalizes sequential and parallel Python Tool calls through the same result-recording path; - preserves explicit Tool outcomes across the Python-to-Java bridge without inspecting arbitrary user payloads; - records missing Skill resources and MCP protocol error results as failed Tool operations while retaining their existing model-facing messages; - keeps `Outcome<T>` focused on whether the durable invocation returned or raised. `ToolResponseEvent`, Execution Events, and downstream metrics can therefore consume the same normalized Tool outcome in both languages. The existing `ToolResponseEvent.responses` wire representation is unchanged. ### Tests - `mvn -pl api,plan,runtime,integrations/mcp -am -DskipITs test` - `pytest` for the affected Python Tool API, Tool call, MCP, Skill, and Java bridge suites (49 passed) - Ruff format and lint checks for all changed Python files ### API Adds the public Python `flink_agents.api.tools.ToolResponse` type. Existing Python Tools that return raw values remain source- and behavior-compatible. ### Documentation - [ ] `doc-needed` - [ ] `doc-not-needed` - [x] `doc-included` ### Was this patch authored or co-authored using generative AI tooling? - [x] Yes - [ ] No Generated-by: Codex 0.151.0-alpha.7.2 (GPT-5.6 Sol) -- 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]
