类 PostActingEvent


public final class PostActingEvent extends ActingEvent
Event fired after tool execution completes.

Modifiable: Yes - setToolResult(ToolResultBlock)

Context:

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()
  • 构造器详细资料

    • 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

      public ToolResultBlock getToolResult()
      Get the tool execution result.
      返回:
      The tool result block
    • setToolResult

      public void setToolResult(ToolResultBlock toolResult)
      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

      public Msg getToolResultMsg()
      Get the tool result message.
      返回:
      The tool result message
    • setToolResultMsg

      public void setToolResultMsg(Msg toolResultMsg)
      Set the tool result message.
      参数:
      toolResultMsg - The tool result message