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
LLM Adapters

OpenAIAssistantAdapter

Copilot Runtime adapter for OpenAI Assistant API.

Copilot Runtime adapter for the OpenAI Assistant API.

Example

import { CopilotRuntime, OpenAIAssistantAdapter } from "@copilotkit/runtime";
import OpenAI from "openai";
 
const copilotKit = new CopilotRuntime();
 
const openai = new OpenAI({
  organization: "<your-organization-id>",
  apiKey: "<your-api-key>",
});
 
return new OpenAIAssistantAdapter({
  openai,
  assistantId: "<your-assistant-id>",
  codeInterpreterEnabled: true,
  fileSearchEnabled: true,
});

Constructor Parameters

assistantIdstringrequired

The ID of the assistant to use.

openaiOpenAI

An optional OpenAI instance to use. If not provided, a new instance will be created.

codeInterpreterEnabledboolean
Default: "true"

Whether to enable code interpretation.

fileSearchEnabledboolean
Default: "true"

Whether to enable file search.

disableParallelToolCallsboolean
Default: "false"

Whether to disable parallel tool calls. You can disable parallel tool calls to force the model to execute tool calls sequentially. This is useful if you want to execute tool calls in a specific order so that the state changes introduced by one tool call are visible to the next tool call. (i.e. new actions or readables)

keepSystemRoleboolean
Default: "false"

Whether to keep the role in system messages as "System". By default, it is converted to "developer", which is used by newer OpenAI models

PREV
OpenAIAdapter
Slanted end borderSlanted end border
Slanted start borderSlanted start border
NEXT
AnthropicAdapter

On this page

Example
Constructor Parameters