Skip to content

feat(ai-client): send AG-UI protocolVersion in the run request body - #1934

Open
kbuschgens wants to merge 4 commits into
TanStack:mainfrom
kbuschgens:feat/run-input-protocol-version
Open

kbuschgens wants to merge 4 commits into
TanStack:mainfrom
kbuschgens:feat/run-input-protocol-version

Conversation

@kbuschgens

@kbuschgens kbuschgens commented Oct 28, 2026 •

Copy link
Copy Markdown

The chat client now sends protocolVersion: "1.0" in every AG-UI RunAgentInput POST body. AG-UI 1.0 (@ag-ui/core 1.0.0) defines this optional field for the consumer's version. The spec says to send it in-band, so a recorded exchange describes itself. Before this PR, buildRunAgentInputBody did not set it.

🎯 Changes

  • buildRunAgentInputBody in @tanstack/ai-client sets protocolVersion: PROTOCOL_VERSION. All connection adapters use this function, so all of them send the field.
  • @tanstack/ai/client re-exports PROTOCOL_VERSION from @ag-ui/core, next to EventType. @tanstack/ai-client gets the value from there.
  • One unit test and one changeset (patch for @tanstack/ai and @tanstack/ai-client).
  • No docs change. The field is part of the wire format, and users do not set it.

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested code changes locally with pnpm run test:pr, or these tests do not apply to this pull request.
  • I fully understand the code in this pull request, including any code generated with AI assistance.
  • Docs: I updated docs/ for this change, or this change is not user-facing.
  • Changeset: I added a changeset (pnpm changeset), or this PR does not change a published package.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Testing

Commands run.

  • The test:pr target set (nx affected with sherif, knip, docs, kiira, oxlint, lib, types, test:build, build): all 441 targets passed across 110 projects. @tanstack/ai-react:test:lib timed out once under parallel load and passed on rerun; Nx marks it flaky, and it does not touch this change.
  • testing/e2e/tests/ag-ui-compliance.spec.ts fails without the fix (Received: undefined) and passes with it.
  • ag-ui-compliance, ag-ui-foreign-client, ag-ui-old-client-rejection, and chat E2E specs: 19 passed.
  • Full E2E matrix: not run locally.

Manual test.

  1. Run pnpm --filter @tanstack/ai-e2e test:e2e -- tests/ag-ui-compliance.spec.ts.
  2. In an example app, send a chat message and look at the POST body in the browser network tab. It contains "protocolVersion": "1.0".

How this PR makes testing easy. A unit test in packages/ai-client/tests/connection-adapters.test.ts and an E2E assertion in testing/e2e/tests/ag-ui-compliance.spec.ts both check the field in the request body.

Risk / rollback

Low risk. The field is optional in the AG-UI schema, so servers that follow the spec accept it. A server with a strict schema that rejects unknown keys can reject the request. To undo, revert this PR.

Public API change

Before

import { EventType } from '@tanstack/ai/client'

After

import { EventType, PROTOCOL_VERSION } from '@tanstack/ai/client'

Summary by CodeRabbit

  • New Features
    • Requests sent through connection adapters now include AG-UI protocol version 1.0.
    • The protocol version is available through the client package.
  • Tests
    • Added checks confirming requests include the expected protocol version.

AG-UI 1.0 RunAgentInput has an optional protocolVersion field that the
consumer sends in-band. buildRunAgentInputBody now sets it to
PROTOCOL_VERSION ("1.0") for every connection adapter.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01825k3Ap3Aa2ZVUkHA9d7iV
@changeset-bot

changeset-bot Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f8ad02a

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

This PR includes changesets to release 4 packages
Name Type
@tanstack/ai Patch
@tanstack/ai-client Patch
@tanstack/ai-optimize-evals Patch
ag-ui Patch

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

@coderabbitai

coderabbitai Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The connection adapter now adds protocolVersion to generated RunAgentInput request bodies. The client entry point re-exports PROTOCOL_VERSION. Adapter and compliance tests check the request field.

Changes: AG-UI protocol version

Layer / File(s) Summary
Add and verify protocol version in client requests
packages/ai/src/client.ts, packages/ai-client/src/connection-adapters.ts, packages/ai-client/tests/connection-adapters.test.ts, testing/e2e/tests/ag-ui-compliance.spec.ts, .changeset/run-input-protocol-version.md
The client entry point re-exports PROTOCOL_VERSION. The adapter adds it to generated request bodies. Adapter and compliance tests check for '1.0', and the changeset declares patch releases for both packages.

Estimated code review effort: 2 (Simple) | ~8 minutes

Change: Feature

Suggested reviewers: alemtuzlak

Merge Risk: Minimal · up to f8ad0

This change adds the AG-UI protocol version to client request bodies and is covered by tests. No concrete merge-blocking risk was found.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: the AG-UI protocolVersion field is now sent in the run request body from the ai-client package. The raw summary shows the buildRunAgentInputBody change in packages/ai-…
Description check Passed The description follows the template. It covers the changes and why they were made, and it states that no docs change is needed. It completes the checklist and the release impact section with a change…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: the AG-UI protocolVersion field is now sent in the run request body from the ai-client package. The raw summary shows the buildRunAgentInputBody change in packages/ai-client/src/connection-adapters.ts, which matches the title. The title uses the conventional feat(scope) form and is specific.

Full details: Description check

Explanation

The description follows the template. It covers the changes and why they were made, and it states that no docs change is needed. It completes the checklist and the release impact section with a changeset. It also adds testing details, a risk and rollback section, and a public API change section. The template asks for a Changes section and checklist items, and both are present. The author marked the docs checkbox as checked while also saying no docs change is planned, which is a minor inconsistency. The 'Docs' checkbox wording is 'updated docs or not user-facing', so the mark is defensible.

Finishing Touches

Generate unit tests (beta)

  • Create a new PR
  • 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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: TanStack/ai
  • Branch: main
  • File: .coderabbit.yaml
  • Commit: c276d9c
  • Layers: Repository YAML
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: f1749365-31c5-4a47-8e4d-dd4a6041691a
Commits

Reviewing files that changed from the base of the PR and between 37e1464 and f8ad02a.

Files selected for processing: 2

  • packages/ai-client/src/connection-adapters.ts
  • packages/ai-client/tests/connection-adapters.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

@kbuschgens
kbuschgens marked this pull request as ready for review October 29, 2026 08:22
@github-actions
github-actions Bot requested a review from jherr October 29, 2026 10:03
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for the PR, @kbuschgens! 🙌 @jherr will take a look.

Automated pre-review checks

  • ✅ CI passing
  • ✅ No merge conflicts
  • ✅ Changeset present
  • ✅ E2E test changes included

Automated triage — a human review follows.

@github-actions github-actions Bot added the waiting-on: maintainer The ball is in the maintainers’ court label Oct 29, 2026
@github-actions github-actions Bot added waiting-on: author Waiting for the author to respond or update and removed waiting-on: maintainer The ball is in the maintainers’ court labels Nov 23, 2026
@github-actions github-actions Bot added waiting-on: maintainer The ball is in the maintainers’ court and removed waiting-on: author Waiting for the author to respond or update labels Nov 25, 2026
@kbuschgens

Copy link
Copy Markdown
Author

Thanks for your review @AlemTuzlak! Two workflows are still pending for a maintainer approval. Could you approve them?

@nx-cloud

nx-cloud Bot commented Dec 1, 2026 •

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 37e1464

Command Status Duration Result
nx run-many --targets=build --exclude=examples/... ✅ Succeeded 3m 6s View ↗

💡 With Ultracache enabled, Nx Cloud learns each task's file inputs in CI and uses them on later runs. Turn on Ultracache in workspace settings ↗ · Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-12-01 01:16:57 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting-on: maintainer The ball is in the maintainers’ court

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants