-
Notifications
You must be signed in to change notification settings - Fork 268
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.
Describe the Bug
When ReactAgent starts HITL, it returns tools pending confirmation. If the user only provides partial tool call results(e.g., the user needs to cancel part of the tool call).
ReactAgent directly enters the acting function. Within the acting function's logic, all tools from the previous round are invoked again, which may lead to unexpected calls.
agentscope-java/agentscope-core/src/main/java/io/agentscope/core/util/MessageUtils.java
Lines 47 to 64 in e68e73c
| public static List<ToolUseBlock> extractRecentToolCalls(List<Msg> messages, String agentName) { | |
| if (messages == null || messages.isEmpty()) { | |
| return List.of(); | |
| } | |
| for (int i = messages.size() - 1; i >= 0; i--) { | |
| Msg msg = messages.get(i); | |
| if (msg.getRole() == MsgRole.ASSISTANT && msg.getName().equals(agentName)) { | |
| List<ToolUseBlock> toolCalls = msg.getContentBlocks(ToolUseBlock.class); | |
| if (!toolCalls.isEmpty()) { | |
| return toolCalls; | |
| } | |
| break; | |
| } | |
| } | |
| return List.of(); | |
| } |
Potentially problematic scenarios:
- The user only wants to cancel the invocation of some tools.
- Some tools are invoked successfully, while others are suspended; the user only provides partial tool results.
Unexpected Result
When resuming, all tools are still executed.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working
Type
Projects
Status
Done