AS AgentScopeAPI 手册 / API Reference

WorkbenchAguiEventConverter

@Component public class WorkbenchAguiEventConverter implements AgentEventConverter
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchAguiEventConverter.java:54–175

Workbench AGUI 事件转换器,把智能体接入外部消息渠道与企业平台。位于 io.agentscope.examples.copilotkit.workbench 包,实现 AgentEventConverter。核心成员包括 eventTypes、convert、forgetRun、ACTIVITY_A2UI_SURFACE。

Maps the workbench's CustomEvents onto the AG-UI frames a CopilotKit client understands.

This is the one place where the example decides which AG-UI event best expresses each piece of agent progress:

  • state_updated → STATE_SNAPSHOT for the first frame of a run, then STATE_DELTA (RFC 6902) for every later change, so the browser only pays for what actually moved

  • plan_step_started / plan_step_finished → STEP_STARTED / STEP_FINISHED, giving plan tasks a first-class lifecycle on the wire

  • a2ui_surface → ACTIVITY_SNAPSHOT of type a2ui-surface, which is how generated UI reaches the A2UI renderer

  • permission_audit → CUSTOM, consumed by the audit panel

Snapshot bookkeeping is keyed by threadId:runId. Entries are dropped as soon as a run finishes, so a long-lived server does not accumulate them.

字段摘要Field Summary

字段Field类型Type说明Description
ACTIVITY_A2UI_SURFACE
staticfinal
String
ACTIVITY A 2 UI SURFACE字段。
AG-UI activity type paired with `useRenderActivity("a2ui-surface")` in the browser.

方法摘要Method Summary

方法Method说明Description
public Set<Class<? extends AgentEvent>> eventTypes()
返回事件类型。
Returns the event types.
public void convert(AgentEvent event, AguiStreamContext context)
执行转换相关操作。
Performs the convert operation.
public void forgetRun(String threadId, String runId)
执行 `forgetRun` 方法。
Drops the per-run snapshot baseline; called when the run ends.

字段详情Field Detail

ACTIVITY_A2UI_SURFACE

public static final String ACTIVITY_A2UI_SURFACE
staticfinal

ACTIVITY A 2 UI SURFACE字段。声明为 public static final String ACTIVITY_A2UI_SURFACE。

AG-UI activity type paired with useRenderActivity("a2ui-surface") in the browser.

源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchAguiEventConverter.java:58

方法详情Method Detail

eventTypes

public Set<Class<? extends AgentEvent>> eventTypes()

返回事件类型。

Returns the event types.

返回Returns Set<Class<? extends AgentEvent>>
返回设置>。Returns set.
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchAguiEventConverter.java:62–65

convert

public void convert(AgentEvent event, AguiStreamContext context)

执行转换相关操作。

Performs the convert operation.

参数Parameters
名称Name类型Type说明Description
eventAgentEvent事件(类型 `AgentEvent`)。The event.
contextAguiStreamContext上下文(类型 `AguiStreamContext`)。The context.
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchAguiEventConverter.java:67–89

forgetRun

public void forgetRun(String threadId, String runId)

执行 forgetRun 方法。

Drops the per-run snapshot baseline; called when the run ends.

参数Parameters
名称Name类型Type说明Description
threadIdString会话线程标识(类型 `String`)。The thread id.
runIdString运行标识(类型 `String`)。The run id.
源码Source io/agentscope/examples/copilotkit/workbench/WorkbenchAguiEventConverter.java:92–94
基于官方固定版本源码静态生成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.