A2A Agent Card Proto 字段编号:v0.3.0 与 v1.0.1
在 protobuf 中,线路上用来标识字段的是字段编号,而不是名称。这对 gRPC 绑定和任何由 a2a.proto 生成的代码都很重要。JSON-RPC 与 HTTP+JSON 绑定使用 camelCase 名称,所以对它们来说,下面的重命名有影响,编号则没有。
官方迁移指南按名称列出字段变化。本页补上编号,数据取自两个 a2a.proto 文件本身(v0.3.0 标签与 v1.0.1 标签)。本页涉及的所有消息,v1.0.0 标签的定义与 v1.0.1 相同。
扩展 Agent Card 标志去哪了?
- v0.3.0:
AgentCard.supports_authenticated_extended_card,bool,13 号字段。 - v1.0.0 与 v1.0.1:
AgentCapabilities.extended_agent_card,optional bool,4 号字段。
规范的迁移附录(A.2.2)描述了同一次迁移,但细节与 proto 文件不一致:
| 移除 | 新增 | |
|---|---|---|
| v1.0.1 规范的附录 A.2.2 | AgentCard.supports_extended_agent_card(13 号字段) | AgentCapabilities.extended_agent_card(5 号字段) |
v0.3.0 与 v1.0.1 的 a2a.proto | AgentCard.supports_authenticated_extended_card(13 号字段) | AgentCapabilities.extended_agent_card(4 号字段) |
附录的旧字段编号是对的,但给旧字段起的名字与 v0.3.0 实际使用的不同,新字段编号写成了 5,而 proto 是 4。AgentCapabilities 的字段是 1 至 4 号,没有 5 号字段。规范明确 a2a.proto 是"唯一权威的规范性定义"(第 1.4 节),请以 proto 为准:4。
AgentCard
| 编号 | v0.3.0 | v1.0.1 | 变化 |
|---|---|---|---|
| 1 | name | name | |
| 2 | description | description | |
| 3 | url(string) | supported_interfaces(repeated AgentInterface) | 编号被复用于不同的字段和类型 |
| 4 | provider | provider | |
| 5 | version | version | |
| 6 | documentation_url | documentation_url | 现为 optional |
| 7 | capabilities | capabilities | |
| 8 | security_schemes | security_schemes | |
| 9 | security(repeated Security) | security_requirements(repeated SecurityRequirement) | 重命名;结构相同 |
| 10 | default_input_modes | default_input_modes | |
| 11 | default_output_modes | default_output_modes | |
| 12 | skills | skills | |
| 13 | supports_authenticated_extended_card(bool) | signatures(repeated AgentCardSignature) | 编号被复用于不同的字段和类型 |
| 14 | preferred_transport(string) | icon_url(optional string) | 编号被复用;两者都是字符串 |
| 15 | additional_interfaces | 未使用 | 并入 supported_interfaces |
| 16 | protocol_version | 未使用 | 移到 AgentInterface.protocol_version |
| 17 | signatures | 未使用 | 移到 13 号字段 |
AgentCapabilities
| 编号 | v0.3.0 | v1.0.1 | 变化 |
|---|---|---|---|
| 1 | streaming(bool) | streaming(optional bool) | 现为 optional |
| 2 | push_notifications(bool) | push_notifications(optional bool) | 现为 optional |
| 3 | extensions | extensions | |
| 4 | 无 | extended_agent_card(optional bool) | 新增;见上文 |
AgentInterface
| 编号 | v0.3.0 | v1.0.1 | 变化 |
|---|---|---|---|
| 1 | url | url | |
| 2 | transport | protocol_binding | 重命名 |
| 3 | 无 | tenant | 新增 |
| 4 | 无 | protocol_version | 新增;取代 AgentCard.protocol_version(16 号字段) |
AgentSkill
1 至 7 号字段完全相同。8 号字段从 security(repeated Security)变为 security_requirements(repeated SecurityRequirement);见 AgentSkill
。
未变化的消息
下列消息在 v0.3.0 与 v1.0.1 中的字段名称、编号和类型完全一致:AgentProvider、AgentExtension 和 AgentCardSignature。
可以得出的结论
- 三个编号的含义变了。 3 号字段从字符串变成消息列表,13 号字段从 bool 变成消息列表,14 号字段从一个字符串变成另一个字符串。用一个定义写出的字节,按另一个定义生成的代码去读,可能读错值或解析失败。接口会声明
protocol_version,请求还带有A2A-Version服务参数,服务器因此能分辨客户端使用的是哪个定义。 - 没有保留任何编号。 v1.0.1 的 proto 中没有
reserved语句。AgentCard的 15、16、17 号只是闲置,消息里写着注释Next ID: 20;文件中没有任何内容阻止后续修改复用它们。 optional的作用不止风格。 规范第 5.7 节给出了使用该关键字的两个理由:默认值与 protobuf 隐式默认值不同的字段,以及 Agent Card 签名,optional用来区分显式设置的字段(属于规范化形式)与被省略的字段。在 v1.0.1 中,streaming、push_notifications、extended_agent_card、documentation_url和icon_url都是optional。见 Agent Card 签名 。
自行核对
git clone https://github.com/a2aproject/A2A && cd A2A
git show v0.3.0:specification/grpc/a2a.proto | sed -n '/^message AgentCard {/,/^}/p'
git show v1.0.1:specification/a2a.proto | sed -n '/^message AgentCard {/,/^}/p'
git show v1.0.1:specification/a2a.proto | sed -n '/^message AgentCapabilities {/,/^}/p'v0.3.0 的 proto 位于 specification/grpc/ 下;从 v1.0 起为 specification/a2a.proto。
相关页面
- Agent Card :卡片本身,含 JSON 层面的迁移对照表。
- A2A v1.0 有哪些变化 :完整的迁移指南,按字段名称列出。
- A2A SecurityScheme
:
security到securityRequirements重命名的详细说明。
来源:a2a.proto 的 v0.3.0
、v1.0.0
与 v1.0.1
版本;A2A 官方规范:Normative Content、Field Presence and Optionality、Appendix A.2