AS AgentScopeAPI 手册 / API Reference

PostActingEvent

@Deprecated(forRemoval = true, since = "2.0.0") public final class PostActingEvent extends ActingEvent
源码Source 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.

参数Parameters
名称Name类型Type说明Description
agentAgent智能体(类型 `Agent`)。The agent instance (must not be null)
toolkitToolkit工具包(类型 `Toolkit`)。The toolkit instance (must not be null)
toolUseToolUseBlock工具使用(类型 `ToolUseBlock`)。The original tool call (can be null for empty events)
toolResultToolResultBlock工具结果(类型 `ToolResultBlock`)。The tool execution result (can be null for empty events)
源码Source io/agentscope/core/hook/PostActingEvent.java:67–71

方法详情Method Detail

getToolResult

public ToolResultBlock getToolResult()

获取工具执行结果。

Get the tool execution result.

返回Returns ToolResultBlock
工具结果块。The tool result block
源码Source io/agentscope/core/hook/PostActingEvent.java:78–80

setToolResult

public void setToolResult(ToolResultBlock toolResult)

设置工具结果。

Modify the tool execution result.

参数Parameters
名称Name类型Type说明Description
toolResultToolResultBlock新的工具结果。The new tool result
源码Source io/agentscope/core/hook/PostActingEvent.java:87–89

stopAgent

public void stopAgent()

停止智能体。

Request to stop the agent after this acting phase.

源码Source io/agentscope/core/hook/PostActingEvent.java:101–103

isStopRequested

public boolean isStopRequested()

判断是否 isStopRequested。

Check if a stop has been requested.

返回Returns boolean
返回布尔值,表示判断结果。true if `#stopAgent()` has been called, false otherwise
源码Source io/agentscope/core/hook/PostActingEvent.java:110–112

getToolResultMsg

public Msg getToolResultMsg()

获取工具结果消息。

Get the tool result message.

返回Returns Msg
工具结果消息。The tool result message
源码Source io/agentscope/core/hook/PostActingEvent.java:119–121

setToolResultMsg

public void setToolResultMsg(Msg toolResultMsg)

设置工具结果消息。

Set the tool result message.

参数Parameters
名称Name类型Type说明Description
toolResultMsgMsg工具结果消息。The tool result message
源码Source io/agentscope/core/hook/PostActingEvent.java:128–130

继承成员Inherited Members

继承自Members inherited from ActingEvent
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.