agent_copilotkit/

directory
v0.1.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 30, 2026 License: Apache-2.0

README

CopilotKit + agent streaming (minimal)

A tiny Go HTTP server streams agent events as SSE (POST /agui). A Next.js UI uses CopilotKit with the usual /api/copilotkit runtime route; that route forwards requests to the Go agent via @ag-ui/client HttpAgent.

CopilotKit expects its runtime handler, not a raw Go URL, in runtimeUrl—so the React app uses runtimeUrl="/api/copilotkit" and the Go server URL is set in app/api/copilotkit/route.ts (or AGENT_URL).

Prereqs

  • Running Temporal and examples/.env (or your env) with LLM_* and TEMPORAL_* set, same as other examples.

1) Start the Go agent server

From the agent-sdk-go repo root (or this example’s parent with go module in path):

go run ./examples/agent_copilotkit/server

Listens on :8787 by default (override with PORT= — avoids conflicting with apps on 8080). Health: GET http://localhost:8787/health.
Stream: POST http://localhost:8787/agui with JSON {"prompt":"Hello"} or {"messages":[{"role":"user","content":"..."}]}.

2) Start the UI

cd examples/agent_copilotkit/ui
npm install
npm run dev

Open http://localhost:3000 (Next default). The dev server runs the Copilot runtime at /api/copilotkit, which talks to the Go server at http://127.0.0.1:8787/agui by default.

To point at another host:

AGENT_URL=http://127.0.0.1:8787/agui npm run dev

3) Try without the UI

curl -N -X POST http://localhost:8787/agui \
  -H "Content-Type: application/json" \
  -H "Accept: text/event-stream" \
  -d '{"prompt":"What is 2+2?"}'

You should see data: {...} lines (AG-UI-style JSON from event.ToJSON()).

Notes

  • ui/node_modules and ui/.next are listed in the repo root .gitignore — run npm install in ui/ after clone; do not commit those directories.
  • Keep Temporal and the Go server running before using the chat UI.
  • CopilotKit / @ag-ui/client versions may need to stay compatible; if the UI errors, check CopilotKit AG-UI docs and align package versions.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL