examples/shadcn/README.md
https://github.com/user-attachments/assets/f0059b04-ad68-4563-ad7a-e574c64e42d0
A compact Next.js example showing how to build a custom CopilotKit chat UI with
ShadCN-style primitives. It uses useAgent with a CopilotKit Built-in Agent at
/api/copilotkit, renders assistant messages with local chat components, and
includes two frontend interactions:
useFrontendTooluseHumanInTheLoopThe app intentionally keeps the chat prompt fixed to make the demo repeatable.
[email protected] in package.json.Create a local environment file:
cp .env.example .env.local
Then set:
OPENAI_API_KEY=sk-...
COPILOTKIT_MODEL=openai/gpt-5.4
OPENAI_API_KEY is required for the Built-in Agent. COPILOTKIT_MODEL is
optional and defaults to openai/gpt-5.4 in app/api/copilotkit/route.ts.
From this example directory:
cd examples/shadcn
corepack enable
pnpm install
pnpm dev
Open the local URL printed by Next.js, usually
http://localhost:3000.
Press the send button to run each queued example:
Use the reset button in the chat header to replay the sequence.
pnpm typecheck
pnpm lint
pnpm build
pnpm check-types is also available as an alias for pnpm typecheck.