类 PostReasoningEvent
Modifiable: Yes - setReasoningMessage(Msg)
Context:
HookEvent.getAgent()- The agent instanceHookEvent.getMemory()- Agent's memoryReasoningEvent.getModelName()- The model nameReasoningEvent.getGenerateOptions()- The generation optionsgetReasoningMessage()- 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()
-
构造器概要
构造器构造器说明PostReasoningEvent(Agent agent, String modelName, GenerateOptions generateOptions, Msg reasoningMessage) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Constructor for PostReasoningEvent. -
方法概要
修饰符和类型方法说明已过时, 待删除: 此 API 元素将从以后的版本中删除。Get the messages to add before going back to reasoning.已过时, 待删除: 此 API 元素将从以后的版本中删除。Get the reasoning result message from LLM.void已过时, 待删除: 此 API 元素将从以后的版本中删除。Request to go back to reasoning phase without adding any messages.voidgotoReasoning(Msg msg) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Request to go back to reasoning phase with a single message.voidgotoReasoning(List<Msg> msgs) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Request to go back to reasoning phase with multiple messages.boolean已过时, 待删除: 此 API 元素将从以后的版本中删除。Check if a goto reasoning has been requested.boolean已过时, 待删除: 此 API 元素将从以后的版本中删除。Check if a stop has been requested.voidsetReasoningMessage(Msg reasoningMessage) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Modify the reasoning result message.void已过时, 待删除: 此 API 元素将从以后的版本中删除。Request to stop the agent after this reasoning phase.从类继承的方法 io.agentscope.core.hook.ReasoningEvent
getGenerateOptions, getModelName从类继承的方法 io.agentscope.core.hook.HookEvent
appendSystemContent, appendSystemContent, getAgent, getMemory, getSystemMessage, getTimestamp, getType, setSystemMessage
-
构造器详细资料
-
PostReasoningEvent
public PostReasoningEvent(Agent agent, String modelName, GenerateOptions generateOptions, Msg reasoningMessage) 已过时, 待删除: 此 API 元素将从以后的版本中删除。Constructor for PostReasoningEvent.- 参数:
agent- The agent instance (must not be null)modelName- The model name (must not be null)generateOptions- The generation options (may be null)reasoningMessage- The reasoning result message (may be null)
-
-
方法详细资料
-
getReasoningMessage
已过时, 待删除: 此 API 元素将从以后的版本中删除。Get the reasoning result message from LLM.- 返回:
- The reasoning message, may be null
-
setReasoningMessage
已过时, 待删除: 此 API 元素将从以后的版本中删除。Modify the reasoning result message.- 参数:
reasoningMessage- The new reasoning message
-
stopAgent
public void stopAgent()已过时, 待删除: 此 API 元素将从以后的版本中删除。Request to stop the agent after this reasoning phase.When called, the agent will return the current message containing ToolUseBlocks instead of proceeding to execute the tools. The user can then review the pending tool calls and resume execution by calling
agent.call()with no arguments.This enables human-in-the-loop scenarios where sensitive or important tool calls need user confirmation before execution.
-
isStopRequested
public boolean isStopRequested()已过时, 待删除: 此 API 元素将从以后的版本中删除。Check if a stop has been requested.- 返回:
- true if
stopAgent()has been called, false otherwise
-
gotoReasoning
public void gotoReasoning()已过时, 待删除: 此 API 元素将从以后的版本中删除。Request to go back to reasoning phase without adding any messages.This is only valid when there are no pending ToolUse blocks in the reasoning message. If there are pending ToolUse blocks, an
IllegalStateExceptionwill be thrown because ToolResult messages must be provided first.- 抛出:
IllegalStateException- if there are pending ToolUse blocks
-
gotoReasoning
已过时, 待删除: 此 API 元素将从以后的版本中删除。Request to go back to reasoning phase with a single message.If the reasoning message contains ToolUse blocks, the provided message must contain matching ToolResult blocks. Additional messages (like hints or prompts) can also be included.
- 参数:
msg- The message to add to memory before reasoning (e.g., ToolResult or hint message)- 抛出:
IllegalStateException- if ToolResult validation fails
-
gotoReasoning
已过时, 待删除: 此 API 元素将从以后的版本中删除。Request to go back to reasoning phase with multiple messages.Validation rules:
- If no pending ToolUse: messages are added as-is (can be hints/prompts)
- If pending ToolUse: messages must contain matching ToolResult blocks
- 参数:
msgs- The messages to add to memory before reasoning- 抛出:
IllegalStateException- if ToolResult validation fails
-
isGotoReasoningRequested
public boolean isGotoReasoningRequested()已过时, 待删除: 此 API 元素将从以后的版本中删除。Check if a goto reasoning has been requested.- 返回:
- true if any gotoReasoning method has been called, false otherwise
-
getGotoReasoningMsgs
已过时, 待删除: 此 API 元素将从以后的版本中删除。Get the messages to add before going back to reasoning.- 返回:
- The messages to add, or null if gotoReasoning was not called
-
MiddlewareBaseinstead.