AS AgentScopeAPI 手册 / API Reference

WorkbenchTools

public class WorkbenchTools
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchTools.java:45–192

Workbench 工具,封装可被智能体调用的能力。位于 io.agentscope.examples.copilotkit.workbench 包。核心成员包括 queryServiceMetrics、updateWorkbenchBrief、setPlanGoal、deployRelease、purgeProductionData、renderDashboard。

The workbench tool belt.

Each tool exercises a different AgentScope 2.0 capability and is wired to a matching permission rule in AgentConfiguration:

  • query_service_metrics — read-only, auto-allowed

  • update_workbench_brief — writes shared state, streamed to the browser as STATE_DELTA

  • deploy_release — ASK rule, suspends the run into an AG-UI interrupt

  • purge_production_data — DENY rule, never reaches this class

  • render_dashboard — generative UI through A2UI

AgentState is injected by the framework and carries the AG-UI thread id as its session id, which is how each tool finds the right WorkbenchState.

构造器摘要Constructor Summary

构造器Constructor说明Description
public WorkbenchTools(WorkbenchStateRegistry registry, A2uiComposer composer)
初始化 `WorkbenchTools` 实例。
Creates a new instance.

方法摘要Method Summary

方法Method说明Description
public String queryServiceMetrics(String service, String window, AgentState state)
查询服务指标。
Reads simulated service metrics.
public String updateWorkbenchBrief(String topic, String priority, String status, AgentState state)
更新 `updateWorkbenchBrief`。
Updates the shared brief shown in the browser.
public String setPlanGoal(String goal, AgentState state)
设置计划目标。
Records the goal the current plan is working towards.
public String deployRelease(String service, String version, AgentState state)
执行 `deployRelease` 方法。
Simulates a production release; gated by an `ASK` permission rule.
public String purgeProductionData(String dataset)
设置该参数。
Destructive operation kept behind a `DENY` rule so the demo can show a hard block.
public String renderDashboard(String intent, AgentState state)
渲染 `renderDashboard`。
Generates an A2UI surface and pushes it to the browser as an `a2ui-surface` activity.

构造器详情Constructor Detail

WorkbenchTools

public WorkbenchTools(WorkbenchStateRegistry registry, A2uiComposer composer)

初始化 WorkbenchTools 实例。

Creates a new instance.

参数Parameters
名称Name类型Type说明Description
registryWorkbenchStateRegistry注册表(类型 `WorkbenchStateRegistry`)。The registry.
composerA2uiComposercomposer(类型 `A2uiComposer`)。The composer.
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchTools.java:50–53

方法详情Method Detail

queryServiceMetrics

public String queryServiceMetrics(String service, String window, AgentState state)

查询服务指标。

Reads simulated service metrics.

参数Parameters
名称Name类型Type说明Description
serviceString服务(类型 `String`)。the service to inspect
windowStringwindow(类型 `String`)。the time window, e.g. `1h` or `24h`
stateAgentState状态对象(类型 `AgentState`)。injected agent state
返回Returns String
返回字符串结果。a human-readable metric summary
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchTools.java:63–82

updateWorkbenchBrief

public String updateWorkbenchBrief(String topic, String priority, String status, AgentState state)

更新 updateWorkbenchBrief。

Updates the shared brief shown in the browser.

参数Parameters
名称Name类型Type说明Description
topicString主题(类型 `String`)。new topic, optional
priorityString优先级(类型 `String`)。new priority (低 / 中 / 高), optional
statusString状态(类型 `String`)。new status text, optional
stateAgentState状态对象(类型 `AgentState`)。injected agent state
返回Returns String
返回字符串结果。confirmation of the merged brief
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchTools.java:93–104

setPlanGoal

public String setPlanGoal(String goal, AgentState state)

设置计划目标。

Records the goal the current plan is working towards.

参数Parameters
名称Name类型Type说明Description
goalString计划目标。the plan goal
stateAgentState状态对象(类型 `AgentState`)。injected agent state
返回Returns String
返回字符串结果。confirmation
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchTools.java:113–122

deployRelease

public String deployRelease(String service, String version, AgentState state)

执行 deployRelease 方法。

Simulates a production release; gated by an ASK permission rule.

参数Parameters
名称Name类型Type说明Description
serviceString服务(类型 `String`)。target service
versionString版本(类型 `String`)。release version
stateAgentState状态对象(类型 `AgentState`)。injected agent state
返回Returns String
返回字符串结果。the release result
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchTools.java:132–143

purgeProductionData

public String purgeProductionData(String dataset)

设置该参数。

Destructive operation kept behind a DENY rule so the demo can show a hard block.

参数Parameters
名称Name类型Type说明Description
datasetStringdataset(类型 `String`)。dataset name
返回Returns String
返回字符串结果。never returned in practice
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchTools.java:151–158

renderDashboard

public String renderDashboard(String intent, AgentState state)

渲染 renderDashboard。

Generates an A2UI surface and pushes it to the browser as an a2ui-surface activity.

参数Parameters
名称Name类型Type说明Description
intentStringintent(类型 `String`)。what the surface should show
stateAgentState状态对象(类型 `AgentState`)。injected agent state
返回Returns String
返回字符串结果。a short summary for the model
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchTools.java:167–191
基于官方固定版本源码静态生成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.