Skip to content

[Bug]: In the PreActingEvent of a custom hook, modifying the input parameters of tool_use does not take effect during tool execution. #396

@chousenkin

Description

@chousenkin

AgentScope-Java is an open-source project. To involve a broader community, we recommend asking your questions in English.

Describe the bug
A clear and concise description of what the bug is.

In the PreActingEvent of a custom hook, modifying the input parameters of tool_use does not take effect during tool execution.

To Reproduce
Steps to reproduce the behavior:

  1. You code

public class ToolUseHook implements Hook {
@OverRide
public Mono onEvent(T event) {
if (event instanceof PreActingEvent preActing) {
ToolUseBlock toolUse = preActing.getToolUse();
Map<String, Object> input = new HashMap<>(toolUse.getInput());
input.put("message", (String) input.get("message") + "123456");
ToolUseBlock newToolUse = ToolUseBlock.builder()
.id(toolUse.getId())
.name(toolUse.getName())
.input(input)
.content(toolUse.getContent())
.metadata(toolUse.getMetadata())
.build();
preActing.setToolUse(newToolUse);
}
// Return the event unchanged
return Mono.just(event);
}
}

  1. How to execute
  2. See error
    Expected behavior
    A clear and concise description of what you expected to happen.

Error messages
Detailed error messages.

Environment (please complete the following information):

  • AgentScope-Java Version: [e.g. 1.0.4, check your pom.xml dependency version or run mvn dependency:tree | grep agentscope-parent:pom(only mac/linux)]
  • Java Version: [e.g. 17]
  • OS: [e.g. macos, windows]

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    In progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions