API Reference

API Reference for the next-generation CopilotKit React API.


The v2 React API (@copilotkit/react-core/v2) is the next-generation interface for building copilot-powered applications. It provides a streamlined set of hooks and components built on top of the AG-UI agent protocol.

Provider Setup

The v2 API uses the <CopilotKit> provider. Wrap your application with it to configure the runtime connection:

import { CopilotKit } from "@copilotkit/react-core/v2";

function App() {
  return (
    <CopilotKit runtimeUrl="/api/copilotkit">
      <YourApp />
    </CopilotKit>
  );
}
Advanced: Using CopilotKit directly

CopilotKit is a low-level provider intended for advanced use cases. Most applications should use the <CopilotKit> component from @copilotkit/react-core/v2 instead.

If you need direct control over the v2 provider (e.g. for custom integrations), import CopilotKit from @copilotkit/react-core/v2:

import { CopilotKit } from "@copilotkit/react-core/v2";

<CopilotKit runtimeUrl="/api/copilotkit">
  <App />
</CopilotKit>

Props

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Prop

Type

Styling

When using v2 UI components, import the stylesheet once at your app boundary:

import "@copilotkit/react-core/v2/styles.css";

API Reference

Looking for tool rendering hooks? Start with useComponent, useRenderTool, and useDefaultRenderTool.