-
Notifications
You must be signed in to change notification settings - Fork 31
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
[FEATURE] Order of tools in Register Agent Step should be deterministic #281
Comments
We need to decide how to handle (or whether to require) duplicate input. Current setup: "previous_node_inputs": {
"some_step": "some_value",
"foo_tool": "tools",
"bar_tool": "tools",
"baz_tool": "tools"
}, Result: foo, bar and baz tools in any order. Possible setup A: "previous_node_inputs": {
"some_step": "some_value",
"foo_tool": "tools",
"bar_tool": "tools",
"baz_tool": "tools"
},
"tools": ["foo_tool", "bar_tool", "baz_tool"], Result: foo, bar and baz tools in that specific order. But do we need the redundancy? Possible setup B: "previous_node_inputs": {
"some_step": "some_value"
},
"tools": ["foo_tool", "bar_tool", "baz_tool"], Result: foo, bar and baz tools in that specific order. Input from previous node assumed. But what if someone does this: Possible setup C: "previous_node_inputs": {
"some_step": "some_value",
"foo_tool": "tools",
"bar_tool": "tools",
"baz_tool": "tools"
},
"tools": ["foo_tool"], Result option 1: foo tool only. Possible setup D: "previous_node_inputs": {
"some_step": "some_value",
"bar_tool": "tools",
"baz_tool": "tools"
},
"tools": ["foo_tool", "bar_tool"], Result option 1: foo tool and bar tool in that order. Ultimately we need this to be simple and easy to explain. So Option 1 (my preference, works with A, B, C2, and D2):
Option 2 (works with A, B, C1, and D1):
Option 3 (works with A, C1, and D3):
|
Another idea:
|
OK, currently going with "Option 1":
// Anything in tools is sorted first, followed by anything else in previous node inputs
List<String> sortedNodes = tools == null ? new ArrayList<>() : Arrays.asList(tools);
previousNodes.removeAll(sortedNodes);
sortedNodes.addAll(previousNodes);
sortedNodes.forEach((node) -> { |
Reasoning for "option 1":
|
Is your feature request related to a problem?
For some agents (Flow Agent), the order of the tools matters. Currently when creating the list of tools we are using non-deterministic ordering from a HashMap entry set to create the
previousNodes
list.We need a way to (optionally) enforce an ordering of these tools.
What solution would you like?
The AgentStep already has an optional "tools" field in the code but it is never read, instead just iterating over the previous node inputs and looking for "tool" in the value.
If that field is populated with an array of tool ID's (the workflow step ID they were created with), the list should be sorted in that order.
What alternatives have you considered?
Always sort in order of workflow step ID. However, we may want different agents with different orderings created from the same definition.
The text was updated successfully, but these errors were encountered: