AG-UI Event Inspector

Inspect AG-UI events in real time with the VSCode extension

The AG-UI Event Inspector gives you a live view of every event flowing between your CopilotKit runtime and client. Instead of sprinkling console.log statements through your agent code, you can watch the full AG-UI event stream in a filterable, color-coded panel inside VS Code.

Use it when:

  • An agent interaction isn't behaving as expected and you need to see which events the runtime is actually emitting
  • You want to understand the AG-UI event lifecycle (e.g., how RUN_STARTED flows through TEXT_MESSAGE_CONTENT chunks to RUN_FINISHED)
  • You need to inspect tool call arguments or state deltas for a specific interaction

To debug on the client instead, use the in-app Inspector.

Prerequisites

  • A CopilotKit runtime running locally with NODE_ENV set to development, or with exposeDebugEvents: true on the runtime
  • The CopilotKit VS Code extension installed

The /cpk-debug-events endpoint streams every event of every thread, including full message content, to any subscriber, and identifyUser does not scope it. Whether it is served depends on NODE_ENV and on two runtime options:

NODE_ENVdebug offdebug onexposeDebugEvents: true
developmentServedServedServed
test404ServedServed
Anything else, including unset, prod and staging404404Served, with a warning

This table applies when the runtime serves web routes. A Channels-only CopilotKit Intelligence runtime without web identifyUser returns 404 for this endpoint, even with exposeDebugEvents: true. Adding identifyUser makes the route available under the table's conditions; it does not filter the feed by user.

A plain node server.js sets no NODE_ENV, so a self-hosted runtime does not expose the feed by accident, and debug alone keeps the route closed there. You can keep debug logging without publishing conversations. To open the route on such a host, set NODE_ENV=development for a local runtime, or opt in by name. The runtime logs a warning once per process when the option opens the route outside development and test:

const runtime = new CopilotRuntime({ agents, exposeDebugEvents: true });

Treat that as you would any other way of reading conversation content, and do not enable it on a runtime the public can reach.

This stream carries the AG-UI events a self-hosted runtime sends over SSE. A runtime configured with intelligence does not send them: it answers runs over CopilotKit Intelligence's realtime connection instead. On that runtime With web identifyUser and the feed enabled, /cpk-debug-events connects and reports : connected, then stays empty. To trace an Intelligence-backed run, use the in-app Inspector, which reads the events on the client.

Connect and inspect

Run your runtime in development mode

The debug event endpoint is available at GET {runtimeUrl}/cpk-debug-events when the runtime serves web routes. It activates automatically when NODE_ENV is development, which next dev and most dev servers set for you. No extra configuration is needed. On a host that sets no NODE_ENV, set exposeDebugEvents: true on the runtime instead.

The path is relative to the basePath the runtime is mounted at, not to the server's origin. A runtime mounted at /api/copilotkit on port 8200 serves the stream at http://localhost:8200/api/copilotkit/cpk-debug-events; requesting http://localhost:8200/cpk-debug-events returns 404 {"error":"Not found"}. Confirm the URL before you connect:

curl -N http://localhost:8200/api/copilotkit/cpk-debug-events

A working endpoint responds immediately with : connected and then holds the connection open.

Open the AG-UI Event Inspector

Open the VS Code command palette (Ctrl+Shift+P / Cmd+Shift+P) and run:

CopilotKit: Open AG-UI Inspector

This opens a dedicated webview panel.

Enter your runtime URL and connect

Type your runtime URL in the input field at the top of the panel (default: http://localhost:4000) and click Connect. Use the full mounted runtime URL (the same value your frontend passes as runtimeUrl, including its base path), not just the origin. The panel status indicator turns green when the SSE connection is established.

Trigger an agent interaction

Go to your app and perform an action that triggers an agent run: send a chat message, invoke a tool, or interact with any CopilotKit-powered component. Events start streaming into the AG-UI Event Inspector immediately.

Read the event stream

Each event row shows:

  • Timestamp: relative time since the first event (e.g., +0.142s)
  • Event type badge: color-coded by category (see table below)
  • Summary: key fields like message ID, tool name, or a text preview

Filter events

Use the category filter buttons at the top of the panel to show or hide event categories. You can also search event payloads with the search field to find specific tool names, message IDs, or content.

Inspect event details

Click any event row to expand the full JSON payload in the detail panel. This shows every field the runtime emitted for that event, including agentId, threadId, runId, and the complete event data.

Event type reference

CategoryColorEvent TypesDescription
LifecyclePurpleRUN_STARTED, RUN_FINISHEDMarks the start and end of an agent run
ErrorsRedRUN_ERRORAn error occurred during the agent run
Text MessagesBlueTEXT_MESSAGE_START, TEXT_MESSAGE_CONTENT, TEXT_MESSAGE_END, TEXT_MESSAGE_CHUNKText streamed from the agent to the client
Tool CallsOrangeTOOL_CALL_START, TOOL_CALL_ARGS, TOOL_CALL_END, TOOL_CALL_CHUNK, TOOL_CALL_RESULTTool invocation lifecycle: name, arguments, and result
ReasoningGreenREASONING_START, REASONING_MESSAGE_START, REASONING_MESSAGE_CONTENT, REASONING_MESSAGE_END, REASONING_ENDModel reasoning/chain-of-thought events
StateTealSTATE_SNAPSHOT, STATE_DELTAAgent state snapshots and incremental updates
Activity/UIYellowACTIVITY_SNAPSHOT, ACTIVITY_DELTAUI activity indicators and progress updates

For console-level debug logging and programmatic error handling in your app, see Error Debugging. If you're debugging a render prop rather than a runtime event stream, the Hook Explorer is the offline, render-first complement to this tool.

How is this guide?