Skip to content

[BUG] A2A streaming drops output type and message metadata at the server boundary #26

Open

Description

@Aias00

背景

迁移自上游遗留问题 alibaba/spring-ai-alibaba#4400。当前 ARGI core 已通过原上游 PR #4761 为远程文本 chunk 合成 AGENT_MODEL_STREAMING 类型,但端到端 metadata 仍然在 Extensions 服务端被丢弃。

当前行为

GraphAgentExecutor.ReactAgentNodeOutputConsumer 收到 StreamingOutput 后只读取:

content = ((StreamingOutput) nodeOutput).chunk();

随后创建只有文本的 Part,并传入空 metadata:

taskUpdater.addArtifact(
        Collections.singletonList(new TextPart(content)),
        null,
        artifactId,
        Map.of());

当前代码位置:

starters/argi-starter-a2a-nacos/.../GraphAgentExecutor.java:305-325

这会丢失:

  • StreamingOutput#getOutputType() 的原始类型;
  • StreamingOutput#getMessage() 及 AssistantMessage.metadata;
  • reasoningContent、工具流事件类型等下游区分流式阶段所需的信息。

客户端只能把收到的纯文本统一合成为 AGENT_MODEL_STREAMING,无法恢复服务端原始语义。

影响

  • 本地 Agent 与 A2A RemoteAgent 的流式事件契约不一致。
  • 调用方无法区分 reasoning、最终文本、工具相关输出等类型。
  • 任何依赖 message metadata 的 UI、观测或中间件在 A2A 链路中失效。

期望

在 A2A artifact/part metadata 中定义稳定、版本化的 ARGI 流式信封,至少传递:

  • output type;
  • message metadata;
  • agent/node 标识;
  • 必要时的 token usage 或其他兼容字段。

对应的 ARGI core 客户端应解析该信封;遇到旧服务端时继续回退到当前纯文本行为。

验收建议

  • A2A server → protocol event → A2A client 的端到端测试保留 output type 和 message metadata。
  • 覆盖 reasoning metadata、普通模型 chunk 和工具输出。
  • 对未携带扩展 metadata 的第三方 A2A 服务保持兼容。
  • 明确扩展字段版本与 JSON 结构,避免绑定 Java 类序列化格式。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions