Skip to content
View CopilotKit's full-sized avatar
Block or Report

Block or report CopilotKit

Block user

Prevent this user from interacting with your repositories and sending you notifications. Learn more about blocking users.

You must be logged in to block users.

Add an optional note:
Please don't include any personal information such as legal names or email addresses. Maximum 100 characters, markdown supported. This note will be visible to only you.
Report abuse

Contact GitHub support about this user’s behavior. Learn more about reporting abuse.

Report abuse
CopilotKit/README.md
CopilotKit Logo

Discord GitHub CI NPM MIT

The Open-Source Copilot Platform

in-app chatbots, and AI-enabled Textareas.

Backed by Techstars


Explore the docs »

Join our Discord · Website · Report Bug · Request Feature

Questions? Book a call with us »


🌟 <CopilotPortal />:
Build in-app AI chatbots that can "see" the current app state + take action inside your app.
The AI chatbot can talk to your app frontend & backend, and to 3rd party services (Salesforce, Dropbox, etc.) via plugins.
AI "second brain" for your users, on tap.

🌟 <CopilotTextarea />:
AI-assisted text generation. Drop-in replacement for any <textarea />.
Autocompletions + AI editing + generate from scratch. Indexed on your users' content.
Starting with React. Use any LLM.

Combines frontend SDKs, backend SDKs, and (optional) cloud infrastructure. Open-source 🪁

🎯 Features Overview

CopilotTextarea: AI-assisted text generation + editing.

  • ✅ A a drop-in <textarea /> replacement. Supports all <textarea /> customizations.
  • ✅ Context-aware autocompletions ✨ (like in GitHub Copilot)
  • ✅ AI editing ✨ - "list the client's top 3 pain points from the last call using @SalesforceData"
  • 🟩 Generate from scratch ✨ - automatically populate the initial content based on given context
  • ✅ App context & 3rd party context with useMakeCopilotReadable and useMakeCopilotDocumentReadable
  • ✅ Fully custsomizable prompt engineering
  • 🟩 Arbitrary LLM chains.
  • 🟩 Bold + italics.

Copilot Chatbot: (frontend + backend) runtimes for in-app copilots.

  • ✅ Index on frontend app state (via useMakeCopilotReadable and useMakeCopilotDocumentReadable)
  • 🟩 Index on backend state
  • ✅ frontend function calling runtime (in-app actions) (via useMakeCopilotActionable)
  • 🟩 backend function calling runtime (auth enabled)
  • 🟩 Autorun vs. "sensitive" functions (require user approval before execution).
  • ✅ Cursor-style @document-referecing.
  • ✅ Bring your own model
  • 🟩 3rd party plugins
  • 🟩 execute arbitrary LLM chains
  • 🟩 OpenAI assistants api
  • ✅ Fully customize UI

Demo

2-min showcase + 2-min implementation tutorial:

copilot_full_demo_nxxpbr.3.mp4

Installation

npm i @copilotkit/react-core @copilotkit/react-ui @copilotkit/react-textarea

Getting started

See quickstart in the docs

Examples

<CopilotTextarea />

A drop-in <textarea /> replacement with context-aware Copilot autocompletions.

Features

  1. Customizable purpose prompt.
  2. Provide arbitrary context to inform autocompletions using useMakeCopilotReadable
  3. Works with any backend/LLM, using ChatlikeApiEndpoint
  4. Supports all <textarea /> customizations
import "@copilotkit/react-textarea/styles.css"; // add to the app-global css
import { CopilotTextarea } from "@copilotkit/react-textarea";
import { CopilotProvider } from "@copilotkit/react-core";

// call ANYWHERE in your app to provide external context (make sure you wrap the app with a <CopilotProvider >):
// See below for more features (parent/child hierarchy, categories, etc.)
useMakeCopilotReadable(relevantInformation)
useMakeCopilotDocumentReadable(document)

return (
  <CopilotProvider chatApiEndpoint="/api/copilotkit/chat"> {/* Global state & copilot logic. Put this around the entire app */}
    <CopilotTextarea
      className="p-4 w-1/2 aspect-square font-bold text-3xl bg-slate-800 text-white rounded-lg resize-none"
      placeholder="A CopilotTextarea!"
      autosuggestionsConfig={{
        purposePrompt: "A COOL & SMOOTH announcement post about CopilotTextarea. Be brief. Be clear. Be cool.",
        forwardedParams: { // additional arguments to customize autocompletions
          max_tokens: 25,
          stop: ["\n", ".", ","],
        },
      }}
    />
  </CopilotProvider>
);

Integrate copilot

import "@copilotkit/react-ui/styles.css"; // add to the app-global css
import { CopilotProvider } from "@copilotkit/react-core";
import { CopilotSidebarUIProvider } from "@copilotkit/react-ui";

export default function App(): JSX.Element {
  return (
  <CopilotProvider chatApiEndpoint="/api/copilotkit/chat"> {/* Global state & copilot logic. Put this around the entire app */}
      <CopilotSidebarUIProvider> {/* A built-in Copilot UI (or bring your own UI). Put around individual pages, or the entire app. */}

        <YourContent />

      </CopilotSidebarUIProvider>
    </CopilotProvider>
  );
}

Features

  1. Batteries included. Add 2 React components, and your Copilot is live.
  2. Customize the built-in CopilotSidebarUIProvider UI -- or bring your own UI component.
  3. Extremely hackable. Should the need arise, you can define 1st-class extensions just as powerful as useMakeCopilotReadable, useMakeCopilotActionable, etc.

Give the copilot read permissions

Features

  1. Propagate useful information & granular app-state to the Copilot
  2. Easily maintain the hierarchical structure of information with parentId
  3. One call to rule them all: useMakeCopilotReadable works both with the sidekick, and with CopilotTextarea.
    • Use the contextCategories: string[] param to route information to different places.
import { useMakeCopilotReadable } from "@copilotkit/react-core";


function Employee(props: EmployeeProps): JSX.Element {
  const { employeeName, workProfile, metadata } = props;

  // propagate any information copilot
  const employeeContextId = useMakeCopilotReadable(employeeName);

  // Pass a parentID to maintain a hiearchical structure.
  // Especially useful with child React components, list elements, etc.
  useMakeCopilotReadable(workProfile.description(), employeeContextId);
  useMakeCopilotReadable(metadata.description(), employeeContextId);
  
  return (
    // Render as usual...
  );
}

Give the copilot write permissions

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

function Department(props: DepartmentProps): JSX.Element {
  // ...

  // Let the copilot take action on behalf of the user.
  useMakeCopilotActionable(
    {
      name: "setEmployeesAsSelected",
      description: "Set the given employees as 'selected'",
      argumentAnnotations: [
        {
          name: "employeeIds",
          type: "array", items: { type: "string" }
          description: "The IDs of employees to set as selected",
          required: true
        }
      ],
      implementation: async (employeeIds) => setEmployeesAsSelected(employeeIds),
    },
    []
  );

  // ...
}

Features

  1. Plain typescript actions. Edit a textbox, navigate to a new page, or anythign you can think of.
  2. Specify arbitrary input types.

Near-Term Roadmap

📊 Please vote on features via the Issues tab!

Copilot-App Interaction

  • useMakeCopilotReadable: give static information to the copilot, in sync with on-screen state
  • useMakeCopilotActionable: Let the copilot take action on behalf of the user
  • 🚧 useMakeCopilotAskable: let the copilot ask for additional information when needed (coming soon)
  • 🚧 useEditCopilotMessage: edit the (unsent) typed user message to the copilot (coming soon)
  • 🚧 copilot-assisted navigation: go to the best page to achieve some objective.
  • 🚧 CopilotCloudKit: integrate arbitrary LLM logic / chains / RAG, using plain code.

UI components

  • <CopilotSidebarUIProvider>: Built in, hackable Copilot UI (optional - you can bring your own UI).
  • <CopilotTextarea />: drop-in <textarea /> replacement with Copilot autocompletions.

Integrations

  • ✅ Vercel AI SDK
  • ✅ OpenAI APIs
  • 🚧 Langchain
  • 🚧 Additional LLM providers

Frameworks

  • ✅ React
  • 🚧 Vue
  • 🚧 Svelte
  • 🚧 Swift (Mac + iOS)

Contribute

Contributions are welcome! 🎉

Join the Discord Discord

Contact

atai <at> copilotkit.ai

Pinned

  1. CopilotKit CopilotKit Public

    Build in-app AI chatbots 🤖, and AI-powered Textareas ✨, into react web apps.

    TypeScript 1.4k 132

59 contributions in the last year

No contributions on December 4th.No contributions on December 11th.No contributions on December 18th.No contributions on December 25th.No contributions on January 1st.No contributions on January 8th.No contributions on January 15th.No contributions on January 22nd.No contributions on January 29th.No contributions on February 5th.No contributions on February 12th.No contributions on February 19th.No contributions on February 26th.No contributions on March 5th.No contributions on March 12th.No contributions on March 19th.No contributions on March 26th.No contributions on April 2nd.No contributions on April 9th.No contributions on April 16th.No contributions on April 23rd.No contributions on April 30th.No contributions on May 7th.No contributions on May 14th.No contributions on May 21st.No contributions on May 28th.No contributions on June 4th.No contributions on June 11th.No contributions on June 18th.No contributions on June 25th.No contributions on July 2nd.No contributions on July 9th.No contributions on July 16th.No contributions on July 23rd.No contributions on July 30th.No contributions on August 6th.No contributions on August 13th.No contributions on August 20th.7 contributions on August 27th.No contributions on September 3rd.No contributions on September 10th.No contributions on September 17th.No contributions on September 24th.No contributions on October 1st.No contributions on October 8th.No contributions on October 15th.No contributions on October 22nd.No contributions on October 29th.No contributions on November 5th.No contributions on November 12th.No contributions on November 19th.No contributions on November 26th.No contributions on December 3rd.No contributions on December 5th.No contributions on December 12th.No contributions on December 19th.No contributions on December 26th.No contributions on January 2nd.No contributions on January 9th.No contributions on January 16th.No contributions on January 23rd.No contributions on January 30th.No contributions on February 6th.No contributions on February 13th.No contributions on February 20th.No contributions on February 27th.No contributions on March 6th.No contributions on March 13th.No contributions on March 20th.No contributions on March 27th.No contributions on April 3rd.No contributions on April 10th.No contributions on April 17th.No contributions on April 24th.No contributions on May 1st.No contributions on May 8th.No contributions on May 15th.No contributions on May 22nd.No contributions on May 29th.No contributions on June 5th.No contributions on June 12th.1 contribution on June 19th.No contributions on June 26th.No contributions on July 3rd.No contributions on July 10th.No contributions on July 17th.No contributions on July 24th.No contributions on July 31st.No contributions on August 7th.No contributions on August 14th.No contributions on August 21st.6 contributions on August 28th.No contributions on September 4th.No contributions on September 11th.No contributions on September 18th.No contributions on September 25th.No contributions on October 2nd.No contributions on October 9th.No contributions on October 16th.No contributions on October 23rd.No contributions on October 30th.1 contribution on November 6th.No contributions on November 13th.No contributions on November 20th.No contributions on November 27th.No contributions on December 4th.No contributions on December 6th.No contributions on December 13th.No contributions on December 20th.No contributions on December 27th.No contributions on January 3rd.No contributions on January 10th.No contributions on January 17th.No contributions on January 24th.No contributions on January 31st.No contributions on February 7th.No contributions on February 14th.No contributions on February 21st.No contributions on February 28th.No contributions on March 7th.No contributions on March 14th.No contributions on March 21st.No contributions on March 28th.No contributions on April 4th.No contributions on April 11th.No contributions on April 18th.No contributions on April 25th.No contributions on May 2nd.No contributions on May 9th.No contributions on May 16th.No contributions on May 23rd.No contributions on May 30th.No contributions on June 6th.No contributions on June 13th.No contributions on June 20th.No contributions on June 27th.No contributions on July 4th.No contributions on July 11th.No contributions on July 18th.No contributions on July 25th.No contributions on August 1st.No contributions on August 8th.No contributions on August 15th.3 contributions on August 22nd.No contributions on August 29th.No contributions on September 5th.No contributions on September 12th.No contributions on September 19th.No contributions on September 26th.No contributions on October 3rd.No contributions on October 10th.No contributions on October 17th.No contributions on October 24th.No contributions on October 31st.No contributions on November 7th.No contributions on November 14th.No contributions on November 21st.No contributions on November 28th.6 contributions on December 5th.No contributions on December 7th.No contributions on December 14th.No contributions on December 21st.No contributions on December 28th.No contributions on January 4th.No contributions on January 11th.No contributions on January 18th.No contributions on January 25th.No contributions on February 1st.No contributions on February 8th.No contributions on February 15th.No contributions on February 22nd.No contributions on March 1st.No contributions on March 8th.No contributions on March 15th.No contributions on March 22nd.No contributions on March 29th.No contributions on April 5th.No contributions on April 12th.1 contribution on April 19th.No contributions on April 26th.No contributions on May 3rd.No contributions on May 10th.No contributions on May 17th.No contributions on May 24th.No contributions on May 31st.No contributions on June 7th.No contributions on June 14th.No contributions on June 21st.No contributions on June 28th.No contributions on July 5th.No contributions on July 12th.No contributions on July 19th.No contributions on July 26th.No contributions on August 2nd.No contributions on August 9th.No contributions on August 16th.1 contribution on August 23rd.5 contributions on August 30th.No contributions on September 6th.No contributions on September 13th.No contributions on September 20th.No contributions on September 27th.No contributions on October 4th.No contributions on October 11th.No contributions on October 18th.No contributions on October 25th.No contributions on November 1st.No contributions on November 8th.No contributions on November 15th.No contributions on November 22nd.No contributions on November 29th.7 contributions on December 6th.No contributions on December 8th.No contributions on December 15th.No contributions on December 22nd.No contributions on December 29th.No contributions on January 5th.No contributions on January 12th.No contributions on January 19th.No contributions on January 26th.No contributions on February 2nd.No contributions on February 9th.No contributions on February 16th.No contributions on February 23rd.No contributions on March 2nd.No contributions on March 9th.No contributions on March 16th.No contributions on March 23rd.No contributions on March 30th.No contributions on April 6th.No contributions on April 13th.No contributions on April 20th.No contributions on April 27th.No contributions on May 4th.No contributions on May 11th.No contributions on May 18th.No contributions on May 25th.No contributions on June 1st.No contributions on June 8th.No contributions on June 15th.No contributions on June 22nd.No contributions on June 29th.No contributions on July 6th.No contributions on July 13th.1 contribution on July 20th.No contributions on July 27th.No contributions on August 3rd.No contributions on August 10th.No contributions on August 17th.5 contributions on August 24th.9 contributions on August 31st.No contributions on September 7th.No contributions on September 14th.No contributions on September 21st.No contributions on September 28th.No contributions on October 5th.No contributions on October 12th.No contributions on October 19th.No contributions on October 26th.No contributions on November 2nd.No contributions on November 9th.No contributions on November 16th.No contributions on November 23rd.No contributions on November 30th.No contributions on December 7th.No contributions on December 9th.No contributions on December 16th.No contributions on December 23rd.No contributions on December 30th.No contributions on January 6th.No contributions on January 13th.No contributions on January 20th.No contributions on January 27th.No contributions on February 3rd.No contributions on February 10th.No contributions on February 17th.No contributions on February 24th.No contributions on March 3rd.No contributions on March 10th.No contributions on March 17th.No contributions on March 24th.No contributions on March 31st.No contributions on April 7th.No contributions on April 14th.No contributions on April 21st.No contributions on April 28th.No contributions on May 5th.No contributions on May 12th.No contributions on May 19th.No contributions on May 26th.No contributions on June 2nd.No contributions on June 9th.No contributions on June 16th.No contributions on June 23rd.No contributions on June 30th.No contributions on July 7th.No contributions on July 14th.No contributions on July 21st.1 contribution on July 28th.No contributions on August 4th.No contributions on August 11th.1 contribution on August 18th.1 contribution on August 25th.No contributions on September 1st.No contributions on September 8th.No contributions on September 15th.No contributions on September 22nd.No contributions on September 29th.No contributions on October 6th.No contributions on October 13th.No contributions on October 20th.No contributions on October 27th.No contributions on November 3rd.No contributions on November 10th.1 contribution on November 17th.No contributions on November 24th.No contributions on December 1st.No contributions on December 8th.No contributions on December 10th.No contributions on December 17th.No contributions on December 24th.No contributions on December 31st.No contributions on January 7th.No contributions on January 14th.No contributions on January 21st.No contributions on January 28th.No contributions on February 4th.No contributions on February 11th.No contributions on February 18th.No contributions on February 25th.No contributions on March 4th.No contributions on March 11th.No contributions on March 18th.No contributions on March 25th.No contributions on April 1st.No contributions on April 8th.No contributions on April 15th.No contributions on April 22nd.No contributions on April 29th.No contributions on May 6th.No contributions on May 13th.No contributions on May 20th.No contributions on May 27th.No contributions on June 3rd.No contributions on June 10th.No contributions on June 17th.No contributions on June 24th.No contributions on July 1st.No contributions on July 8th.No contributions on July 15th.No contributions on July 22nd.No contributions on July 29th.No contributions on August 5th.No contributions on August 12th.No contributions on August 19th.No contributions on August 26th.No contributions on September 2nd.No contributions on September 9th.No contributions on September 16th.No contributions on September 23rd.No contributions on September 30th.No contributions on October 7th.No contributions on October 14th.No contributions on October 21st.2 contributions on October 28th.No contributions on November 4th.No contributions on November 11th.No contributions on November 18th.No contributions on November 25th.No contributions on December 2nd.No contributions on December 9th.
Contribution Graph
Day of Week December January February March April May June July August September October November
Sunday
Monday
Tuesday
Wednesday
Thursday
Friday
Saturday
Less
No contributions.
Low contributions.
Medium-low contributions.
Medium-high contributions.
High contributions.
More

Contribution activity

December 2023

Created 2 repositories
Opened 2 pull requests in 1 repository
CopilotKit/CopilotKit 2 merged

Seeing something unexpected? Take a look at the GitHub profile guide.