-
Notifications
You must be signed in to change notification settings - Fork 149
[Feature] Parallel Tool Call Execution #926
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
da-daken
wants to merge
11
commits into
apache:main
Choose a base branch
from
da-daken:parallel_tool
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
5a68652
[feature] add_durableExecuteAllAsync_java
b01c949
refactor(plan): Refactor tool-call execution logic for parallel proce…
1cdfbfb
fix bug
87a01ec
add user docs
c21cf3d
Update toolCallAction
97b9421
Update ContinuationActionExecutor
e3e178c
feat(runtime): add java test
ffbe1c5
[feature] add_durableExecuteAllAsync_python
3d3a427
add batch-timeout test
05e9363
update cross-language test
9169bb2
add e2e test
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
53 changes: 53 additions & 0 deletions
53
api/src/main/java/org/apache/flink/agents/api/context/Outcome.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| /* | ||
| * Licensed to the Apache Software Foundation (ASF) under one | ||
| * or more contributor license agreements. See the NOTICE file | ||
| * distributed with this work for additional information | ||
| * regarding copyright ownership. The ASF licenses this file | ||
| * to you under the Apache License, Version 2.0 (the | ||
| * "License"); you may not use this file except in compliance | ||
| * with the License. You may obtain a copy of the License at | ||
| * | ||
| * http://www.apache.org/licenses/LICENSE-2.0 | ||
| * | ||
| * Unless required by applicable law or agreed to in writing, software | ||
| * distributed under the License is distributed on an "AS IS" BASIS, | ||
| * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| * See the License for the specific language governing permissions and | ||
| * limitations under the License. | ||
| */ | ||
| package org.apache.flink.agents.api.context; | ||
|
|
||
| /** Result of a durable batch execution slot. */ | ||
| public class Outcome<T> { | ||
| private final T value; | ||
| private final Exception error; | ||
|
|
||
| private Outcome(T value, Exception error) { | ||
| this.value = value; | ||
| this.error = error; | ||
| } | ||
|
|
||
| public static <T> Outcome<T> success(T value) { | ||
| return new Outcome<>(value, null); | ||
| } | ||
|
|
||
| public static <T> Outcome<T> failure(Exception error) { | ||
| return new Outcome<>(null, error); | ||
| } | ||
|
|
||
| public boolean isSuccess() { | ||
| return error == null; | ||
| } | ||
|
|
||
| public boolean isFailure() { | ||
| return error != null; | ||
| } | ||
|
|
||
| public T getValue() { | ||
| return value; | ||
| } | ||
|
|
||
| public Exception getError() { | ||
| return error; | ||
| } | ||
| } |
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the repo's first
ConfigOption<Duration>, and I do not think it can be set from any documented route.AgentConfiguration.get()dispatchesisAssignableFrom,String,Integer,Long,Float,Double,Boolean,isEnum(), thenthrow new ClassCastException. There is noDurationbranch, and YAML values arrive asStringorInteger. SogetConfig().get(TOOL_CALL_BATCH_TIMEOUT)atJavaRunnerContextImpl.java:253throws for any value a user sets, after:119has already persisted N PENDING slots, and the catch-all atToolCallAction.java:171then reports every tool in the batch failed.The programmatic route clears
get()but not plan serialization:AgentPlan.writeObjectuses a barenew ObjectMapper()with noJavaTimeModule, and I reproducedInvalidDefinitionExceptiononjava.time.Durationagainst the pinned jackson-databind. On Python,core_options.py:271isconfig_type=int, so the documented30sraisesValueErrormid-action.CI stays green because
JavaRunnerContextImplDurableExecuteAsyncTest.java:324-327sets the option in-process, whereisAssignableFromshort-circuits. Andcheck_java_python_config_options_parity.py:45adds"java.time.Duration": intto the type table, so the harness now certifies exactly this pair.ConfigurationUtils.convertValueis already imported inAgentConfigurationfor the enum branch and it handlesDuration; retyping this option toLongmillis would instead let the harness stay strict. Do you have a preference? Asking because the batch deadline is the only bound on a hung tool wedging the fan-in, and it currently ships both default-off and unsettable.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the catch. I missed the YAML case and have now updated the timeout configuration to use the
LongtypeThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type change buys more than the YAML fix, for what it's worth —
AgentConfiguration.get()has aLongbranch atAgentConfiguration.java:142, andLongis Jackson-native, so the plan-serialization and Python routes resolve along with it.Two smaller things while the option is in flux.
short-term-memory.state-ttl.ms(AgentExecutionOptions.java:88) is the existingLong-millis option in this class and puts the unit in the key — since a bareLongdrops the unitDurationcarried, wouldtool-call.batch.timeout.msbe worth matching to it while the key is still unreleased?And a few
Durationleftovers will probably want sweeping with the same change: the parity-harness entries added for it (check_java_python_config_options_parity.py:45and the_java_duration_to_millisbranch at:99) are covered by"java.lang.Long": intat:40once the type moves, and the config table still lists the type asDurationwith a-1msdefault (configuration.md:137). Any reason to keep those around once the type moves?