How should custom data- parts stream with WorkflowAgent?

未关闭
#5,377 1 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
46/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
typescript

调研方向

Start with the WorkflowAgent migration notes, the Streaming Updates from Tools documentation, and the createModelCallToUIChunkTransform implementation mentioned in the issue. Compare the transform behavior with workflow-examples PR #53 and investigate how stream parts relate to result.steps and WorkflowChatTransport reconnects. Done means documenting or implementing a supported way to stream, reconnect, and persist custom data parts, including those emitted outside tool calls.

由索引模型根据 Issue 内容生成。

描述

We're moving a multi-turn agent from DurableAgent to WorkflowAgent (ai 7.0.163, @ai-sdk/workflow 2.0.95, workflow 5.4.0). We follow the chat-session-modeling and message-queueing docs: one long-lived run per chat, a hook feeding a queue, prepareStep draining it, and createModelCallToUIChunkTransform at the route.

Our workflow writes app-specific data-* parts to the run stream. Some come from inside tools, but many come from steps outside any tool call.

On DurableAgent they streamed live next to the model output. On WorkflowAgent, createModelCallToUIChunkTransform maps any part type it doesn't know to nothing, so they're dropped. We confirmed this in a test app and in the transform's source.

Questions:

  1. What's the recommended way to show custom data-* parts live with WorkflowAgent, including parts written from steps outside a tool call, so they also survive a reconnect with WorkflowChatTransport? Is passing data-* through the transform, as PR #53 does, supported?
  2. How do we save and persist these custom data parts? It’s not captured as part of the result.steps from WorkflowAgent.

What we've found:

  • The Streaming Updates from Tools page still says to write data-* chunks with getWritable() into the agent's stream. With the stock transform, those never reach the client.
  • The v7 migration notes say the stream moved to ModelCallStreamPart "to avoid baking a UI protocol into the workflow payload". They don't say where custom UI data should go instead.
  • workflow-examples PR #53 (flight-booking-app, closed without merging) copies the transform into lib/chat-stream.ts and forwards data-* parts unchanged.
  • eve and durable-harness sidestep the question. Neither uses WorkflowAgent: each runs ToolLoopAgent inside its own session runtime on Workflow 5 and writes its own event protocol to the run stream.
主要语言
TypeScript
星标
2.5k
派生
401
平均合并
1 天 21 小时
30 天内合并 PR
201

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

vercel/workflow 的其他 Issue

查看 vercel/workflow 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。