🏠 Self-Host

Self-Hosting Sweep via Docker

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

Sweep GitHub App is an air-gapped, self-hostable version of Sweep which serves many repositories at once.

Setting up the Sweep GitHub App involves:

  1. Creating the GitHub App and getting a trial license key.
  2. Hosting the Sweep backend on a cloud provider like DigitalOcean.

The trial license key is valid for 14 days. To upgrade to an enterprise license key, contact us at team@sweep.dev. Feel free to reach out to us for any help or questions.

Create GitHub App

Create a GitHub App here (opens in a new tab) (1 minute). This tool will guide you through the process of creating a GitHub App, create a license key, and provide you with the necessary .env file.

It will be named .env.txt and you will need to rename it to .env (browser security reasons). It should look something like this.

.env
GITHUB_APP_ID=123456
GITHUB_APP_PEM=-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n
GITHUB_BOT_USER=sweepai-self-hosted
LICENSE_KEY=ABCDE-FGHIJ-KLMNO-PQRST-UVWXY

Anthropic and OpenAI API keys

Create an OpenAI API key (opens in a new tab) and an Anthropic API key (opens in a new tab) add it to your .env:

.env
...
ANTHROPIC_API_KEY=sk-ant-api03-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Hosting Sweep

To host Sweep you need to run the Sweep webhook on a publicly accessible server. We recommend using a cloud provider (DigitalOcean, AWS, or Azure) but you can also run it locally and use a reverse proxy like Ngrok.

If you encounter issues please reach out to us through Email, Discord or open a GitHub issue (opens in a new tab). We are online, please ping us @kevin, @william, and @martin.

We recommend deploying on the cloud for most users as the networking setup is easier. For this guide, we will use DigitalOcean.

1. Create Instance

Recommended specs:

  • OS: Ubuntu
  • RAM: 32 GB
  • CPU: 4 vCPUs
  • Storage: 100 GB
If you do not have Docker/Docker Compose setup
terminal
sudo apt install -y apt-transport-https ca-certificates curl software-properties-common -y
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
sudo add-apt-repository -y "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"
sudo apt update -y
sudo apt install docker-ce -y
sudo systemctl enable docker
sudo systemctl start docker
sudo usermod -aG docker ${USER}

Start the docker client if you are on Mac/Windows.

2. Configure .env and pull Sweep
terminal
git clone https://github.com/sweepai/sweep
cd sweep
vim .env

Copy the following from your local .env to your remote .env:

.env
# Step 1
GITHUB_APP_ID=123456
GITHUB_APP_PEM=-----BEGIN RSA PRIVATE KEY-----\n...\n-----END RSA PRIVATE KEY-----\n
GITHUB_BOT_USER=sweepai-self-hosted
LICENSE_KEY=ABCDE-FGHIJ-KLMNO-PQRST-UVWXY
# Step 2
ANTHROPIC_API_KEY=sk-ant-api03-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
OPENAI_API_KEY=sk-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
3. Deploy the Sweep backend
terminal
docker compose up --build hosted
# To run in background, docker compose up --build -d hosted
4. Update the GitHub Webhook URL

Get the IP address of your instance and add the port Sweep is deployed to (in this case, 8080):

http://YOUR_IP:8080

Navigating to this link should look like this:

Go to your GitHub app and update Webhook URL to the link above.

For user accounts:

https://github.com/settings/apps/GITHUB_BOT_USERNAME

For organizations:

https://github.com/YOUR_ORGANIZATION/sweepai/settings/apps/GITHUB_BOT_USERNAME

You have successfully deployed Sweep!

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

Creating a Pull Request with Sweep

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 see how to use Sweep (opens in a new tab).