Code Contributions
Set up the CopilotKit monorepo, test a change, and open a pull request.
Step 1: Install Prerequisites
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 CopilotKitStep 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 buildNow 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.
For this tutorial, we'll use the next-openai example, specifically the Presentation Demo (/presentation).
In a separate terminal, run the following command to start the example:
cd examples/v1/next-openai
export OPENAI_API_KEY=<your-openai-api-key>
pnpm run example-devWe use the pnpm run example-dev command to run examples, which is different
from the pnpm run dev command we use to work on the individual packages.
Now navigate to http://localhost:3000/presentation and you should see the example running. Any changes you make to the CopilotKit packages will immediately be reflected here.
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 formatAlso, make sure that you have no linting errors:
pnpm run lintStep 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.
To hide the Inspector locally, set enableInspector={false} on your <CopilotKit /> provider.
(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?