Code Contributions

Set up the CopilotKit monorepo, test a change, and open a pull request.

Step 1: Install Prerequisites

  • Node.js 20.x or later
  • pnpm v10.x installed globally (npm i -g pnpm@^10)

Step 2: Repository Setup

Fork The Repository

First, head over to the CopilotKit repository and create a fork.

Then, clone your fork to your local machine:

git clone https://github.com/<your-username>/CopilotKit
cd CopilotKit

Install Dependencies

The CopilotKit repository is a monorepo using a pnpm workspace. Tasks across packages are orchestrated with Nx.

Install the dependencies using pnpm:

pnpm install

Build Packages

To make sure that everything works, build all packages once:

pnpm run build

Step 3: Development Mode

Now that everything is set up and works as expected, you can get started developing:

# Start all packages in development mode
pnpm run dev

# Start a specific package in development mode
pnpm exec nx watch --projects=packages/package-name -- pnpm run build

Now you can start making changes to the code.

You can find all @copilotkit/* packages under the packages folder of the monorepo.

Step 4: Test Changes in Real-Time

Run an example from the examples folder. The examples use the monorepo packages, so they show your changes.

Step 5: Formatting and Linting

Before committing your changes, make sure your files are formatted properly by running the following at the root of the monorepo:

pnpm run format

Also, make sure that you have no linting errors:

pnpm run lint

Step 6: Submit a Pull Request

Now that you've made your changes, commit and push them. Then, go to the Pull Requests page and create a pull request.

Debugging

When you run CopilotKit on localhost, the CopilotKit Inspector is on by default. Use it to see agent state, context, and the tools the agent can call. See Inspector and dev console.

(Advanced) Package Linking

In some cases, you want to test your CopilotKit changes in your own project. For example, you tried to integrate CopilotKit into your own codebase and encountered a bug you want to fix.

Conveniently, you can link your local CopilotKit packages to your own project to test your changes.

Check out the Advanced: Package Linking guide to learn how to do that.

Need help?

If you need help with anything, please don't hesitate to reach out to us on Discord. We have a dedicated #contributing channel.

How is this guide?