GenerateReason
public enum GenerateReason
io/agentscope/core/message/GenerateReason.java:36–89定义Generate 推理相关取值的枚举。位于 io.agentscope.core.message 包。核心成员包括 MODEL_STOP、TOOL_CALLS、STRUCTURED_OUTPUT、TOOL_SUSPENDED、REASONING_STOP_REQUESTED、ACTING_STOP_REQUESTED。
Represents the reason why a message was generated by an agent.
This enum helps users understand the context and state of agent execution when a message is returned. Different reasons indicate different follow-up actions that may be required.
Example usage:
`Msg response = agent.call(userMsg).block();
switch (response.getGenerateReason()) {
case MODEL_STOP -> System.out.println("Task completed");
case TOOL_SUSPENDED -> handleSuspendedTools(response);
case REASONING_STOP_REQUESTED -> handleHumanReview(response);
// ...
}
`
枚举常量摘要Enum Constant Summary
| 常量Constant | 说明Description |
|---|---|
MODEL_STOP | 执行模型停止相关操作。 Model stopped normally, task completed. |
TOOL_CALLS | 执行工具调用相关操作。 Model returned tool calls (internal tools, framework will continue execution). |
STRUCTURED_OUTPUT | 执行结构化输出相关操作。 Structured output completed. |
TOOL_SUSPENDED | 执行工具 SUSPENDED相关操作。 Tool execution was suspended, waiting for user to provide results. |
REASONING_STOP_REQUESTED | 执行推理停止 REQUESTED相关操作。 Reasoning phase was stopped by a Hook (PostReasoningEvent.stopAgent()). |
ACTING_STOP_REQUESTED | 执行执行停止 REQUESTED相关操作。 Acting phase was stopped by a Hook (PostActingEvent.stopAgent()). |
PERMISSION_ASKING | 执行权限 ASKING相关操作。 Permission engine is asking the user to confirm one or more tool calls. |
MIDDLEWARE_STOP_REQUESTED | 执行中间件停止 REQUESTED相关操作。 A middleware requested the agent to pause via `RequestStopEvent`. |
ALL_TOOLS_DENIED | 执行所有工具已拒绝相关操作。 All tool calls were denied by the user and a hook requested the agent to stop. |
INTERRUPTED | 执行 `INTERRUPTED` 方法。 Agent was interrupted. |
MAX_ITERATIONS | 执行最大迭代相关操作。 Maximum iterations reached. |
TOOL_RETURN_DIRECT | 执行工具 RETURN DIRECT相关操作。 Tool result returned directly to the caller without a follow-up model call. |
枚举常量详情Enum Constant Detail
MODEL_STOP
MODEL_STOP
执行模型停止相关操作。
Model stopped normally, task completed.
io/agentscope/core/message/GenerateReason.java:39TOOL_CALLS
TOOL_CALLS
执行工具调用相关操作。
Model returned tool calls (internal tools, framework will continue execution).
io/agentscope/core/message/GenerateReason.java:42STRUCTURED_OUTPUT
STRUCTURED_OUTPUT
执行结构化输出相关操作。
Structured output completed.
io/agentscope/core/message/GenerateReason.java:45TOOL_SUSPENDED
TOOL_SUSPENDED
执行工具 SUSPENDED相关操作。
Tool execution was suspended, waiting for user to provide results.
io/agentscope/core/message/GenerateReason.java:48REASONING_STOP_REQUESTED
REASONING_STOP_REQUESTED
执行推理停止 REQUESTED相关操作。
Reasoning phase was stopped by a Hook (PostReasoningEvent.stopAgent()).
io/agentscope/core/message/GenerateReason.java:51ACTING_STOP_REQUESTED
ACTING_STOP_REQUESTED
执行执行停止 REQUESTED相关操作。
Acting phase was stopped by a Hook (PostActingEvent.stopAgent()).
io/agentscope/core/message/GenerateReason.java:54PERMISSION_ASKING
PERMISSION_ASKING
执行权限 ASKING相关操作。
Permission engine is asking the user to confirm one or more tool calls.
io/agentscope/core/message/GenerateReason.java:62MIDDLEWARE_STOP_REQUESTED
MIDDLEWARE_STOP_REQUESTED
执行中间件停止 REQUESTED相关操作。
A middleware requested the agent to pause via RequestStopEvent.
io/agentscope/core/message/GenerateReason.java:70ALL_TOOLS_DENIED
ALL_TOOLS_DENIED
执行所有工具已拒绝相关操作。
All tool calls were denied by the user and a hook requested the agent to stop.
io/agentscope/core/message/GenerateReason.java:79INTERRUPTED
INTERRUPTED
执行 INTERRUPTED 方法。
Agent was interrupted.
io/agentscope/core/message/GenerateReason.java:82MAX_ITERATIONS
MAX_ITERATIONS
执行最大迭代相关操作。
Maximum iterations reached.
io/agentscope/core/message/GenerateReason.java:85TOOL_RETURN_DIRECT
TOOL_RETURN_DIRECT
执行工具 RETURN DIRECT相关操作。
Tool result returned directly to the caller without a follow-up model call.
io/agentscope/core/message/GenerateReason.java:88