AS AgentScopeAPI 手册 / API Reference

PreCallEvent

@Deprecated(forRemoval = true, since = "2.0.0") public final class PreCallEvent extends HookEvent
源码Source io/agentscope/core/hook/PreCallEvent.java:46–83

前置调用事件,描述执行过程中的事件。位于 io.agentscope.core.hook 包,继承自 HookEvent。核心成员包括 getInputMessages、setInputMessages、PreCallEvent。

Event fired before agent starts processing.

Modifiable: Yes - #setInputMessages(List)

Context:

  • #getAgent() - The agent instance

  • #getMemory() - Agent's existing memory or conversation history prior to processing this call

  • #getInputMessages() - Messages input to the agent (modifiable)

Use Cases:

  • Log the start of agent execution

  • Initialize execution-specific resources

  • Track agent invocation metrics

  • Filter or modify input messages before agent processing

构造器摘要Constructor Summary

构造器Constructor说明Description
public PreCallEvent(Agent agent, List<Msg> inputMessages)
初始化 `PreCallEvent` 实例。
Constructor for PreCallEvent.

方法摘要Method Summary

方法Method说明Description
public List<Msg> getInputMessages()
获取输入消息用于智能体调用。
Get the input messages for the agent call.
public void setInputMessages(List<Msg> inputMessages)
设置输入消息。
Modify the input messages for the agent call.

构造器详情Constructor Detail

PreCallEvent

public PreCallEvent(Agent agent, List<Msg> inputMessages)

初始化 PreCallEvent 实例。

Constructor for PreCallEvent.

参数Parameters
名称Name类型Type说明Description
agentAgent智能体(类型 `Agent`)。The agent instance (must not be null)
inputMessagesList<Msg>输入消息(类型 `List`)。The messages input to the agent (must not be null)
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if agent or inputMessages is null
源码Source io/agentscope/core/hook/PreCallEvent.java:58–63

方法详情Method Detail

getInputMessages

public List<Msg> getInputMessages()

获取输入消息用于智能体调用。

Get the input messages for the agent call.

返回Returns List<Msg>
输入消息。The input messages
源码Source io/agentscope/core/hook/PreCallEvent.java:70–72

setInputMessages

public void setInputMessages(List<Msg> inputMessages)

设置输入消息。

Modify the input messages for the agent call.

参数Parameters
名称Name类型Type说明Description
inputMessagesList<Msg>输入消息(类型 `List`)。The new message list (must not be null)
抛出Throws
  • NullPointerException 可能抛出 `NullPointerException`。if inputMessages is null
源码Source io/agentscope/core/hook/PreCallEvent.java:80–82

继承成员Inherited Members

基于官方固定版本源码静态生成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.