Skip to content

Commit e18ee1d

Browse files
committed
feat(showcase): port 8 chat-UI features to built-in-agent
Adds beautiful-chat, cli-start (manifest), prebuilt-sidebar, prebuilt-popup, chat-slots, chat-customization-css, headless-simple, and headless-complete demos to the built-in-agent integration. All cells route through the single in-process /api/copilotkit endpoint and target the 'default' agent. The headless-complete tool renderers are adapted to the built-in-agent's existing 'weather' and 'haiku' server tools, with HighlightNote retained as a frontend-only useComponent example. Beautiful-chat is a simplified two-pane polished starter rather than the full 4084 reference clone, since the built-in-agent runner is intentionally minimal.
1 parent 26039c5 commit e18ee1d

22 files changed

Lines changed: 1459 additions & 0 deletions

File tree

showcase/integrations/built-in-agent/manifest.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,15 @@ interaction_modalities:
2222
- embedded
2323
- chat
2424
features:
25+
- beautiful-chat
26+
- cli-start
2527
- agentic-chat
28+
- prebuilt-sidebar
29+
- prebuilt-popup
30+
- chat-slots
31+
- chat-customization-css
32+
- headless-simple
33+
- headless-complete
2634
- hitl-in-chat
2735
- tool-rendering
2836
- gen-ui-tool-based
@@ -31,11 +39,88 @@ features:
3139
- shared-state-streaming
3240
- subagents
3341
demos:
42+
- id: cli-start
43+
name: CLI Start Command
44+
description: Copy-paste command to clone the canonical starter
45+
tags:
46+
- chat-ui
47+
command: "npx copilotkit@latest init --framework built-in-agent"
48+
- id: beautiful-chat
49+
name: Beautiful Chat
50+
description: Polished starter chat with two-pane layout and pre-wired suggestions
51+
tags:
52+
- chat-ui
53+
route: /demos/beautiful-chat
54+
highlight:
55+
- src/app/demos/beautiful-chat/page.tsx
56+
- src/lib/factory/tanstack-factory.ts
57+
- src/app/api/copilotkit/route.ts
3458
- id: agentic-chat
3559
name: Agentic Chat
3660
description: Natural conversation with frontend tool execution
3761
tags: [chat-ui]
3862
route: /demos/agentic-chat
63+
- id: prebuilt-sidebar
64+
name: "Pre-Built: Sidebar"
65+
description: Docked sidebar chat via <CopilotSidebar />
66+
tags:
67+
- chat-ui
68+
route: /demos/prebuilt-sidebar
69+
highlight:
70+
- src/app/demos/prebuilt-sidebar/page.tsx
71+
- src/lib/factory/tanstack-factory.ts
72+
- src/app/api/copilotkit/route.ts
73+
- id: prebuilt-popup
74+
name: "Pre-Built: Popup"
75+
description: Floating popup chat via <CopilotPopup />
76+
tags:
77+
- chat-ui
78+
route: /demos/prebuilt-popup
79+
highlight:
80+
- src/app/demos/prebuilt-popup/page.tsx
81+
- src/lib/factory/tanstack-factory.ts
82+
- src/app/api/copilotkit/route.ts
83+
- id: chat-slots
84+
name: Chat Customization (Slots)
85+
description: Customize CopilotChat via its slot system
86+
tags:
87+
- chat-ui
88+
route: /demos/chat-slots
89+
highlight:
90+
- src/app/demos/chat-slots/page.tsx
91+
- src/app/demos/chat-slots/custom-welcome-screen.tsx
92+
- src/app/demos/chat-slots/custom-assistant-message.tsx
93+
- src/app/demos/chat-slots/custom-disclaimer.tsx
94+
- id: chat-customization-css
95+
name: Chat Customization (CSS)
96+
description: Default CopilotChat re-themed via CopilotKitCSSProperties
97+
tags:
98+
- chat-ui
99+
route: /demos/chat-customization-css
100+
highlight:
101+
- src/app/demos/chat-customization-css/page.tsx
102+
- src/app/demos/chat-customization-css/theme.css
103+
- id: headless-simple
104+
name: Headless Chat (Simple)
105+
description: Minimal custom chat surface built on useAgent
106+
tags:
107+
- chat-ui
108+
route: /demos/headless-simple
109+
highlight:
110+
- src/app/demos/headless-simple/page.tsx
111+
- src/lib/factory/tanstack-factory.ts
112+
- src/app/api/copilotkit/route.ts
113+
- id: headless-complete
114+
name: Headless Chat (Complete)
115+
description: Full chat implementation built from scratch on useAgent
116+
tags:
117+
- chat-ui
118+
route: /demos/headless-complete
119+
highlight:
120+
- src/app/demos/headless-complete/page.tsx
121+
- src/app/demos/headless-complete/use-rendered-messages.tsx
122+
- src/app/demos/headless-complete/tool-renderers.tsx
123+
- src/app/demos/headless-complete/message-list.tsx
39124
- id: hitl-in-chat
40125
name: In-Chat Human in the Loop
41126
description: User approves agent actions before execution
Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
"use client";
2+
3+
/**
4+
* Beautiful Chat (built-in-agent flavor) — a polished starter chat that
5+
* showcases CopilotChat dropped into a clean two-pane layout, with a side
6+
* canvas, theme variables, and pre-wired suggestions.
7+
*
8+
* The langgraph-python flagship version uses an extensive 4084 component tree
9+
* (A2UI catalog, todo canvas, declarative generative UI). This integration
10+
* keeps the same conceptual layout (chat on the right, content on the left)
11+
* but stays minimal — the built-in-agent runner is intentionally bare, and
12+
* this cell is the polished starter showcase.
13+
*/
14+
15+
import React from "react";
16+
import {
17+
CopilotKitProvider,
18+
CopilotChat,
19+
useConfigureSuggestions,
20+
} from "@copilotkit/react-core/v2";
21+
22+
export default function BeautifulChatPage() {
23+
return (
24+
<CopilotKitProvider runtimeUrl="/api/copilotkit" useSingleEndpoint>
25+
<div className="grid grid-cols-1 md:grid-cols-[1fr_420px] h-screen w-full bg-gradient-to-br from-slate-50 to-indigo-50 dark:from-slate-950 dark:to-indigo-950">
26+
<Canvas />
27+
<aside className="border-l border-slate-200 dark:border-slate-800 bg-white/60 dark:bg-slate-900/60 backdrop-blur flex flex-col">
28+
<Suggestions />
29+
<CopilotChat
30+
agentId="default"
31+
className="flex-1"
32+
input={{ disclaimer: () => null, className: "pb-6" }}
33+
/>
34+
</aside>
35+
</div>
36+
</CopilotKitProvider>
37+
);
38+
}
39+
40+
function Canvas() {
41+
return (
42+
<main className="hidden md:flex flex-col p-12 overflow-y-auto">
43+
<header className="mb-8">
44+
<span className="inline-block rounded-full bg-indigo-100 dark:bg-indigo-900 text-indigo-700 dark:text-indigo-200 px-3 py-1 text-xs font-semibold uppercase tracking-wider">
45+
Starter
46+
</span>
47+
<h1 className="mt-3 text-4xl font-bold text-slate-900 dark:text-slate-50">
48+
Beautiful Chat
49+
</h1>
50+
<p className="mt-2 text-slate-600 dark:text-slate-400 max-w-prose">
51+
A polished starter layout: the built-in CopilotChat dropped onto a
52+
two-pane canvas, with suggestions pre-wired and the disclaimer slot
53+
customized away. Everything is theme-aware and responsive.
54+
</p>
55+
</header>
56+
<div className="grid grid-cols-2 gap-4 max-w-3xl">
57+
<Card title="In-process runner">
58+
The CopilotKit runtime runs inside the Next.js route handler — there
59+
is no separate agent server.
60+
</Card>
61+
<Card title="TanStack AI">
62+
Backend tools defined with <code>toolDefinition()</code> stream
63+
through the agent factory.
64+
</Card>
65+
<Card title="Tailwind theme">
66+
Colors come from the global CopilotKit CSS variables; flip the page
67+
to dark mode and the chat follows.
68+
</Card>
69+
<Card title="Drop-in primitives">
70+
<code>&lt;CopilotChat /&gt;</code> ships with messages, input,
71+
suggestions, and disclaimer slots out of the box.
72+
</Card>
73+
</div>
74+
</main>
75+
);
76+
}
77+
78+
function Card({
79+
title,
80+
children,
81+
}: {
82+
title: string;
83+
children: React.ReactNode;
84+
}) {
85+
return (
86+
<div className="rounded-2xl border border-slate-200 dark:border-slate-800 bg-white/80 dark:bg-slate-900/80 p-5 shadow-sm">
87+
<h3 className="text-sm font-semibold text-slate-900 dark:text-slate-50">
88+
{title}
89+
</h3>
90+
<p className="mt-1 text-xs text-slate-600 dark:text-slate-400 leading-relaxed">
91+
{children}
92+
</p>
93+
</div>
94+
);
95+
}
96+
97+
function Suggestions() {
98+
useConfigureSuggestions({
99+
suggestions: [
100+
{ title: "Say hi", message: "Say hi!" },
101+
{
102+
title: "Weather check",
103+
message: "What's the weather in San Francisco?",
104+
},
105+
{ title: "Compose a haiku", message: "Write a haiku about coffee." },
106+
],
107+
available: "always",
108+
});
109+
return null;
110+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"use client";
2+
3+
// Chat Customization (CSS) — all theming lives in theme.css, scoped to the
4+
// `.chat-css-demo-scope` wrapper. The page stays intentionally minimal;
5+
// only <CopilotChat /> is visibly re-themed.
6+
//
7+
// https://docs.copilotkit.ai/custom-look-and-feel/customize-built-in-ui-components
8+
9+
import React from "react";
10+
import { CopilotKitProvider, CopilotChat } from "@copilotkit/react-core/v2";
11+
// @region[theme-css-import]
12+
import "./theme.css";
13+
// @endregion[theme-css-import]
14+
15+
export default function ChatCustomizationCssDemo() {
16+
return (
17+
<CopilotKitProvider runtimeUrl="/api/copilotkit" useSingleEndpoint>
18+
<div className="flex justify-center items-center h-screen w-full">
19+
<div className="chat-css-demo-scope h-full w-full max-w-4xl">
20+
<CopilotChat agentId="default" className="h-full rounded-2xl" />
21+
</div>
22+
</div>
23+
</CopilotKitProvider>
24+
);
25+
}
Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
/* Scoped theme for the chat-customization-css demo.
2+
* All selectors are prefixed with `.chat-css-demo-scope` so they do not
3+
* leak out and affect the rest of the showcase app.
4+
*
5+
* Targets the CopilotKit built-in classes documented at
6+
* https://docs.copilotkit.ai/custom-look-and-feel/customize-built-in-ui-components
7+
*/
8+
9+
/* @region[css-variables] */
10+
/* CopilotKit CSS variable overrides (accent colors, etc.) */
11+
.chat-css-demo-scope {
12+
--copilot-kit-primary-color: #ff006e;
13+
--copilot-kit-contrast-color: #ffffff;
14+
--copilot-kit-background-color: #fff8f0;
15+
--copilot-kit-input-background-color: #fef3c7;
16+
--copilot-kit-secondary-color: #fde047;
17+
--copilot-kit-secondary-contrast-color: #2c1810;
18+
--copilot-kit-separator-color: #ff006e;
19+
--copilot-kit-muted-color: #c2185b;
20+
}
21+
/* @endregion[css-variables] */
22+
23+
/* Messages container – swap the font for the entire chat */
24+
.chat-css-demo-scope .copilotKitMessages {
25+
font-family: "Georgia", "Cambria", "Times New Roman", serif;
26+
background-color: #fff8f0;
27+
color: #2c1810;
28+
padding: 1.5rem 0;
29+
}
30+
31+
/* User message bubble – hot pink, bold white serif text, large */
32+
.chat-css-demo-scope .copilotKitMessage.copilotKitUserMessage {
33+
background: linear-gradient(135deg, #ff006e 0%, #c2185b 100%);
34+
color: #ffffff;
35+
font-family: "Georgia", "Cambria", "Times New Roman", serif;
36+
font-size: 1.25rem;
37+
font-weight: 700;
38+
padding: 14px 20px;
39+
border-radius: 22px 22px 4px 22px;
40+
box-shadow: 0 6px 16px rgba(255, 0, 110, 0.35);
41+
border: 2px solid #ff6fa5;
42+
letter-spacing: 0.01em;
43+
}
44+
45+
/* Assistant message bubble – amber, monospace, boxy, dark text */
46+
.chat-css-demo-scope .copilotKitMessage.copilotKitAssistantMessage {
47+
background: #fde047;
48+
color: #1e1b4b;
49+
font-family:
50+
"JetBrains Mono", "Fira Code", "SF Mono", Menlo, Consolas, monospace;
51+
font-size: 1rem;
52+
padding: 16px 20px;
53+
border-radius: 4px 22px 22px 22px;
54+
border: 2px solid #1e1b4b;
55+
box-shadow: 4px 4px 0 #1e1b4b;
56+
max-width: 80%;
57+
margin-right: auto;
58+
margin-bottom: 1rem;
59+
}
60+
61+
/* Make markdown inside assistant bubble inherit our theme */
62+
.chat-css-demo-scope
63+
.copilotKitMessage.copilotKitAssistantMessage
64+
.copilotKitMarkdown,
65+
.chat-css-demo-scope
66+
.copilotKitMessage.copilotKitAssistantMessage
67+
.copilotKitMarkdown
68+
p,
69+
.chat-css-demo-scope .copilotKitMessage.copilotKitAssistantMessage p {
70+
color: #1e1b4b;
71+
font-family: inherit;
72+
font-size: inherit;
73+
}
74+
75+
/* Input area – themed border and font */
76+
.chat-css-demo-scope .copilotKitInput {
77+
font-family: "Georgia", "Cambria", "Times New Roman", serif;
78+
background-color: #fef3c7;
79+
border: 3px dashed #ff006e;
80+
border-radius: 18px;
81+
padding: 16px 18px;
82+
min-height: 80px;
83+
}
84+
85+
.chat-css-demo-scope .copilotKitInput > textarea {
86+
font-family: "Georgia", "Cambria", "Times New Roman", serif;
87+
font-size: 1.1rem;
88+
color: #2c1810;
89+
}
90+
91+
.chat-css-demo-scope .copilotKitInput > textarea::placeholder {
92+
color: #c2185b;
93+
font-style: italic;
94+
}
95+
96+
.chat-css-demo-scope .copilotKitInputContainer {
97+
background: #fff8f0;
98+
}
99+
100+
.chat-css-demo-scope .copilotKitChat {
101+
background-color: #fff8f0;
102+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
"use client";
2+
3+
import React from "react";
4+
import { CopilotChatAssistantMessage } from "@copilotkit/react-core/v2";
5+
import type { CopilotChatAssistantMessageProps } from "@copilotkit/react-core/v2";
6+
7+
// Custom assistantMessage sub-slot of messageView — wraps the default assistant
8+
// message in a visibly tinted card with a corner "slot" badge, proving the slot
9+
// override is active during the in-chat message flow (not just the welcome screen).
10+
export function CustomAssistantMessage(
11+
props: CopilotChatAssistantMessageProps,
12+
) {
13+
return (
14+
<div
15+
data-testid="custom-assistant-message"
16+
className="relative rounded-xl border border-indigo-200 bg-indigo-50/60 dark:bg-indigo-950/40 dark:border-indigo-800 p-3 my-3"
17+
>
18+
<span className="absolute -top-2 -left-2 inline-block rounded-full bg-indigo-600 text-white text-[10px] font-bold uppercase tracking-wider px-2 py-0.5 shadow">
19+
slot
20+
</span>
21+
<CopilotChatAssistantMessage {...props} />
22+
</div>
23+
);
24+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
"use client";
2+
3+
import React from "react";
4+
5+
// Custom disclaimer sub-slot of the input — visibly tagged so reviewers can
6+
// tell the slot is in use even once the welcome screen is dismissed.
7+
export function CustomDisclaimer(props: React.HTMLAttributes<HTMLDivElement>) {
8+
return (
9+
<div
10+
{...props}
11+
data-testid="custom-disclaimer"
12+
className="text-xs text-center text-muted-foreground py-2"
13+
>
14+
<span className="inline-block rounded bg-indigo-100 text-indigo-700 px-2 py-0.5 mr-2 font-semibold">
15+
slot
16+
</span>
17+
Custom disclaimer injected via <code>input.disclaimer</code>.
18+
</div>
19+
);
20+
}

0 commit comments

Comments
 (0)