PostReasoningEvent
@Deprecated(forRemoval = true, since = "2.0.0") public final class PostReasoningEvent extends ReasoningEvent
io/agentscope/core/hook/PostReasoningEvent.java:53–175后置推理事件,描述执行过程中的事件。位于 io.agentscope.core.hook 包,继承自 ReasoningEvent。核心成员包括 getReasoningMessage、setReasoningMessage、stopAgent、isStopRequested、gotoReasoning、isGotoReasoningRequested。
Event fired after LLM reasoning completes.
Modifiable: Yes - #setReasoningMessage(Msg)
Context:
-
#getAgent()- The agent instance -
#getMemory()- Agent's memory -
#getModelName()- The model name -
#getGenerateOptions()- The generation options -
#getReasoningMessage()- The reasoning result (modifiable)
Note: Message content may include text blocks, thinking blocks, and tool use blocks. You can modify any of these before the agent processes tool calls.
Use Cases:
-
Filter or modify tool calls before execution
-
Add/remove content blocks
-
Modify text or thinking content
-
Add metadata
-
Request to stop the agent for human review via
#stopAgent()
构造器摘要Constructor Summary
| 构造器Constructor | 说明Description |
|---|---|
public PostReasoningEvent(Agent agent, String modelName, GenerateOptions generateOptions, Msg reasoningMessage) | 初始化 `PostReasoningEvent` 实例。 Constructor for PostReasoningEvent. |
方法摘要Method Summary
| 方法Method | 说明Description |
|---|---|
public Msg getReasoningMessage() | 获取推理结果消息来自大模型。 Get the reasoning result message from LLM. |
public void setReasoningMessage(Msg reasoningMessage) | 设置推理消息。 Modify the reasoning result message. |
public void stopAgent() | 停止智能体。 Request to stop the agent after this reasoning phase. |
public boolean isStopRequested() | 判断是否 `isStopRequested`。 Check if a stop has been requested. |
public void gotoReasoning() | 执行 `gotoReasoning` 方法。 Request to go back to reasoning phase without adding any messages. |
public void gotoReasoning(Msg msg) | 设置该参数。 Request to go back to reasoning phase with a single message. |
public void gotoReasoning(List<Msg> msgs) | 设置该参数。 Request to go back to reasoning phase with multiple messages. |
public boolean isGotoReasoningRequested() | 判断是否 `isGotoReasoningRequested`。 Check if a goto reasoning has been requested. |
public List<Msg> getGotoReasoningMsgs() | 获取 `getGotoReasoningMsgs`。 Get the messages to add before going back to reasoning. |
构造器详情Constructor Detail
PostReasoningEvent
public PostReasoningEvent(Agent agent, String modelName, GenerateOptions generateOptions, Msg reasoningMessage)
初始化 PostReasoningEvent 实例。
Constructor for PostReasoningEvent.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
agent | Agent | 智能体(类型 `Agent`)。The agent instance (must not be null) |
modelName | String | 模型名称(类型 `String`)。The model name (must not be null) |
generateOptions | GenerateOptions | generate 选项(类型 `GenerateOptions`)。The generation options (may be null) |
reasoningMessage | Msg | 推理消息(类型 `Msg`)。The reasoning result message (may be null) |
io/agentscope/core/hook/PostReasoningEvent.java:68–72方法详情Method Detail
getReasoningMessage
public Msg getReasoningMessage()
获取推理结果消息来自大模型。
Get the reasoning result message from LLM.
Msgio/agentscope/core/hook/PostReasoningEvent.java:79–81setReasoningMessage
public void setReasoningMessage(Msg reasoningMessage)
设置推理消息。
Modify the reasoning result message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
reasoningMessage | Msg | 新的推理消息。The new reasoning message |
io/agentscope/core/hook/PostReasoningEvent.java:88–90stopAgent
public void stopAgent()
停止智能体。
Request to stop the agent after this reasoning phase.
io/agentscope/core/hook/PostReasoningEvent.java:102–104isStopRequested
public boolean isStopRequested()
判断是否 isStopRequested。
Check if a stop has been requested.
booleanio/agentscope/core/hook/PostReasoningEvent.java:111–113gotoReasoning
public void gotoReasoning()
执行 gotoReasoning 方法。
Request to go back to reasoning phase without adding any messages.
IllegalStateException可能抛出 `IllegalStateException`。if there are pending ToolUse blocks
io/agentscope/core/hook/PostReasoningEvent.java:124–126gotoReasoning
public void gotoReasoning(Msg msg)
设置该参数。
Request to go back to reasoning phase with a single message.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msg | Msg | 消息(类型 `Msg`)。The message to add to memory before reasoning (e.g., ToolResult or hint message) |
IllegalStateException可能抛出 `IllegalStateException`。if ToolResult validation fails
io/agentscope/core/hook/PostReasoningEvent.java:137–139gotoReasoning
public void gotoReasoning(List<Msg> msgs)
设置该参数。
Request to go back to reasoning phase with multiple messages.
| 名称Name | 类型Type | 说明Description |
|---|---|---|
msgs | List<Msg> | 消息到添加到记忆之前推理。The messages to add to memory before reasoning |
IllegalStateException可能抛出 `IllegalStateException`。if ToolResult validation fails
io/agentscope/core/hook/PostReasoningEvent.java:153–156isGotoReasoningRequested
public boolean isGotoReasoningRequested()
判断是否 isGotoReasoningRequested。
Check if a goto reasoning has been requested.
booleanio/agentscope/core/hook/PostReasoningEvent.java:163–165getGotoReasoningMsgs
public List<Msg> getGotoReasoningMsgs()
获取 getGotoReasoningMsgs。
Get the messages to add before going back to reasoning.
List<Msg>io/agentscope/core/hook/PostReasoningEvent.java:172–174