showcase/shell-docs/src/content/reference/vue/components/CopilotKitProvider.mdx
CopilotKitProvider typically wraps your entire application (or a sub-tree where you want a copilot). It creates the CopilotKit core instance and provides the copilot context to all descendant components and composables (such as useCopilotKit and useAgent).
The wrapped application is rendered through the component's default slot, since Vue uses slots rather than a children prop.
<script setup lang="ts">
import { CopilotKitProvider } from "@copilotkit/vue/v2";
</script>
<template>
<CopilotKitProvider runtime-url="/api/copilotkit">
<!-- ... your app ... -->
</CopilotKitProvider>
</template>
Connect to Copilot Cloud with a public API key instead of a self-hosted runtime:
<script setup lang="ts">
import { CopilotKitProvider } from "@copilotkit/vue/v2";
</script>
<template>
<CopilotKitProvider public-api-key="ck_pub_your_key">
<!-- ... your app ... -->
</CopilotKitProvider>
</template>
You must provide at least one of runtimeUrl, publicApiKey, or publicLicenseKey (or a set of local agents), otherwise the provider warns in development and throws in production.
{
"Authorization": "Bearer X"
}
Don't have it yet? Go to https://dashboard.operations.copilotkit.ai and get one for free.
</PropertyReference> <PropertyReference name="publicLicenseKey" type="string"> Your public license key for accessing Enterprise Intelligence Platform features.Don't have it yet? Go to https://dashboard.operations.copilotkit.ai and get one for free.
</PropertyReference> <PropertyReference name="licenseToken" type="string"> Signed license token for offline verification of Enterprise Intelligence Platform features. Obtain it from https://dashboard.operations.copilotkit.ai. </PropertyReference> <PropertyReference name="properties" type="Record<string, unknown>" default="{}"> Custom properties sent with each request. Can include `threadMetadata` for thread creation and `authorization` for LangGraph Platform authentication.{
user_id: "users_id",
authorization: "your-auth-token", // For LangGraph Platform authentication
threadMetadata: {
account_id: "123",
user_type: "premium",
},
}
<script setup lang="ts">
import { CopilotKitProvider } from "@copilotkit/vue/v2";
function handleError(event: {
error: Error;
code: string;
context: Record<string, any>;
}) {
debugDashboard.capture(event);
}
</script>
<template>
<CopilotKitProvider public-api-key="ck_pub_your_key" :on-error="handleError">
<!-- ... your app ... -->
</CopilotKitProvider>
</template>
<template>
<CopilotKitProvider
runtime-url="/api/copilotkit"
:a2ui="{ theme: myCustomTheme }"
>
<!-- ... your app ... -->
</CopilotKitProvider>
</template>
<template>
<CopilotKitProvider runtime-url="/api/copilotkit">
<!-- This content is the default slot -->
<App />
</CopilotKitProvider>
</template>
useCopilotKit -- Low-level composable for accessing the provider contextuseAgent -- High-level composable for accessing agent instancesuseFrontendTool -- Register frontend tools dynamicallyuseHumanInTheLoop -- Register human-in-the-loop tools dynamically