🏠 Self-Host

Deploying your own Sweep instance via Docker

We use theΒ Elastic License V2 (opens in a new tab) which allows commercial usage for Sweep. This is a guide for self-hosting Sweep. If you would like to use our hosted version, please visit https://github.com/apps/sweep-ai (opens in a new tab).

1. Downloading Sweep

Open Docker Desktop (opens in a new tab) and run the following code in your terminal (hover over code for copy button):

terminal
git clone --depth 1 --single-branch https://github.com/sweepai/sweep
cd sweep
touch .env
docker compose pull
  1. Clone the sweepai/sweep (opens in a new tab) repository
  2. Create a .env file in the root directory
  3. Pull the docker image.

In the .env, configure the repository that Sweep should work on.

.env
REPO=your-username/your-repo

We're halfway done! Pulling the image will take a few minutes, so let's complete the next steps for now.

2. GitHub PAT

To allow Sweep to access your repo, create a new GitHub Personal Access Token (PAT) here (opens in a new tab). Sweep will run entirely locally, and no code will be shared outside of OpenAI's API.

Add this to your .env which should now look like this:

.env
REPO=your-username/your-repo
GITHUB_PAT=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

❓ Link not working?

If the link doesn't work, you can go here (opens in a new tab) and manually set your preferred token name (e.g. Sweep Self-Hosted), and select the following permissions:

  • repo (ALL)
  • workflow

3. OpenAI API Token

Please create an OpenAI API token at https://platform.openai.com/account/api-keys (opens in a new tab).

OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

After following the above sections, your .env should look like this:

.env
REPO=your-username/your-repo
GITHUB_PAT=ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

4. Deploying Sweep Locally

Once docker compose pull from Step 1 is complete, you can run Sweep locally with the following command:

terminal
docker compose up # Add -d to run in background

5. Creating a Pull Request with Sweep

Finally, you can use Sweep by creating a new issue on the repository with a title prefixed with Sweep:, like Sweep: add type hints to BaseIndex.tsx!

For more details on using Sweep see how to use Sweep (opens in a new tab).

You have successfully deployed Sweep! πŸš€


Alternative Deployment via GitHub App:

If you successfully deployed Sweep, you can skip this section.

You can self-deploy Sweep as a GitHub App to serve many repos at once. This is a more complicated process, but it is more scalable and is what we use for our hosted version. You can find the instructions here (opens in a new tab) or contact us at team@sweep.dev if you need help getting set up.