AS AgentScopeAPI 手册 / API Reference

PreActingEvent

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

参数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 tool call to execute (must not be null)
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if agent, toolkit, or toolUse is null
源码Source io/agentscope/core/hook/PreActingEvent.java:60–62

方法详情Method Detail

setToolUse

public void setToolUse(ToolUseBlock toolUse)

设置工具使用。

Modify the tool call (e.g., change parameters).

参数Parameters
名称Name类型Type说明Description
toolUseToolUseBlock工具使用(类型 `ToolUseBlock`)。The new tool use block (must not be null)
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if toolUse is null
源码Source io/agentscope/core/hook/PreActingEvent.java:70–72

继承成员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.