AS AgentScopeAPI 手册 / API Reference

LocalApprovalGate

public class LocalApprovalGate implements SkillPromotionGate
源码Source io/agentscope/harness/agent/skill/curator/LocalApprovalGate.java:38–131

本地 Approval Gate,让智能体以受控方式调用外部能力。位于 io.agentscope.harness.agent.skill.curator 包,实现 SkillPromotionGate。核心成员包括 review、defaultPrompter、stdinPrompter、getTargetEnvironments、LocalApprovalGate。

Single-replica HITL gate. Calls a user-supplied prompter function that returns approve / reject from human input (terminal, CLI, IDE prompt, …). Defers if the prompter times out.

The default constructor wires a no-op prompter that always defers. Real deployments should supply a prompter that bridges to whatever HITL surface is available — typically via RequestStopEvent so the agent's outer loop can pause for the prompt.

嵌套类摘要Nested Class Summary

类Class类型Kind说明Description
Prompter接口interface
定义 Prompter契约的接口。
An interface in io.agentscope.harness.agent.skill.curator that defines the contract for components that lets agents invoke external capabilities under control.

构造器摘要Constructor Summary

构造器Constructor说明Description
public LocalApprovalGate()
初始化 `LocalApprovalGate` 实例。
Creates a new instance.
public LocalApprovalGate(Duration timeout)
初始化 `LocalApprovalGate` 实例。
Creates a new instance.
public LocalApprovalGate(Duration timeout, Prompter prompter, List<String> targetEnvironments)
初始化 `LocalApprovalGate` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public Mono<PromotionDecision> review(SkillCandidate candidate, RuntimeContext ctx)
执行 `review` 方法。
Performs the review operation.
public static Prompter defaultPrompter()
static
返回 `defaultPrompter` 结果。
Default prompter: never approves.
public static Prompter stdinPrompter(java.io.InputStream in, java.io.PrintStream out)
static
执行 `stdinPrompter` 方法。
Sample prompter: stdin yes/no.
public List<String> getTargetEnvironments()
获取目标环境。
Returns the target environments.

构造器详情Constructor Detail

LocalApprovalGate

public LocalApprovalGate()

初始化 LocalApprovalGate 实例。

Creates a new instance.

源码Source io/agentscope/harness/agent/skill/curator/LocalApprovalGate.java:50–52

LocalApprovalGate

public LocalApprovalGate(Duration timeout)

初始化 LocalApprovalGate 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
timeoutDuration超时时间(类型 `Duration`)。The timeout.
源码Source io/agentscope/harness/agent/skill/curator/LocalApprovalGate.java:54–56

LocalApprovalGate

public LocalApprovalGate(Duration timeout, Prompter prompter, List<String> targetEnvironments)

初始化 LocalApprovalGate 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
timeoutDuration超时时间(类型 `Duration`)。The timeout.
prompterPrompterprompter(类型 `Prompter`)。The prompter.
targetEnvironmentsList<String>目标环境(类型 `List`)。The target environments.
源码Source io/agentscope/harness/agent/skill/curator/LocalApprovalGate.java:58–63

方法详情Method Detail

review

public Mono<PromotionDecision> review(SkillCandidate candidate, RuntimeContext ctx)

执行 review 方法。

Performs the review operation.

参数Parameters
名称Name类型Type说明Description
candidateSkillCandidatecandidate(类型 `SkillCandidate`)。The candidate.
ctxRuntimeContext运行时上下文(类型 `RuntimeContext`)。The ctx.
返回Returns Mono<PromotionDecision>
返回Mono。Returns mono.
源码Source io/agentscope/harness/agent/skill/curator/LocalApprovalGate.java:65–80

defaultPrompter

public static Prompter defaultPrompter()
static

返回 defaultPrompter 结果。

Default prompter: never approves.

返回Returns Prompter
返回Prompter。Returns prompter.
源码Source io/agentscope/harness/agent/skill/curator/LocalApprovalGate.java:83–88

stdinPrompter

public static Prompter stdinPrompter(java.io.InputStream in, java.io.PrintStream out)
static

执行 stdinPrompter 方法。

Sample prompter: stdin yes/no.

参数Parameters
名称Name类型Type说明Description
injava.io.InputStreamin(类型 `java.io.InputStream`)。The in.
outjava.io.PrintStreamout(类型 `java.io.PrintStream`)。The out.
返回Returns Prompter
返回Prompter。Returns prompter.
源码Source io/agentscope/harness/agent/skill/curator/LocalApprovalGate.java:91–126

getTargetEnvironments

public List<String> getTargetEnvironments()

获取目标环境。

Returns the target environments.

返回Returns List<String>
返回列出。Returns list.
源码Source io/agentscope/harness/agent/skill/curator/LocalApprovalGate.java:128–130

嵌套类详情Nested Class Detail

Prompter

@FunctionalInterface public interface Prompter extends Function<SkillCandidate, CompletableFuture<PromotionDecision>>

定义 Prompter契约的接口。位于 io.agentscope.harness.agent.skill.curator 包,实现 Function<SkillCandidate, CompletableFuture<PromotionDecision>>。

An interface in io.agentscope.harness.agent.skill.curator that defines the contract for components that lets agents invoke external capabilities under control. Declared in io.agentscope.harness.agent.skill.curator. Implements Function<SkillCandidate, CompletableFuture>.

基于官方固定版本源码静态生成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.