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 |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent instance (must not be null) |
inputMessages | List<Msg> | 输入消息(类型 `List`)。The messages input to the agent (must not be null) |
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.
List<Msg>输入消息。The input messages
源码Source
io/agentscope/core/hook/PreCallEvent.java:70–72setInputMessages
public void setInputMessages(List<Msg> inputMessages)
设置输入消息。
Modify the input messages for the agent call.
参数Parameters
| 名称Name | 类型Type | 说明Description |
|---|---|---|
inputMessages | List<Msg> | 输入消息(类型 `List`)。The new message list (must not be null) |
NullPointerException可能抛出 `NullPointerException`。if inputMessages is null
源码Source
io/agentscope/core/hook/PreCallEvent.java:80–82