Skip to content

AG UI data model incompatibility issues #311

@mzhafez

Description

@mzhafez

TanStack AI version

0.5.0

Framework/Library version

react

Describe the bug and the steps to reproduce it

I'm having a rough time pointing my tanstack ai (generated using tanstack builder) to my ag-ui compatible backend. I think this stems from possible data model incompatibility issues between tanstack ai and ag-ui

As an example, tanstack ai sends:
{ "messages": [ { "id": "msg-1771876311632-1djsf", "role": "user", "parts": [ { "type": "text", "content": "test" } ], "createdAt": "2026-02-23T19:51:51.632Z" } ], "data": { "conversationId": "_R_la_" } }

However my ag-ui backend expects:
type RunAgentInput = { threadId: string runId: string parentRunId?: string state: any messages: Message[] tools: Tool[] context: Context[] forwardedProps: any }
And message is also inaccurate:
type UserMessage = { id: string role: "user" content: string | InputContent[] name?: string }

Missing fields in RunAgentInput:
threadId, runId, state?, tools, context?, forwardedProps? (adding ? as they're marked as any in spec but not as optional like parentRunId is.)
Missing/misnamed fields in UserMessage:
"parts": this seems quite similar to "content" from spec
"parts" in tanstack contains an array of an object with fields "type" and "content", in ag-ui this object maps to "TextInputContent" which has "type" and "text" fields
"createdAt": this field does not exist in the specification, not sure if it'll matter to keep/remove it

Reproducing this:

  1. Create a new tanstack ai app
  2. Check out ag-ui server-starter and run it
  3. Point your tanstack ai hook to your ag-ui server (should be as easy as connection: fetchServerSentEvents('http://localhost:8000/agentic_chat'),
  4. Try sending messages using tanstack ai chat

Your Minimal, Reproducible Example - (Sandbox Highly Recommended)

dont have a codesandbox

Screenshots or Videos (Optional)

No response

Do you intend to try to help solve this bug with your own PR?

None

Terms & Code of Conduct

  • I agree to follow this project's Code of Conduct
  • I understand that if my bug cannot be reliable reproduced in a debuggable environment, it will probably not be fixed and this issue may even be closed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions