A2UI Launched: Full CopilotKit support at launch!

A2UI Launched: CopilotKit has partnered with Google to deliver full support in both CopilotKit and AG-UI!

Check it out
LogoLogo
  • Overview
  • Integrations
  • API Reference
  • Copilot Cloud
Slanted end borderSlanted end border
Slanted start borderSlanted start border
  • API Reference
  • UI Components
  • CopilotTextarea
  • CopilotKit
  • Hooks
  • useAgent
  • useDefaultTool
  • useFrontendTool
  • useRenderToolCall
  • useHumanInTheLoop
  • useCopilotReadable
  • useCopilotAdditionalInstructions
  • useCopilotChat
  • useCopilotChatHeadless_c
  • useCopilotChatSuggestions
  • useCoAgent
  • useCoAgentStateRender
  • useLangGraphInterrupt
  • useCopilotAction
  • Classes
  • CopilotRuntime
  • CopilotTask
  • SDKs

useCopilotAdditionalInstructions

The useCopilotAdditionalInstructions hook allows you to provide additional instructions to the agent.

useCopilotAdditionalInstructions is a React hook that provides additional instructions to the Copilot.

Usage

Simple Usage

In its most basic usage, useCopilotAdditionalInstructions accepts a single string argument representing the instructions to be added to the Copilot.

import { useCopilotAdditionalInstructions } from "@copilotkit/react-core";
 
export function MyComponent() {
  useCopilotAdditionalInstructions({
    instructions: "Do not answer questions about the weather.",
  });
}

Conditional Usage

You can also conditionally add instructions based on the state of your app.

import { useCopilotAdditionalInstructions } from "@copilotkit/react-core";
 
export function MyComponent() {
  const [showInstructions, setShowInstructions] = useState(false);
 
  useCopilotAdditionalInstructions({
    available: showInstructions ? "enabled" : "disabled",
    instructions: "Do not answer questions about the weather.",
  });
}

Parameters

instructionsstringrequired

The instructions to be added to the Copilot. Will be added to the instructions like so:

You are a helpful assistant.
Additionally, follow these instructions:
- Do not answer questions about the weather.
- Do not answer questions about the stock market.
available'enabled' | 'disabled'

Whether the instructions are available to the Copilot.

PREV
useCopilotReadable
Slanted end borderSlanted end border
Slanted start borderSlanted start border
NEXT
useCopilotChat

On this page

Usage
Simple Usage
Conditional Usage
Parameters