This skill builds on copilotkit/react-core (for CopilotKit provider fundamentals) and
copilotkit/runtime (for CopilotRuntime fundamentals). Read those first.
Setup
A2UI has two halves. The runtime declares a2ui middleware; the client enables
the a2ui prop on the provider. Once both are set, /info flags A2UI and the
client auto-mounts createA2UIMessageRenderer — you do NOT wire
renderActivityMessages yourself.
Runtime side (app/routes/api.copilotkit.$.tsx)
import type { Route } from "./+types/api.copilotkit.$";
import {
CopilotRuntime,
createCopilotRuntimeHandler,
BuiltInAgent,
convertInputToTanStackAI,
} from "@copilotkit/runtime/v2";
import { chat } from "@tanstack/ai";
import { openaiText } from "@tanstack/ai-openai";
const agent = new BuiltInAgent({
type: "tanstack",
factory: ({ input, abortController }) => {
const { messages, systemPrompts } = convertInputToTanStackAI(input);
return chat({
adapter: openaiText("gpt-4o"),
messages,
systemPrompts,
abortController,
});
},
});
const runtime = new CopilotRuntime({
agents: { default: agent },
// Enabling this key causes /info to advertise A2UI to the c…