AS AgentScopeAPI 手册 / API Reference

ConfirmResult

public class ConfirmResult
源码Source io/agentscope/core/event/ConfirmResult.java:35–93

确认结果,在智能体、模型与前端之间传递结构化消息和事件。位于 io.agentscope.core.event 包。核心成员包括 isConfirmed、getToolCall、getRules、getReason、ConfirmResult。

Represents the result of a single user confirmation decision for a tool call.

When confirmed, the caller may supply a modified #toolCall (allowing the user to tweak input) and/or new #rules that the PermissionEngine should remember for future calls — e.g. "always allow this command going forward".

When denied, the caller may supply a human-readable #reason explaining the denial; it becomes the text of the DENIED tool result written back to the model context (and emitted on the event stream), replacing the default "Permission denied by user" message.

构造器摘要Constructor Summary

构造器Constructor说明Description
public ConfirmResult(boolean confirmed, ToolUseBlock toolCall, List<PermissionRule> rules, String reason)
初始化 `ConfirmResult` 实例。
Creates a new instance.
public ConfirmResult(boolean confirmed, ToolUseBlock toolCall, List<PermissionRule> rules)
初始化 `ConfirmResult` 实例。
Convenience constructor without a denial reason.
public ConfirmResult(boolean confirmed, ToolUseBlock toolCall)
初始化 `ConfirmResult` 实例。
Convenience constructor without rules.

方法摘要Method Summary

方法Method说明Description
public boolean isConfirmed()
判断是否 `isConfirmed`。
Returns whether the confirmed.
public ToolUseBlock getToolCall()
获取工具调用。
Returns the tool call.
public List<PermissionRule> getRules()
获取规则。
New permission rules to register with the engine when `#confirmed` is true.
public String getReason()
获取推理。
Optional human-readable reason for a denial (`#confirmed` == false).

构造器详情Constructor Detail

ConfirmResult

public ConfirmResult(boolean confirmed, ToolUseBlock toolCall, List<PermissionRule> rules, String reason)

初始化 ConfirmResult 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
confirmedbooleanconfirmed(类型 `boolean`)。The confirmed.
toolCallToolUseBlock工具调用(类型 `ToolUseBlock`)。The tool call.
rulesList<PermissionRule>规则(类型 `List`)。The rules.
reasonString原因(类型 `String`)。The reason.
源码Source io/agentscope/core/event/ConfirmResult.java:42–52

ConfirmResult

public ConfirmResult(boolean confirmed, ToolUseBlock toolCall, List<PermissionRule> rules)

初始化 ConfirmResult 实例。

Convenience constructor without a denial reason.

参数Parameters
名称Name类型Type说明Description
confirmedbooleanconfirmed(类型 `boolean`)。The confirmed.
toolCallToolUseBlock工具调用(类型 `ToolUseBlock`)。The tool call.
rulesList<PermissionRule>规则(类型 `List`)。The rules.
源码Source io/agentscope/core/event/ConfirmResult.java:55–57

ConfirmResult

public ConfirmResult(boolean confirmed, ToolUseBlock toolCall)

初始化 ConfirmResult 实例。

Convenience constructor without rules.

参数Parameters
名称Name类型Type说明Description
confirmedbooleanconfirmed(类型 `boolean`)。The confirmed.
toolCallToolUseBlock工具调用(类型 `ToolUseBlock`)。The tool call.
源码Source io/agentscope/core/event/ConfirmResult.java:60–62

方法详情Method Detail

isConfirmed

public boolean isConfirmed()

判断是否 isConfirmed。

Returns whether the confirmed.

返回Returns boolean
返回布尔值,表示判断结果。Returns a boolean result.
源码Source io/agentscope/core/event/ConfirmResult.java:64–66

getToolCall

public ToolUseBlock getToolCall()

获取工具调用。

Returns the tool call.

返回Returns ToolUseBlock
返回ToolUseBlock。Returns tool use block.
源码Source io/agentscope/core/event/ConfirmResult.java:68–70

getRules

public List<PermissionRule> getRules()

获取规则。

New permission rules to register with the engine when #confirmed is true.

返回Returns List<PermissionRule>
返回列出。list of rules (may be null or empty)
源码Source io/agentscope/core/event/ConfirmResult.java:78–80

getReason

public String getReason()

获取推理。

Optional human-readable reason for a denial (#confirmed == false).

返回Returns String
返回字符串结果。the denial reason, or null when not supplied
源码Source io/agentscope/core/event/ConfirmResult.java:90–92
基于官方固定版本源码静态生成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.