🏠 Self-Host

Self-Hosting Sweep via Docker

πŸŽ‰ We use the open sourceΒ AGPL (opens in a new tab) license which allows for commercial usage.

This is a guide for self-hosting Sweep. To use a hosted version please visit https://github.com/apps/sweep-ai (opens in a new tab).

Sweep currently has two self-hosted options:

  1. Local Script - This is the easiest way to get started with Sweep.
  2. GitHub App - This is more scalable and is what we use for our hosted version.

For help setting up Sweep please contact us at team@sweep.dev.

5 minutes

Our local script polls GitHub for events. Sweep creates pull requests for you when you make a GitHub issue and responds to pull request comments.

Setting up the local script involves getting a GitHub PAT and OpenAI key and then running a Docker container.

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

(Optional) Disabling Telemetry

We log user events (not user code) to improve the product, such as the # of pull requests created and merged. To disable telemetry, you can add the following line to your .env:

.env
POSTHOG_API_KEY=none

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

You have successfully deployed Sweep!

For enterprise support such as fine-tuning (20% performance gain), usage tracking, and progress dashboards please contact team@sweep.dev.

To use Sweep, you can create a new issue on the repository. If you encounter rate limits please use the GitHub App deployment method.