Skip to main content
The AG-UI protocol is an open standard for streaming agent events to frontend clients. It defines a structured event sequence — run lifecycle, text deltas, tool calls, reasoning content — so any AG-UI-compatible frontend can consume agent output without custom integration code. This SDK emits every Stream call as a properly sequenced AG-UI event stream. Events like RUN_STARTED, TEXT_MESSAGE_CONTENT, TOOL_CALL_START, and REASONING_MESSAGE_CONTENT are produced in the correct order during every Stream call. Any frontend built on the AG-UI client SDK — including CopilotKit and custom React clients — works out of the box. Serialize any event with event.ToJSON() and forward it over SSE, WebSocket, or Redis to your frontend. The receiving client handles rendering, tool display, and state — your Go server just forwards bytes.

Basic integration

When using conversation, pass the session ID in AgentStreamOptions — the AG-UI client uses it to thread messages correctly across turns:
Enable streaming, then forward serialized events to your frontend over SSE, WebSocket, or Redis:
Call event.ToJSON() on any AgentEvent to get AG-UI-compatible JSON.

Reference app

Agent Chat — production-shaped split API/worker app with Postgres, SSE streaming, and CopilotKit UI.

Example

AG-UI

Go SSE server + CopilotKit UI

Streaming

Stream API and event types

Approvals

CUSTOM events and AgentStream.Approve