类 HookEvent
java.lang.Object
io.agentscope.core.hook.HookEvent
- 直接已知子类:
ActingEvent,ErrorEvent,PostCallEvent,PreCallEvent,ReasoningEvent,SummaryEvent
public abstract sealed class HookEvent
extends Object
permits PreCallEvent, PostCallEvent, ReasoningEvent, ActingEvent, SummaryEvent, ErrorEvent
Base class for all hook events.
This is a sealed class - only the predefined event types are permitted. This enables exhaustive pattern matching in switch expressions.
All events provide access to common context:
getAgent()- The agent instancegetMemory()- Convenient access to agent's memory (may be null)getType()- The event typegetTimestamp()- When the event occurred
Modifiability: Whether an event allows modification is determined by the presence of setter methods in the concrete event class.
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明final AgentgetAgent()Get the agent instance.final MemoryConvenient access to agent's memory.final longGet the timestamp when event was created.final HookEventTypegetType()Get the event type.
-
构造器详细资料
-
HookEvent
Constructor for HookEvent.- 参数:
type- The event type (must not be null)agent- The agent instance (must not be null)- 抛出:
NullPointerException- if type or agent is null
-
-
方法详细资料
-
getType
Get the event type.- 返回:
- The event type
-
getAgent
Get the agent instance.- 返回:
- The agent instance (never null)
-
getTimestamp
public final long getTimestamp()Get the timestamp when event was created.- 返回:
- The timestamp (milliseconds since epoch)
-
getMemory
Convenient access to agent's memory.- 返回:
- The memory, or null if agent doesn't have memory
-