PostActingEvent
@Deprecated(forRemoval = true, since = "2.0.0") public final class PostActingEvent extends ActingEvent
io/agentscope/core/hook/PostActingEvent.java:52–131后置执行事件,描述执行过程中的事件。位于 io.agentscope.core.hook 包,继承自 ActingEvent。核心成员包括 getToolResult、setToolResult、stopAgent、isStopRequested、getToolResultMsg、setToolResultMsg。
Event fired after tool execution completes.
Modifiable: Yes - #setToolResult(ToolResultBlock)
Context:
-
#getAgent()- The agent instance -
#getMemory()- Agent's memory -
#getToolkit()- The toolkit instance -
#getToolUse()- The original tool call -
#getToolResult()- The tool execution result (modifiable)
Note: This is called once per tool execution.
Use Cases:
-
Post-process individual tool results
-
Filter or sanitize tool output
-
Add metadata to results
-
Handle tool execution errors
-
Transform result format
-
Request to stop the agent for human review via
#stopAgent()
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public PostActingEvent(Agent agent, Toolkit toolkit, ToolUseBlock toolUse, ToolResultBlock toolResult) | 初始化 `PostActingEvent` 实例。 Constructor for PostActingEvent. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public ToolResultBlock getToolResult() | 获取工具执行结果。 Get the tool execution result. |
public void setToolResult(ToolResultBlock toolResult) | 设置工具结果。 Modify the tool execution result. |
public void stopAgent() | 停止智能体。 Request to stop the agent after this acting phase. |
public boolean isStopRequested() | 判断是否 `isStopRequested`。 Check if a stop has been requested. |
public Msg getToolResultMsg() | 获取工具结果消息。 Get the tool result message. |
public void setToolResultMsg(Msg toolResultMsg) | 设置工具结果消息。 Set the tool result message. |
构造器详情Constructor Detail
PostActingEvent
public PostActingEvent(Agent agent, Toolkit toolkit, ToolUseBlock toolUse, ToolResultBlock toolResult)
初始化 PostActingEvent 实例。
Constructor for PostActingEvent.
| 名称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 original tool call (can be null for empty events) |
toolResult | ToolResultBlock | 工具结果(类型 `ToolResultBlock`)。The tool execution result (can be null for empty events) |
io/agentscope/core/hook/PostActingEvent.java:67–71方法详情Method Detail
getToolResult
public ToolResultBlock getToolResult()
获取工具执行结果。
Get the tool execution result.
ToolResultBlockio/agentscope/core/hook/PostActingEvent.java:78–80setToolResult
public void setToolResult(ToolResultBlock toolResult)
设置工具结果。
Modify the tool execution result.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolResult | ToolResultBlock | 新的工具结果。The new tool result |
io/agentscope/core/hook/PostActingEvent.java:87–89stopAgent
public void stopAgent()
停止智能体。
Request to stop the agent after this acting phase.
io/agentscope/core/hook/PostActingEvent.java:101–103isStopRequested
public boolean isStopRequested()
判断是否 isStopRequested。
Check if a stop has been requested.
booleanio/agentscope/core/hook/PostActingEvent.java:110–112getToolResultMsg
public Msg getToolResultMsg()
获取工具结果消息。
Get the tool result message.
Msgio/agentscope/core/hook/PostActingEvent.java:119–121setToolResultMsg
public void setToolResultMsg(Msg toolResultMsg)
设置工具结果消息。
Set the tool result message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolResultMsg | Msg | 工具结果消息。The tool result message |
io/agentscope/core/hook/PostActingEvent.java:128–130