Skip to content
Source
Sign inSign up
TanStack/ai

Add Workflow-backed AI orchestration #979

Opentannerlinsleywants to merge 7 commits intomain fromtaren/workflow-orchestration-rfcopened View on GitHub

tannerlinsleycommented

RFC

Read the Workflow-backed AI orchestration RFC

This PR is the RFC plus a small experimental implementation that proves the proposed boundary: TanStack Workflow owns durable execution, while TanStack AI owns agent ergonomics, AI persistence, and AG-UI projection.

Authoring model decision: async handlers and the context API are the sole workflow syntax. A generator/yield* DSL is rejected and is not planned as optional sugar.

Decisions requested

  • AI persistence ownership and public contract
  • interrupt and approval envelope
  • AI run ID correlation
  • token attempt/reset and publisher failure semantics
  • durable boundaries inside long model/tool loops
  • child workflow semantics

Implementation included

  • experimental @tanstack/ai-orchestration package
  • defineAgent() and Workflow middleware exposing ctx.ai.agent()
  • Workflow-to-AG-UI event projection and publisher adapter
  • replay, approval resume, deadline yield, publishing, type, and provider-free E2E coverage

This supersedes #542: no second workflow engine, store contract, generator DSL, or parallel authoring model.

Depends on the merged TanStack/workflow#15 for runtime event publishing and stale-lease recovery.

Validation

  • pnpm test:pr
  • pnpm --filter @tanstack/ai-e2e test:e2e
  • RFC formatting and repository link validation
  • all GitHub checks passing before this RFC-only update
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Draft PR not reviewed

      Draft PRs are not automatically reviewed by default.

      • Trigger a manual review

      To automatically review draft PRs, update your CodeRabbit configuration:

      reviews:
        auto_review:
          drafts: true
      ✨ Finishing Touches
      🧪 Generate unit tests (beta)
      • Create PR with unit tests
      • Commit unit tests in branch `taren/workflow-orchestration-rfc`
      • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

      Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

      ❤️ Share
      Comment `@coderabbitai help` to get the list of available commands.
    2. github-actions[bot](GitHub profile, opens in a new tab)commented

      🚀 Changeset Version Preview

      14 package(s) bumped directly, 36 bumped as dependents.

      🟥 Major bumps

      PackageVersionReason
      @tanstack/ai-angular0.3.1 → 1.0.0Changeset
      @tanstack/ai-durable-stream0.0.0 → 1.0.0Changeset
      @tanstack/ai-memory0.0.0 → 1.0.0Changeset
      @tanstack/ai-openrouter0.15.10 → 1.0.0Changeset
      @tanstack/ai-orchestration0.0.0 → 1.0.0Changeset
      @tanstack/ai-preact0.11.1 → 1.0.0Changeset
      @tanstack/ai-react0.18.1 → 1.0.0Changeset
      @tanstack/ai-solid0.15.1 → 1.0.0Changeset
      @tanstack/ai-svelte0.15.1 → 1.0.0Changeset
      @tanstack/ai-vue0.15.1 → 1.0.0Changeset
      @tanstack/ai-acp0.2.3 → 1.0.0Dependent
      @tanstack/ai-anthropic0.16.3 → 1.0.0Dependent
      @tanstack/ai-bedrock0.1.4 → 1.0.0Dependent
      @tanstack/ai-claude-code0.2.3 → 1.0.0Dependent
      @tanstack/ai-code-mode0.3.8 → 1.0.0Dependent
      @tanstack/ai-code-mode-skills0.3.11 → 1.0.0Dependent
      @tanstack/ai-codex0.2.3 → 1.0.0Dependent
      @tanstack/ai-elevenlabs0.2.34 → 1.0.0Dependent
      @tanstack/ai-fal0.9.12 → 1.0.0Dependent
      @tanstack/ai-gemini0.20.1 → 1.0.0Dependent
      @tanstack/ai-grok0.14.9 → 1.0.0Dependent
      @tanstack/ai-grok-build0.2.3 → 1.0.0Dependent
      @tanstack/ai-groq0.5.3 → 1.0.0Dependent
      @tanstack/ai-isolate-node0.1.47 → 1.0.0Dependent
      @tanstack/ai-isolate-quickjs0.1.47 → 1.0.0Dependent
      @tanstack/ai-mistral0.2.3 → 1.0.0Dependent
      @tanstack/ai-ollama0.8.16 → 1.0.0Dependent
      @tanstack/ai-openai0.17.1 → 1.0.0Dependent
      @tanstack/ai-opencode0.2.3 → 1.0.0Dependent
      @tanstack/ai-react-ui0.8.15 → 1.0.0Dependent
      @tanstack/ai-sandbox0.2.4 → 1.0.0Dependent
      @tanstack/ai-sandbox-cloudflare0.2.4 → 1.0.0Dependent
      @tanstack/ai-sandbox-daytona0.2.0 → 1.0.0Dependent
      @tanstack/ai-sandbox-docker0.2.0 → 1.0.0Dependent
      @tanstack/ai-sandbox-local-process0.2.0 → 1.0.0Dependent
      @tanstack/ai-sandbox-sprites0.2.1 → 1.0.0Dependent
      @tanstack/ai-sandbox-vercel0.2.0 → 1.0.0Dependent
      @tanstack/ai-solid-ui0.7.14 → 1.0.0Dependent
      @tanstack/openai-base0.9.9 → 1.0.0Dependent

      🟨 Minor bumps

      PackageVersionReason
      @tanstack/ai0.42.0 → 0.43.0Changeset
      @tanstack/ai-client0.22.1 → 0.23.0Changeset
      @tanstack/ai-devtools-core0.4.24 → 0.5.0Changeset
      @tanstack/ai-event-client0.6.8 → 0.7.0Changeset

      🟩 Patch bumps

      PackageVersionReason
      @tanstack/ai-isolate-cloudflare0.2.38 → 0.2.39Dependent
      @tanstack/ai-mcp0.2.5 → 0.2.6Dependent
      @tanstack/ai-vue-ui0.2.34 → 0.2.35Dependent
      @tanstack/preact-ai-devtools0.1.67 → 0.1.68Dependent
      @tanstack/react-ai-devtools0.2.67 → 0.2.68Dependent
      @tanstack/solid-ai-devtools0.2.67 → 0.2.68Dependent
      ag-ui0.0.2 → 0.0.3Dependent
    3. socket-security[bot](GitHub profile, opens in a new tab)commented

      Review the following changes in direct dependencies. Learn more about Socket for GitHub.

      Diff Package Supply Chain
      Security
      Vulnerability Quality Maintenance License
      Addednpm/​@​vitest/​coverage-v8@​4.0.14991006998100
      Addednpm/​@​tanstack/​workflow-core@​0.0.4791009992100

      View full report

    4. nx-cloud[bot](GitHub profile, opens in a new tab)commented

      🤖 Nx Cloud AI Fix Eligible

      An automatically generated fix could have helped fix failing tasks for this run, but Self-healing CI is disabled for this workspace. Visit workspace settings to enable it and get automatic fixes in future runs.

      To disable these notifications, a workspace admin can disable them [in workspace settings.](https://cloud.nx.app/orgs/6412ca9d1c251d000efa21ba/workspaces/6928ccd60a2e27ab22f38ad0/settings/self-healing-ci?utm_source=pull-request&utm_medium=comment)

      View your CI Pipeline Execution ↗ for commit 6059872fe813e60d390837ed44e677f3adf04cc3

      CommandStatusDurationResult
      nx affected --targets=test:sherif,test:knip,tes...❌ Failed16m 33sView ↗
      nx run-many --targets=build --exclude=examples/...❌ Failed1m 47sView ↗
      nx run-many --targets=test:coverage --projects=...✅ Succeeded4sView ↗
      nx run-many --targets=test:coverage --projects=...✅ Succeeded7m 15sView ↗

      ☁️ Nx Cloud last updated this comment at 2026-10-22 12:58:45 UTC

    5. pkg-pr-new[bot](GitHub profile, opens in a new tab)commented

      Open in StackBlitz

      @tanstack/ai

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai@979

      @tanstack/ai-acp

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-acp@979

      @tanstack/ai-angular

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-angular@979

      @tanstack/ai-anthropic

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-anthropic@979

      @tanstack/ai-bedrock

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-bedrock@979

      @tanstack/ai-claude-code

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-claude-code@979

      @tanstack/ai-client

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-client@979

      @tanstack/ai-code-mode

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode@979

      @tanstack/ai-code-mode-skills

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-code-mode-skills@979

      @tanstack/ai-codex

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-codex@979

      @tanstack/ai-devtools-core

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-devtools-core@979

      @tanstack/ai-durable-stream

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-durable-stream@979

      @tanstack/ai-elevenlabs

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-elevenlabs@979

      @tanstack/ai-event-client

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-event-client@979

      @tanstack/ai-fal

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-fal@979

      @tanstack/ai-gemini

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-gemini@979

      @tanstack/ai-grok

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok@979

      @tanstack/ai-grok-build

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-grok-build@979

      @tanstack/ai-groq

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-groq@979

      @tanstack/ai-isolate-cloudflare

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-cloudflare@979

      @tanstack/ai-isolate-node

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-node@979

      @tanstack/ai-isolate-quickjs

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-isolate-quickjs@979

      @tanstack/ai-mcp

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mcp@979

      @tanstack/ai-memory

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-memory@979

      @tanstack/ai-mistral

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-mistral@979

      @tanstack/ai-ollama

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-ollama@979

      @tanstack/ai-openai

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openai@979

      @tanstack/ai-opencode

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-opencode@979

      @tanstack/ai-openrouter

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-openrouter@979

      @tanstack/ai-orchestration

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-orchestration@979

      @tanstack/ai-preact

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-preact@979

      @tanstack/ai-react

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react@979

      @tanstack/ai-react-ui

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-react-ui@979

      @tanstack/ai-sandbox

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox@979

      @tanstack/ai-sandbox-cloudflare

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-cloudflare@979

      @tanstack/ai-sandbox-daytona

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-daytona@979

      @tanstack/ai-sandbox-docker

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-docker@979

      @tanstack/ai-sandbox-local-process

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-local-process@979

      @tanstack/ai-sandbox-sprites

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-sprites@979

      @tanstack/ai-sandbox-vercel

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-sandbox-vercel@979

      @tanstack/ai-solid

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid@979

      @tanstack/ai-solid-ui

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-solid-ui@979

      @tanstack/ai-svelte

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-svelte@979

      @tanstack/ai-utils

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-utils@979

      @tanstack/ai-vue

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue@979

      @tanstack/ai-vue-ui

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/ai-vue-ui@979

      @tanstack/openai-base

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/openai-base@979

      @tanstack/preact-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/preact-ai-devtools@979

      @tanstack/react-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/react-ai-devtools@979

      @tanstack/solid-ai-devtools

      npm i https://pkg.pr.new/TanStack/ai/@tanstack/solid-ai-devtools@979

      commit: 53cc0b7

    6. jherr approved these changes

    7. tombeckenham reviewed

      @@ -0,0 +86,21 @@
      86+export const article = createWorkflow({
      87+ id: 'article',
      88+ input: z.object({ topic: z.string() }),
      89+})
      90+ .middleware([agentMiddleware()])
      91+ .handler(async (ctx) => {
      92+ const draft = await ctx.ai.agent('draft', writer, {
      93+ topic: ctx.input.topic,
      94+ })
      95+
      96+ const review = await ctx.approve({ title: 'Publish this article?' })
      97+ return { draft, approved: review.approved }
      98+ })
      99+```
      100+
      101+`ctx.ai` is the package-owned middleware namespace. Workflow core does not need
      102+to reserve every official integration name. A conflicting `ai` extension is a
      103+composition error visible in TypeScript, while Workflow's own fields remain
      104+reserved by core.
      105+
      106+The first argument to `ctx.ai.agent()` is the stable Workflow step ID. It is not
      tombeckenhamcommented

      Why does a workflow step id need to be explicit?

    8. tombeckenham reviewed

      @@ -0,0 +92,21 @@
      92+ const draft = await ctx.ai.agent('draft', writer, {
      93+ topic: ctx.input.topic,
      94+ })
      95+
      96+ const review = await ctx.approve({ title: 'Publish this article?' })
      97+ return { draft, approved: review.approved }
      98+ })
      99+```
      100+
      101+`ctx.ai` is the package-owned middleware namespace. Workflow core does not need
      102+to reserve every official integration name. A conflicting `ai` extension is a
      103+composition error visible in TypeScript, while Workflow's own fields remain
      104+reserved by core.
      105+
      106+The first argument to `ctx.ai.agent()` is the stable Workflow step ID. It is not
      107+an arbitrary batch position. Reordering code across deployed workflow versions
      108+still follows Workflow's normal versioning rules.
      109+
      110+## Agent execution semantics
      111+
      112+An agent call is one Workflow step.
      tombeckenhamcommented

      Is this one turn? Or all the turns

      tombeckenhamcommented

      The reason I ask is that an agent loop might have 5 interations. If it gets through 3, then fails, if the chat is inside the durable step, then those 3 steps are repeated. There's no durability inside the agent loop. e.g. an agent could call a tool in one loop which adds a todo item to a list. The user would have to make all tool calls indempotent to ensure the tool wasn't called a second time. If we could resume the loop, that could be avoided. That'd mean making the agent loop itself durable. You've said below that "Long autonomous loops need a later integration that exposes model turns and side-effecting tools as Workflow operations". Any idea how that might work?

    9. tombeckenham reviewed

      @@ -0,0 +197,21 @@
      197+
      198+TanStack AI persistence should own:
      199+
      200+- threads and messages,
      201+- tool-call and artifact projections,
      202+- interrupt records,
      203+- user-visible run metadata,
      204+- the mapping between AI run IDs and Workflow run IDs.
      205+
      206+That persistence layer can consume the same AG-UI projection used by clients.
      207+It must tolerate repeated delivery because transports and recovered steps can
      208+produce duplicate attempts.
      209+
      210+## Child workflows
      211+
      212+True child workflows are deferred. Wrapping a child run inside `ctx.step()` is
      213+not sufficient: cancellation, parent-child status, signals, leases, and replay
      214+all need first-class runtime semantics.
      215+
      216+Composition in the first release uses normal helper functions and agent calls
      217+inside one Workflow definition.
      tombeckenhamcommented

      Cloudflare's event model is a nice way to do child worfkows. If you have a way to send events, and wait for events, then it's easy to create a child model.

    10. Hi guys, here is the C for the RF: This is great and really happy you kept the plain async handler and didn't go down the mastra style graph builder route (.branch,.map,.commit stuff). One thing that isn't clear to me though: what does agentMiddleware() actually buy us? A workflow shouldn't need a middleware registered just to call an agent, if I'm not mistaken it exists only so ctx.ai typechecks, and the method itself just delegates to ctx.step(). I'd rather the agent be callable directly with the ctx, something like:

      const draft = await writer.step(ctx, { topic: ctx.input.topic })

      instead of .middleware([agentMiddleware()]) + ctx.ai.agent('draft', writer, ...), which makes it no registration and one less name at the call site (the step ID could default to the agent name and only be passed explicitly when the same agent runs twice), and it matches how workflow-core already handles shared helpers. Is there a reason the middleware/namespace approach was chosen that I'm missing?

      So overall will look like

      import { chat } from '@tanstack/ai'
      import { defineAgent } from '@tanstack/ai-orchestration'
      import { openaiText } from '@tanstack/ai-openai'
      import { createWorkflow } from '@tanstack/workflow-core'
      import { z } from 'zod'
      
      const writer = defineAgent({
        name: 'writer',
        input: z.object({ topic: z.string() }),
        output: z.object({ article: z.string() }),
        run: ({ input, abortController }) =>
          chat({
            adapter: openaiText('gpt-5.5'),
            messages: [{ role: 'user', content: `Write about ${input.topic}` }],
            outputSchema: z.object({ article: z.string() }),
            stream: true,
            abortController,
          }),
      })
      
      const editor = defineAgent({
        name: 'editor',
        input: z.object({ article: z.string(), feedback: z.string() }),
        output: z.object({ article: z.string() }),
        run: ({ input, abortController }) =>
          chat({
            adapter: openaiText('gpt-5.5'),
            messages: [
              {
                role: 'user',
                content: `Revise this article based on the feedback.\n\nArticle: ${input.article}\n\nFeedback: ${input.feedback}`,
              },
            ],
            outputSchema: z.object({ article: z.string() }),
            stream: true,
            abortController,
          }),
      })
      
      export const article = createWorkflow({
        id: 'article',
        input: z.object({ topic: z.string() }),
      }).handler(async (ctx) => {
        const draft = await writer.step(ctx, { topic: ctx.input.topic })
      
        const review = await ctx.approve({ title: 'Publish this article?' })
      
        if (review.approved) {
          return { article: draft.article, published: true }
        }
      
        if (!review.feedback) {
          return { article: draft.article, published: false }
        }
      
        const revised = await editor.step(ctx, {
          article: draft.article,
          feedback: review.feedback,
        })
      
        const second = await ctx.approve({ title: 'Publish the revised article?' })
        return { article: revised.article, published: second.approved }
      })
    11. changeset-bot[bot](GitHub profile, opens in a new tab)commented

      🦋 Changeset detected

      Latest commit: 6059872fe813e60d390837ed44e677f3adf04cc3

      The changes in this PR will be included in the next version bump.

      This PR includes changesets to release 1 package
      NameType
      @tanstack/ai-orchestrationMinor

      Not sure what this means? Click here to learn what changesets are.

      Click here if you're a maintainer who wants to add another changeset to this PR

    12. github-actions[bot](GitHub profile, opens in a new tab)commented

      Coverage

      ✅ Coverage held across 74 compared package(s).

      Each package is measured twice in this job — on this PR and on its merge-base with main — and compared. A metric fails only when it is at or above 60% on the merge-base and under 60% on this PR. Other drops are listed but do not fail. Packages your PR doesn't affect are not measured and not listed.

      packagestatementsbranchesfunctionslines
      ai91.94% (0.00)85.76% (0.00)92.11% (0.00)93.53% (0.00)ok
      ai-acp83.04% (0.00)71.25% (0.00)79.01% (0.00)84.93% (0.00)ok
      ai-angular73.83% (0.00)60.89% (0.00)61.83% (0.00)75.40% (0.00)ok
      ai-anthropic93.18% (0.00)88.26% (0.00)95.93% (0.00)93.69% (0.00)ok
      ai-bedrock90.05% (0.00)82.59% (0.00)94.20% (0.00)91.27% (0.00)ok
      ai-byteplus97.05% (0.00)91.62% (0.00)98.27% (0.00)98.48% (0.00)ok
      ai-claude-code88.90% (0.00)76.88% (0.00)86.66% (0.00)90.38% (0.00)ok
      ai-client87.81% (0.00)79.97% (0.00)87.01% (0.00)90.13% (0.00)ok
      ai-cloudflare85.71% (0.00)76.66% (0.00)85.48% (0.00)86.89% (0.00)ok
      ai-code-mode93.47% (0.00)85.63% (0.00)92.04% (0.00)94.44% (0.00)ok
      ai-code-mode-snippets87.13% (0.00)75.67% (0.00)91.11% (0.00)88.39% (0.00)ok
      ai-codex94.53% (0.00)85.10% (0.00)89.09% (0.00)95.54% (0.00)ok
      ai-cohere88.97% (0.00)88.37% (0.00)85.71% (0.00)91.80% (0.00)ok
      ai-compaction97.41% (0.00)92.89% (0.00)100.00% (0.00)98.89% (0.00)ok
      ai-computer-local97.29% (0.00)85.71% (0.00)88.00% (0.00)96.84% (0.00)ok
      ai-computer-playwright100.00% (0.00)100.00% (0.00)100.00% (0.00)100.00% (0.00)ok
      ai-computer-sandbox96.20% (0.00)84.37% (0.00)100.00% (0.00)95.94% (0.00)ok
      ai-computer-use96.95% (0.00)92.63% (0.00)100.00% (0.00)99.45% (0.00)ok
      ai-devtools83.13% (0.00)72.77% (0.00)87.07% (0.00)85.22% (0.00)ok
      ai-durable-stream86.70% (0.00)82.25% (0.00)92.30% (0.00)88.72% (0.00)ok
      ai-elevenlabs74.68% (0.00)69.59% (0.00)59.13% (0.00)75.46% (0.00)ok
      ai-event-client56.83% (0.00)48.07% (0.00)68.96% (0.00)58.33% (0.00)ok
      ai-fal91.10% (0.00)82.63% (0.00)92.40% (0.00)91.60% (0.00)ok
      ai-gemini67.97% (0.00)67.21% (0.00)63.83% (0.00)68.60% (0.00)ok
      ai-grok48.80% (0.00)53.49% (0.00)56.46% (0.00)49.63% (0.00)ok
      ai-grok-build79.14% (0.00)63.56% (0.00)76.99% (0.00)80.97% (0.00)ok
      ai-groq51.30% (0.00)47.73% (0.00)67.39% (0.00)53.42% (0.00)ok
      ai-harness93.83% (0.00)88.16% (0.00)93.59% (0.00)95.61% (0.00)ok
      ai-harness-cli91.08% (0.00)83.24% (0.00)83.85% (0.00)92.12% (0.00)ok
      ai-isolate-cloudflare94.11% (0.00)70.66% (0.00)100.00% (0.00)93.96% (0.00)ok
      ai-isolate-daytona90.25% (0.00)81.34% (+0.75)100.00% (0.00)90.15% (0.00)ok
      ai-isolate-e2b92.11% (0.00)82.22% (0.00)97.36% (0.00)95.05% (0.00)ok
      ai-isolate-node84.00% (0.00)43.39% (0.00)100.00% (0.00)83.78% (0.00)ok
      ai-isolate-quickjs89.07% (0.00)76.41% (0.00)90.90% (0.00)90.30% (0.00)ok
      ai-isolate-quickjs-bun7.76% (0.00)8.08% (0.00)5.00% (0.00)8.33% (0.00)ok
      ai-llmgateway97.77% (0.00)100.00% (0.00)88.88% (0.00)97.77% (0.00)ok
      ai-lovable73.21% (0.00)55.63% (0.00)85.07% (0.00)73.96% (0.00)ok
      ai-mcp94.69% (0.00)89.38% (0.00)96.80% (0.00)96.84% (0.00)ok
      ai-memory73.87% (0.00)52.70% (0.00)79.74% (0.00)76.04% (0.00)ok
      ai-mistral84.75% (0.00)79.82% (0.00)92.59% (0.00)85.39% (0.00)ok
      ai-octane91.19% (0.00)68.26% (0.00)87.44% (0.00)91.47% (0.00)ok
      ai-ollama93.80% (0.00)80.92% (0.00)90.62% (0.00)93.76% (0.00)ok
      ai-ollaya86.84% (0.00)89.28% (0.00)85.71% (0.00)91.66% (0.00)ok
      ai-openai65.12% (0.00)65.66% (0.00)66.99% (0.00)65.56% (0.00)ok
      ai-opencode70.50% (0.00)62.29% (0.00)66.32% (0.00)72.12% (0.00)ok
      ai-openrouter88.28% (0.00)73.44% (0.00)90.78% (0.00)90.23% (0.00)ok
      ai-orchestration82.40%58.73%87.50%83.05%new
      ai-perplexity91.34% (0.00)90.43% (0.00)100.00% (0.00)93.87% (0.00)ok
      ai-persistence92.06% (0.00)78.91% (0.00)97.81% (0.00)96.01% (0.00)ok
      ai-preact86.50% (0.00)71.00% (0.00)87.50% (0.00)87.98% (0.00)ok
      ai-react81.94% (0.00)65.42% (0.00)80.73% (0.00)82.67% (0.00)ok
      ai-reactor94.91% (0.00)83.33% (0.00)93.33% (0.00)96.55% (0.00)ok
      ai-remix43.02% (0.00)30.35% (0.00)39.02% (0.00)46.23% (0.00)ok
      ai-sandbox78.42% (-0.07)83.12% (-0.04)75.41% (-0.11)78.98% (-0.05)ok
      ai-sandbox-blaxel87.66% (0.00)77.18% (0.00)82.26% (0.00)89.69% (0.00)ok
      ai-sandbox-boxd96.01% (0.00)87.12% (0.00)95.31% (0.00)98.24% (0.00)ok
      ai-sandbox-cloudflare67.50% (0.00)57.27% (0.00)71.64% (0.00)68.66% (0.00)ok
      ai-sandbox-daytona81.04% (0.00)81.89% (0.00)67.60% (0.00)83.18% (0.00)ok
      ai-sandbox-docker82.34% (0.00)73.69% (0.00)79.82% (0.00)84.06% (0.00)ok
      ai-sandbox-e2b94.84% (0.00)89.70% (0.00)93.24% (0.00)98.64% (0.00)ok
      ai-sandbox-local-process69.27% (0.00)53.59% (0.00)77.01% (0.00)70.30% (0.00)ok
      ai-sandbox-railway94.87% (0.00)92.68% (0.00)90.90% (0.00)97.65% (0.00)ok
      ai-sandbox-sprites73.10% (0.00)59.70% (0.00)73.83% (0.00)75.95% (0.00)ok
      ai-sandbox-upstash-box94.61% (0.00)91.52% (0.00)91.04% (0.00)97.42% (0.00)ok
      ai-sandbox-vercel43.20% (0.00)38.18% (0.00)35.18% (0.00)44.08% (0.00)ok
      ai-skills83.94% (0.00)67.95% (0.00)88.00% (0.00)86.03% (0.00)ok
      ai-solid75.81% (0.00)57.63% (0.00)71.28% (0.00)78.11% (0.00)ok
      ai-svelte74.05% (0.00)50.99% (0.00)70.05% (0.00)78.64% (0.00)ok
      ai-typesafe78.04% (0.00)84.61% (0.00)66.66% (0.00)82.05% (0.00)ok
      ai-utils82.81% (0.00)75.64% (0.00)89.47% (0.00)84.21% (0.00)ok
      ai-vercel-gateway77.56% (0.00)63.38% (0.00)84.90% (0.00)80.76% (0.00)ok
      ai-vertex96.77% (0.00)97.22% (0.00)100.00% (0.00)96.77% (0.00)ok
      ai-vue73.33% (0.00)48.73% (0.00)73.28% (0.00)74.66% (0.00)ok
      ai-worldlabs79.62% (0.00)71.50% (0.00)91.42% (0.00)82.66% (0.00)ok
      openai-base91.03% (0.00)79.92% (0.00)97.80% (0.00)93.17% (0.00)ok

      No coverage on the base commit, so nothing to compare against: ai-orchestration.

    1. Applied a fix from CI37fc82f

    2. tanstack-sourceBotcommented Only here. This is not on GitHub.

      Resolved merge conflicts in two files.

      1. Kept both @tanstack/workflow-core and ai in testing/e2e/package.json.
      2. Updated pnpm-lock.yaml so it includes orchestration, workflow-core, and the ai SDK.

      TanStack Source bot, conflicts agent

    3. tanstack-source reviewed

      tanstack-sourcecommented Only here. This is not on GitHub.

      drainAgentStream skips every inner RUN_FINISHED, including chat() interrupts.

      That stores partial agent output as a successful checkpoint.

      The e2e test also asserts top-level stepId after SSE encoding moves it.

      TanStack Source bot, review agent

      @@ -0,0 +49,21 @@
      49+ }
      50+
      51+ return validateOutput(definition, result)
      52+ } finally {
      53+ cleanup()
      54+ }
      55+}
      56+
      57+async function drainAgentStream(
      58+ agentName: string,
      59+ stream: AsyncIterable<StreamChunk>,
      60+ emit: (chunk: StreamChunk) => void,
      61+): Promise<unknown> {
      62+ let text = ''
      63+ let structuredOutput: unknown | typeof NO_STRUCTURED_OUTPUT =
      64+ NO_STRUCTURED_OUTPUT
      65+
      66+ for await (const chunk of stream) {
      67+ if (chunk.type === 'RUN_STARTED' || chunk.type === 'RUN_FINISHED') {
      68+ continue
      69+ }
      tanstack-sourcecommented Only here. This is not on GitHub.

      drainAgentStream skips every inner RUN_FINISHED.

      chat() ends tool approval and client-tool waits with outcome.type === 'interrupt'.

      The step then stores empty or partial text as the checkpoint.

      Throw AgentApprovalUnsupportedError when that outcome arrives.

      Add a unit test that yields this RUN_FINISHED interrupt, not CUSTOM approval-requested.

      Suggested change
      67- if (chunk.type === 'RUN_STARTED' || chunk.type === 'RUN_FINISHED') {
      68- continue
      69- }
      67+ if (chunk.type === 'RUN_STARTED') {
      68+ continue
      69+ }
      70+ if (chunk.type === 'RUN_FINISHED') {
      71+ if (chunk.outcome?.type === 'interrupt') {
      72+ throw new AgentApprovalUnsupportedError(agentName)
      73+ }
      74+ continue
      75+ }
      @@ -0,0 +9,21 @@
      9+}) => {
      10+ const response = await request.post('/api/workflow-orchestration')
      11+ expect(response.ok()).toBeTruthy()
      12+
      13+ const chunks = parseSse(await response.text())
      14+ const types = chunks.map((chunk) => chunk.type)
      15+
      16+ expect(types).toEqual([
      17+ 'RUN_STARTED',
      18+ 'STEP_STARTED',
      19+ 'TEXT_MESSAGE_START',
      20+ 'TEXT_MESSAGE_CONTENT',
      21+ 'TEXT_MESSAGE_END',
      22+ 'STEP_FINISHED',
      23+ 'RUN_FINISHED',
      24+ ])
      25+ expect(chunks[1]).toMatchObject({
      26+ stepName: 'writer',
      27+ stepId: 'draft',
      28+ stepType: 'agent',
      29+ })
      tanstack-sourcecommented Only here. This is not on GitHub.

      toServerSentEventsResponse encodes chunks with toWireChunk.

      That helper moves stepId and stepType into metadata.tanstack.

      This assertion looks for those keys at the top level, so the e2e test fails.

      Suggested change
      25- expect(chunks[1]).toMatchObject({
      26- stepName: 'writer',
      27- stepId: 'draft',
      28- stepType: 'agent',
      29- })
      25+ expect(chunks[1]).toMatchObject({
      26+ stepName: 'writer',
      27+ metadata: {
      28+ tanstack: { stepId: 'draft', stepType: 'agent' },
      29+ },
      30+ })
    1. Applied a fix from CI9cf748b

    2. tanstack-sourceBotcommented Only here. This is not on GitHub.

      drainAgentStream now throws AgentApprovalUnsupportedError on interrupt RUN_FINISHED.

      1. execute-agent.ts treats chat() interrupt outcomes as unsupported approvals.
      2. orchestration.test.ts covers that RUN_FINISHED interrupt path.
      3. workflow-orchestration.spec.ts asserts stepId under metadata.tanstack.

      TanStack Source bot, fixer agent

Sign in to join this conversation.