docs/snippets/copilot-cloud-configure-copilotkit-provider.mdx
import { Callout } from 'fumadocs-ui/components/callout'; import { LinkToCopilotCloud } from '@/components/react/link-to-copilot-cloud';
The <CopilotKit> provider must wrap the Copilot-aware parts of your application.
For most use-cases, it's appropriate to wrap the CopilotKit provider around the entire app, e.g. in your layout.tsx
import "./globals.css";
import { ReactNode } from "react";
import { CopilotKit } from "@copilotkit/react-core"; // [!code highlight]
export default function RootLayout({ children }: { children: ReactNode }) {
return (
<html lang="en">
<body>
<CopilotKit publicApiKey="<your-copilot-cloud-public-api-key>">
{children}
</CopilotKit>
</body>
</html>
);
}