PreActingEvent
@Deprecated(forRemoval = true, since = "2.0.0") public final class PreActingEvent extends ActingEvent
io/agentscope/core/hook/PreActingEvent.java:49–73前置执行事件,描述执行过程中的事件。位于 io.agentscope.core.hook 包,继承自 ActingEvent。核心成员包括 setToolUse、PreActingEvent。
Event fired before tool execution.
Modifiable: Yes - #setToolUse(ToolUseBlock)
Context:
-
#getAgent()- The agent instance -
#getMemory()- Agent's memory -
#getToolkit()- The toolkit instance -
#getToolUse()- The tool call to execute (modifiable)
Note: This is called once per tool. If the reasoning result contains multiple tool calls, this event fires multiple times.
Use Cases:
-
Validate or modify tool parameters for each tool call
-
Add authentication or context to individual tool calls
-
Implement per-tool authorization checks
-
Log or monitor individual tool invocations
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public PreActingEvent(Agent agent, Toolkit toolkit, ToolUseBlock toolUse) | 初始化 `PreActingEvent` 实例。 Constructor for PreActingEvent. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public void setToolUse(ToolUseBlock toolUse) | 设置工具使用。 Modify the tool call (e.g., change parameters). |
构造器详情Constructor Detail
PreActingEvent
public PreActingEvent(Agent agent, Toolkit toolkit, ToolUseBlock toolUse)
初始化 PreActingEvent 实例。
Constructor for PreActingEvent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent instance (must not be null) |
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit instance (must not be null) |
toolUse | ToolUseBlock | 工具使用(类型 `ToolUseBlock`)。The tool call to execute (must not be null) |
NullPointerException可能抛出 `NullPointerException`。if agent, toolkit, or toolUse is null
io/agentscope/core/hook/PreActingEvent.java:60–62方法详情Method Detail
setToolUse
public void setToolUse(ToolUseBlock toolUse)
设置工具使用。
Modify the tool call (e.g., change parameters).
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolUse | ToolUseBlock | 工具使用(类型 `ToolUseBlock`)。The new tool use block (must not be null) |
NullPointerException可能抛出 `NullPointerException`。if toolUse is null
io/agentscope/core/hook/PreActingEvent.java:70–72