Skip to main content
Full-stack reference: Go agent server exposes POST /agui as SSE with AG-UI JSON events; Next.js + CopilotKit consumes the stream. Source: examples/agent_with_agui/

What it demonstrates

  • Forwarding ev.ToJSON() over SSE
  • CopilotKit bridge in Next.js (runtimeUrl="/api/copilotkit" — the Go URL is set in the Next API route, not directly in React)
  • AG-UI event sequence for a real frontend

Additional requirements

Node.js (LTS) is required for the Next.js UI in terminal 2. The Go server has no extra dependencies.

Run

From examples/:
Open http://localhost:3000. Health: GET http://localhost:8787/health. Override Go listen port with PORT=. Point the UI at another host:

Try without the UI

You should see data: {...} lines (AG-UI-style JSON from event.ToJSON()). Request body accepts {"prompt":"..."} or {"messages":[{"role":"user","content":"..."}]}. For a production-shaped split API/worker app with persisted chat history, see Agent Chat.

Learn more

AG-UI Protocol

Event format and integration

Stream

CLI streaming without UI