类 PostActingEvent
java.lang.Object
io.agentscope.core.hook.HookEvent
io.agentscope.core.hook.ActingEvent
io.agentscope.core.hook.PostActingEvent
Event fired after tool execution completes.
Modifiable: Yes - setToolResult(ToolResultBlock)
Context:
HookEvent.getAgent()- The agent instanceHookEvent.getMemory()- Agent's memoryActingEvent.getToolkit()- The toolkit instanceActingEvent.getToolUse()- The original tool callgetToolResult()- 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()
-
字段概要
从类继承的字段 io.agentscope.core.hook.ActingEvent
toolUse -
构造器概要
构造器构造器说明PostActingEvent(Agent agent, Toolkit toolkit, ToolUseBlock toolUse, ToolResultBlock toolResult) Constructor for PostActingEvent. -
方法概要
修饰符和类型方法说明Get the tool execution result.Get the tool result message.booleanCheck if a stop has been requested.voidsetToolResult(ToolResultBlock toolResult) Modify the tool execution result.voidsetToolResultMsg(Msg toolResultMsg) Set the tool result message.voidRequest to stop the agent after this acting phase.从类继承的方法 io.agentscope.core.hook.ActingEvent
getToolkit, getToolUse从类继承的方法 io.agentscope.core.hook.HookEvent
getAgent, getMemory, getTimestamp, getType
-
构造器详细资料
-
PostActingEvent
public PostActingEvent(Agent agent, Toolkit toolkit, ToolUseBlock toolUse, ToolResultBlock toolResult) Constructor for PostActingEvent.- 参数:
agent- The agent instance (must not be null)toolkit- The toolkit instance (must not be null)toolUse- The original tool call (can be null for empty events)toolResult- The tool execution result (can be null for empty events)
-
-
方法详细资料
-
getToolResult
Get the tool execution result.- 返回:
- The tool result block
-
setToolResult
Modify the tool execution result.- 参数:
toolResult- The new tool result
-
stopAgent
public void stopAgent()Request to stop the agent after this acting phase.When called, the agent will return the current message containing the ToolResultBlock instead of continuing to the next reasoning iteration. The user can then review the tool execution result and resume execution by calling
agent.call()with no arguments.This enables human-in-the-loop scenarios where tool execution results need user review before the agent continues reasoning.
-
isStopRequested
public boolean isStopRequested()Check if a stop has been requested.- 返回:
- true if
stopAgent()has been called, false otherwise
-
getToolResultMsg
Get the tool result message.- 返回:
- The tool result message
-
setToolResultMsg
Set the tool result message.- 参数:
toolResultMsg- The tool result message
-