agentscope-java icon indicating copy to clipboard operation
agentscope-java copied to clipboard

[Bug]:前端无法区分是哪个子agent的消息

Open caojipian opened this issue 1 month ago • 4 comments

Image source是由父agent的sessionId/子agent名称拼接的,同一个会话父agent是一样的,前端无法区分是哪个子agent的消息,无法分块显示,如果是BUG请修复,如果不是BUG请告知一下如何区分

caojipian avatar Oct 26 '26 09:10 caojipian

Image这是我临时覆盖工具的方案

caojipian avatar Oct 26 '26 11:10 caojipian

Hi — this is answerable as a usage question plus a small enhancement opportunity rather than a clear defect: the AG-UI source is parent-session-scoped by design, but subagent identity IS available. Quick answer: the subagent name travels in the message metadata / agentName field (what caojipian's tool-override workaround surfaces), so a frontend can group by that today. If maintainers agree the source should carry the subagent segment (e.g. parentSessionId/subagentName), that's a small protocol addition I can PR — please confirm the desired shape.

aiyili avatar Oct 28 '26 12:10 aiyili

3. Hi — this is answerable as a usage question plus a small enhancement opportunity rather than a clear defect: the AG-UI source is parent-session-scoped by design, but subagent identity IS available. Quick answer: the subagent name travels in the message metadata / agentName field (what caojipian's tool-override workaround surfaces), so a frontend can group by that today. If maintainers agree the source should carry the subagent segment (e.g. parentSessionId/subagentName), that's a small protocol addition I can PR — please confirm the desired shape.

前端需要拿到子agent的会话ID做为区分就可以,其它的内容框架设计者可以思考下还需要加入什么,加入这个的目的就是前端需要给子agent的输出内容做分组显示

caojipian avatar Oct 31 '26 06:10 caojipian

Implemented per your confirmation — PR #3887 adds the subagent session id to AG-UI events:

  • New well-known metadata key subagentSessionId on the forwarded events (the per-spawn instance id, stable across agent_send follow-ups; the source string format is unchanged).
  • SubagentEventConverter surfaces it on AGENT_START and TEXT_BLOCK_DELTA — your frontend groups on value.subagentSessionId, falling back to source when absent.

For the framework designers' "what else" question, the same metadata convention can cheaply carry agentId (the declared type) and depth from the existing EventSource if consumers want them — I kept this PR to the session id you asked for, but the extension point is one withMetadataEntry line each.

aiyili avatar Oct 31 '26 12:10 aiyili