LegacyHookDispatcher
@Deprecated(forRemoval = true, since = "2.0.0") @SuppressWarnings("deprecation") public final class LegacyHookDispatcher
io/agentscope/core/hook/LegacyHookDispatcher.java:42–197Legacy 钩子调度器,驱动智能体的推理、工具调用与会话执行。位于 io.agentscope.core.hook 包。核心成员包括 fire、firePreReasoning、firePostReasoning、fireReasoningChunk、firePreActing、firePostActing。
Encapsulates all legacy HookEvent construction and dispatch logic.
This class exists solely to keep the ReActAgent core loop clean and focused on the
2.0 io.agentscope.core.middleware.MiddlewareBase / io.agentscope.core.event.AgentEvent
path. All methods here delegate to the agent's registered Hook list.
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public LegacyHookDispatcher(ReActAgent agent) | 初始化 `LegacyHookDispatcher` 实例。 Creates a new instance. |
方法摘要Method Summary
构造器详情Constructor Detail
LegacyHookDispatcher
public LegacyHookDispatcher(ReActAgent agent)
初始化 LegacyHookDispatcher 实例。
Creates a new instance.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | ReActAgent | 智能体(类型 `ReActAgent`)。The agent. |
io/agentscope/core/hook/LegacyHookDispatcher.java:48–50方法详情Method Detail
fire
public T extends HookEvent Mono<T> fire(T event)
设置该参数。
Performs the fire operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
event | T | 事件(类型 `T`)。The event. |
Mono<T>io/agentscope/core/hook/LegacyHookDispatcher.java:54–60firePreReasoning
public Mono<PreReasoningEvent> firePreReasoning(List<Msg> msgs, Msg systemMsg, String modelName)
执行前置推理。
Performs the fire pre reasoning operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
systemMsg | Msg | 系统消息(类型 `Msg`)。The system msg. |
modelName | String | 模型名称(类型 `String`)。The model name. |
Mono<PreReasoningEvent>io/agentscope/core/hook/LegacyHookDispatcher.java:64–69firePostReasoning
public Mono<PostReasoningEvent> firePostReasoning(Msg msg, String modelName)
执行后置推理。
Performs the fire post reasoning operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。The msg. |
modelName | String | 模型名称(类型 `String`)。The model name. |
Mono<PostReasoningEvent>io/agentscope/core/hook/LegacyHookDispatcher.java:71–73fireReasoningChunk
public Mono<Void> fireReasoningChunk(Msg chunkMsg, ReasoningContext context, String modelName)
执行推理分块。
Performs the fire reasoning chunk operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
chunkMsg | Msg | 分块消息(类型 `Msg`)。The chunk msg. |
context | ReasoningContext | 上下文(类型 `ReasoningContext`)。The context. |
modelName | String | 模型名称(类型 `String`)。The model name. |
Mono<Void>io/agentscope/core/hook/LegacyHookDispatcher.java:75–110firePreActing
public Mono<List<ToolUseBlock>> firePreActing(List<ToolUseBlock> toolCalls, Toolkit toolkit)
执行前置执行。
Performs the fire pre acting operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolCalls | List<ToolUseBlock> | 工具调用(类型 `List`)。The tool calls. |
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit. |
Mono<List<ToolUseBlock>>io/agentscope/core/hook/LegacyHookDispatcher.java:114–119firePostActing
public Mono<PostActingEvent> firePostActing(ToolUseBlock toolUse, ToolResultBlock result, Toolkit toolkit, Msg toolMsg)
执行后置执行。
Performs the fire post acting operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolUse | ToolUseBlock | 工具使用(类型 `ToolUseBlock`)。The tool use. |
result | ToolResultBlock | 结果(类型 `ToolResultBlock`)。The result. |
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit. |
toolMsg | Msg | 工具消息(类型 `Msg`)。The tool msg. |
Mono<PostActingEvent>io/agentscope/core/hook/LegacyHookDispatcher.java:121–126fireActingChunk
public Mono<Void> fireActingChunk(ToolUseBlock toolUse, ToolResultBlock chunk, Toolkit toolkit)
执行执行分块。
Performs the fire acting chunk operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
toolUse | ToolUseBlock | 工具使用(类型 `ToolUseBlock`)。The tool use. |
chunk | ToolResultBlock | 分块(类型 `ToolResultBlock`)。The chunk. |
toolkit | Toolkit | 工具包(类型 `Toolkit`)。The toolkit. |
Mono<Void>io/agentscope/core/hook/LegacyHookDispatcher.java:128–139firePreSummary
public Mono<PreSummaryEvent> firePreSummary(List<Msg> msgs, GenerateOptions generateOptions, String modelName, int maxIters, Msg systemMsg)
执行前置摘要。
Performs the fire pre summary operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息列表(类型 `List`)。The msgs. |
generateOptions | GenerateOptions | generate 选项(类型 `GenerateOptions`)。The generate options. |
modelName | String | 模型名称(类型 `String`)。The model name. |
maxIters | int | 最大迭代次数(类型 `int`)。The max iters. |
systemMsg | Msg | 系统消息(类型 `Msg`)。The system msg. |
Mono<PreSummaryEvent>io/agentscope/core/hook/LegacyHookDispatcher.java:143–153firePostSummary
public Mono<PostSummaryEvent> firePostSummary(Msg msg, GenerateOptions generateOptions, String modelName)
执行后置摘要。
Performs the fire post summary operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。The msg. |
generateOptions | GenerateOptions | generate 选项(类型 `GenerateOptions`)。The generate options. |
modelName | String | 模型名称(类型 `String`)。The model name. |
Mono<PostSummaryEvent>io/agentscope/core/hook/LegacyHookDispatcher.java:155–158fireSummaryChunk
public Mono<Void> fireSummaryChunk(Msg chunkMsg, ReasoningContext context, GenerateOptions generateOptions, String modelName)
执行摘要分块。
Performs the fire summary chunk operation.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
chunkMsg | Msg | 分块消息(类型 `Msg`)。The chunk msg. |
context | ReasoningContext | 上下文(类型 `ReasoningContext`)。The context. |
generateOptions | GenerateOptions | generate 选项(类型 `GenerateOptions`)。The generate options. |
modelName | String | 模型名称(类型 `String`)。The model name. |
Mono<Void>io/agentscope/core/hook/LegacyHookDispatcher.java:160–196