Skip to content
Discussion options

You must be logged in to vote

I would not extend the core message-part protocol for this. Keep the backend stream mapped to the known TanStack/AG-UI events for normal chat output, tool calls, tool results, run start/end, etc., then put app-specific UI signals on the custom-event side channel.

On the client, handle those with onCustomEvent:

const chat = useChat({
  connection: fetchServerSentEvents('/api/chat'),
  onCustomEvent: (eventType, data, context) => {
    // e.g. image progress, canvas updates, VM logs, etc.
    // context.toolCallId lets you attach the event to a specific tool call
  },
})

For a Python backend, the safest shape is to write a small adapter layer: translate your backend's SSE into the standard …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by AlemTuzlak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants