SuggestionsConfig
Configuration for generating dynamic or static suggestions.
Overview
SuggestionsConfig configures how Suggestion pills are produced. It is a union of two variants:
DynamicSuggestionsConfig— suggestions are generated by the model frominstructions.StaticSuggestionsConfig— a fixed list of suggestions you provide.
The variant is determined by which fields are present (instructions vs. suggestions). Configs are supplied via CopilotKitCoreConfig.suggestionsConfig.
Import
import type { SuggestionsConfig } from "@copilotkit/core";Definition
type SuggestionsConfig = DynamicSuggestionsConfig | StaticSuggestionsConfig;
type SuggestionAvailability =
| "before-first-message"
| "after-first-message"
| "always"
| "disabled";
type DynamicSuggestionsConfig = {
instructions: string;
minSuggestions?: number;
maxSuggestions?: number;
available?: SuggestionAvailability;
providerAgentId?: string;
consumerAgentId?: string;
};
type StaticSuggestionsConfig = {
suggestions: Omit<Suggestion, "isLoading">[];
available?: SuggestionAvailability;
consumerAgentId?: string;
};Properties
DynamicSuggestionsConfig
A prompt or instructions for the model to generate suggestions.
The minimum number of suggestions to generate.
The maximum number of suggestions to generate.
When the suggestions are available: "before-first-message", "after-first-message", "always", or "disabled".
The agent ID of the provider of the suggestions.
The agent ID of the consumer of the suggestions. Defaults to "*" (all agents).
StaticSuggestionsConfig
The fixed list of suggestions to display. Each entry is a Suggestion without the isLoading field.
When the suggestions are available: "before-first-message", "after-first-message", "always", or "disabled".
The agent ID of the consumer of the suggestions. Defaults to "*" (all agents).
Usage
import type { SuggestionsConfig } from "@copilotkit/core";
// Dynamic: model-generated
const dynamic: SuggestionsConfig = {
instructions: "Suggest follow-up questions about the report",
maxSuggestions: 3,
available: "after-first-message",
};
// Static: fixed list
const staticConfig: SuggestionsConfig = {
suggestions: [
{ title: "Summarize", message: "Summarize this page" },
],
available: "before-first-message",
};