[API][Tool] Align Java and Python Tool outcome contracts - #1074
Open
joeyutong wants to merge 3 commits into
Open
[API][Tool] Align Java and Python Tool outcome contracts#1074joeyutong wants to merge 3 commits into
joeyutong wants to merge 3 commits into
Conversation
Preserve explicit Tool operation failures across native and cross-language execution without changing existing raw Python Tool return behavior. Generated-by: Codex 0.151.0-alpha.7.2 (GPT-5.6 Sol) Co-Authored-By: Claude Code <[email protected]> AI-Model: gpt-5.6-sol AI-Contributed/Feature: 274/274 AI-Contributed/UT: 315/315
Use error and is_error consistently with the established Java ToolResponse contract while keeping the bridge wire field named error. Generated-by: Codex 0.151.0-alpha.7.2 (GPT-5.6 Sol) Co-Authored-By: Claude Code <[email protected]> AI-Model: gpt-5.6-sol AI-Contributed/Feature: 28/28 AI-Contributed/UT: 24/24
Keep Java ToolResponse success and error states intact across the Java-to-Python bridge, preserve empty error messages, and add symmetric bridge coverage. Generated-by: Codex 0.151.0-alpha.7.2 (GPT-5.6 Sol) Co-Authored-By: Claude Code <[email protected]> AI-Model: gpt-5.6-sol AI-Contributed/Feature: 53/53 AI-Contributed/UT: 148/148
joeyutong
force-pushed
the
codex/align-tool-outcomes
branch
from
August 31, 2026 08:09
82adfd8 to
a186ab5
Compare
joeyutong
marked this pull request as ready for review
August 31, 2026 08:11
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.
Linked issue: #956
Purpose of change
Java can distinguish whether a Tool invocation returned from whether the returned
ToolResponserepresents 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:
ToolResponse.success(...)andToolResponse.error(...)while preserving raw Python returns as successful results;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 existingToolResponseEvent.responseswire representation is unchanged.Tests
mvn -pl api,plan,runtime,integrations/mcp -am -DskipITs testpytestfor the affected Python Tool API, Tool call, MCP, Skill, and Java bridge suites (66 passed)API
Adds the public Python
flink_agents.api.tools.ToolResponsetype. Existing Python Tools that return raw values remain source- and behavior-compatible.Documentation
doc-neededdoc-not-neededdoc-includedWas this patch authored or co-authored using generative AI tooling?
Generated-by: Codex 0.151.0-alpha.7.2 (GPT-5.6 Sol)