AS AgentScopeAPI 手册 / API Reference

GenerateReason

public enum GenerateReason
源码Source 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
staticfinal

执行模型停止相关操作。

Model stopped normally, task completed.

源码Source io/agentscope/core/message/GenerateReason.java:39

TOOL_CALLS

TOOL_CALLS
staticfinal

执行工具调用相关操作。

Model returned tool calls (internal tools, framework will continue execution).

源码Source io/agentscope/core/message/GenerateReason.java:42

STRUCTURED_OUTPUT

STRUCTURED_OUTPUT
staticfinal

执行结构化输出相关操作。

Structured output completed.

源码Source io/agentscope/core/message/GenerateReason.java:45

TOOL_SUSPENDED

TOOL_SUSPENDED
staticfinal

执行工具 SUSPENDED相关操作。

Tool execution was suspended, waiting for user to provide results.

源码Source io/agentscope/core/message/GenerateReason.java:48

REASONING_STOP_REQUESTED

REASONING_STOP_REQUESTED
staticfinal

执行推理停止 REQUESTED相关操作。

Reasoning phase was stopped by a Hook (PostReasoningEvent.stopAgent()).

源码Source io/agentscope/core/message/GenerateReason.java:51

ACTING_STOP_REQUESTED

ACTING_STOP_REQUESTED
staticfinal

执行执行停止 REQUESTED相关操作。

Acting phase was stopped by a Hook (PostActingEvent.stopAgent()).

源码Source io/agentscope/core/message/GenerateReason.java:54

PERMISSION_ASKING

PERMISSION_ASKING
staticfinal

执行权限 ASKING相关操作。

Permission engine is asking the user to confirm one or more tool calls.

源码Source io/agentscope/core/message/GenerateReason.java:62

MIDDLEWARE_STOP_REQUESTED

MIDDLEWARE_STOP_REQUESTED
staticfinal

执行中间件停止 REQUESTED相关操作。

A middleware requested the agent to pause via RequestStopEvent.

源码Source io/agentscope/core/message/GenerateReason.java:70

ALL_TOOLS_DENIED

ALL_TOOLS_DENIED
staticfinal

执行所有工具已拒绝相关操作。

All tool calls were denied by the user and a hook requested the agent to stop.

源码Source io/agentscope/core/message/GenerateReason.java:79

INTERRUPTED

INTERRUPTED
staticfinal

执行 INTERRUPTED 方法。

Agent was interrupted.

源码Source io/agentscope/core/message/GenerateReason.java:82

MAX_ITERATIONS

MAX_ITERATIONS
staticfinal

执行最大迭代相关操作。

Maximum iterations reached.

源码Source io/agentscope/core/message/GenerateReason.java:85

TOOL_RETURN_DIRECT

TOOL_RETURN_DIRECT
staticfinal

执行工具 RETURN DIRECT相关操作。

Tool result returned directly to the caller without a follow-up model call.

源码Source io/agentscope/core/message/GenerateReason.java:88
基于官方固定版本源码静态生成Generated from pinned official sources · Python 2.0.11 · Java 2.0.4
签名与文档为静态抽取;如有疑问请以源码为准。Signatures and docs are extracted statically; verify against the source when in doubt.