CopilotKit
Reference / core / types

CopilotKitCoreConfig

Configuration object passed to the CopilotKitCore constructor.

Overview

CopilotKitCoreConfig is the configuration object accepted by the CopilotKitCore constructor. It wires the core to a CopilotRuntime endpoint and seeds it with frontend tools, suggestions, request headers, and forwarded properties.

Import

import type { CopilotKitCoreConfig } from "@copilotkit/core";

Definition

interface CopilotKitCoreConfig {
  runtimeUrl?: string;
  runtimeTransport?: CopilotRuntimeTransport;
  agents__unsafe_dev_only?: Record<string, AbstractAgent>;
  headers?: Record<string, string>;
  credentials?: RequestCredentials;
  properties?: Record<string, unknown>;
  tools?: FrontendTool<any>[];
  suggestionsConfig?: SuggestionsConfig[];
  debug?: DebugConfig;
}

Properties

runtimeUrlstring

The endpoint of the CopilotRuntime.

runtimeTransport"rest" | "single" | "auto"
Default: "auto"

Transport style for CopilotRuntime endpoints. "auto" probes REST and falls back to single-route.

agents__unsafe_dev_onlyRecord<string, AbstractAgent>

Mapping from agent name to its AbstractAgent instance. For development only — production requires a CopilotRuntime.

headersRecord<string, string>
Default: "{}"

Headers appended to every HTTP request made by CopilotKitCore.

credentialsRequestCredentials

Credentials mode for fetch requests (e.g. "include" for HTTP-only cookies).

propertiesRecord<string, unknown>
Default: "{}"

Properties sent as forwardedProps to the AG-UI agent.

toolsFrontendTool<any>[]
Default: "[]"

Ordered collection of frontend tools available to the core.

suggestionsConfigSuggestionsConfig[]
Default: "[]"
debugDebugConfig

Enable debug logging for the client-side event pipeline.

Usage

import { CopilotKitCore } from "@copilotkit/core";
import { z } from "zod";

const copilotkit = new CopilotKitCore({
  runtimeUrl: "/api/copilotkit",
  headers: { Authorization: "Bearer token" },
  properties: { userId: "user_123" },
  tools: [
    {
      name: "sayHello",
      description: "Greet the user",
      parameters: z.object({ name: z.string() }),
      handler: async ({ name }) => `Hello, ${name}!`,
    },
  ],
});

Related