AS AgentScopeAPI 手册 / API Reference

A2uiSchemaSource

public interface A2uiSchemaSource
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiSchemaSource.java:31–57

定义 A 2 ui 模式来源契约的接口。位于 io.agentscope.examples.copilotkit.a2ui 包。核心成员包括 name、systemPrompt、parse。

Supplies the A2UI grammar shown to the model and turns the reply back into a checked payload.

The default implementation is BundledA2uiSchemaSource: a hand-written grammar plus the structural checks in A2uiOperations.

Prompting and parsing are deliberately one contract rather than two: a grammar is only meaningful next to the validator that enforces it.

方法摘要Method Summary

方法Method说明Description
public String name()
返回名称。
Short identifier surfaced to the browser so the demo can show which path is active.
public String systemPrompt(Set<String> clientComponents)
设置系统提示词。
Builds the system prompt for the A2UI composer.
public List<Map<String, Object>> parse(String rawModelReply, String surfaceId, Set<String> clientComponents)
执行解析相关操作。
Parses and validates a raw model reply.

方法详情Method Detail

name

public String name()

返回名称。

Short identifier surfaced to the browser so the demo can show which path is active.

返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiSchemaSource.java:34

systemPrompt

public String systemPrompt(Set<String> clientComponents)

设置系统提示词。

Builds the system prompt for the A2UI composer.

参数Parameters
名称Name类型Type说明Description
clientComponentsSet<String>客户端 Components(类型 `Set`)。the custom components the browser declared it can render; empty means no restriction, so the full server-side catalog is advertised
返回Returns String
返回字符串结果。Returns a string.
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiSchemaSource.java:42

parse

public List<Map<String, Object>> parse(String rawModelReply, String surfaceId, Set<String> clientComponents)

执行解析相关操作。

Parses and validates a raw model reply.

参数Parameters
名称Name类型Type说明Description
rawModelReplyString原始模型回复(类型 `String`)。the model's full answer, expected to carry a ` ` block
surfaceIdStringsurface 标识(类型 `String`)。the id the caller allocated; operations are rewritten onto it so a model that invents its own id still produces a surface the browser can address
clientComponentsSet<String>客户端 Components(类型 `Set`)。components the browser can render, used to scope validation
返回Returns List<Map<String, Object>>
返回列出>。the A2UI server-to-client messages, ready to be put on the wire
抛出Throws
  • RuntimeException 可能抛出 `RuntimeException`。when the reply is unusable, which makes the composer fall through to the next model client and finally to the deterministic fallback
源码Source io/agentscope/examples/copilotkit/a2ui/A2uiSchemaSource.java:55–56
基于官方固定版本源码静态生成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.