You can self-host Agentset on your own servers and cloud infrastructure for greater control over your data and design. This guide will walk you through the entire process of setting up Agentset on your own servers.

Prerequisites

Before you begin, make sure you have the following:

Step 1: Local setup

First, you’ll need to clone the Agentset repo and install the dependencies.

1

Clone the repo

First, clone the Agentset repo.

Terminal
git clone https://github.com/agentset-ai/agentset.git
2

Install dependencies

Run the following command to install the dependencies:

Terminal
pnpm i
3

Set up environment variables

Convert the .env.example file to .env. You can start filling in the first few environment variables:

Terminal
# Default vector database (used when users select the Agentset managed option)
DEFAULT_PINECONE_API_KEY=pcsk_xxx
DEFAULT_PINECONE_HOST="https://xxx.svc.xxx-xxx-xxx.pinecone.io"

# Cohere API key (used for re-ranking)
DEFAULT_COHERE_API_KEY=xxx

# Default models (used when users select the Agentset managed option)
DEFAULT_AZURE_BASE_URL=https://xxx.cognitiveservices.azure.com/openai/deployments
DEFAULT_AZURE_API_KEY=xxx
DEFAULT_AZURE_TEXT_3_LARGE_EMBEDDING_DEPLOYMENT=text-embedding-3-large
DEFAULT_AZURE_TEXT_3_LARGE_EMBEDDING_VERSION=2023-05-15
DEFAULT_AZURE_GPT_4_1_DEPLOYMENT=gpt-4.1
DEFAULT_AZURE_GPT_4_1_VERSION=2025-01-01-preview

We currently use azure openai models as the default (when users pick the Agentset managed option). If you’d like to change that, update apps/web/src/lib/embeddings.ts and apps/web/src/lib/llm.ts to use a different provider.

You will fill in the remaining environment variables in the following steps.

Step 2: Set up Upstash Redis and Upstash Workflows

Next, you’ll need to set up Upstash Workflows and Redis. These will be used to orchestrate long-running tasks (like document ingestion) on serverless infrastructure.

1

Create Upstash Redis database

In your Upstash account, create a new Redis database.

2

Set up Upstash environment variables

Once your database is created, copy the UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN from the REST API section into your .env file as REDIS_URL and REDIS_TOKEN respectively.

Navigate to the QStash tab and copy the QSTASH_TOKEN, QSTASH_CURRENT_SIGNING_KEY, and QSTASH_NEXT_SIGNING_KEY from the Request Builder section into your .env file.

Step 3: Set up the partitioner API

Next, you’ll need to set up the partitioner API. This will be used to partition documents into chunks for vectorization. More information can be found here.

Make sure REDIS_HOST, REDIS_PORT, and REDIS_PASSWORD match the values in your Upstash Redis database created in Step 2.

Once you have the partitioner API running, set these environment variables in your .env file:

.env
PARTITION_API_URL= // the URL of the partitioner API (e.g. https://example.modal.run/ingest)
PARTITION_API_KEY= // the API key for the partitioner API

Step 4: Set up Supabase PostgreSQL database

Next, you’ll need to set up any PostgreSQL database (e.g. Supabase). This will be used to store application data (e.g. user sessions, user data, etc.).

1

Create Supabase database

In your Supabase account, create a new database.

Make sure to copy the password you write to use for the next step.

2

Set up Supabase environment variables

Then, click on the Connect button on the top left, navigate to the ORMs tab, and select Prisma.

After that, copy the DATABASE_URL and DIRECT_URL into your .env file. And make sure to replace [YOUR-PASSWORD] with the password you wrote down in the previous step.

3

Apply migrations

In the terminal, run the following command to generate the Prisma client:

Terminal
pnpm run db:generate

Then, run the following command to apply the database migrations:

Terminal
pnpm run db:deploy

Step 5: Set up GitHub OAuth

Next, create a new GitHub App. This will allow you to sign in to Agentset with your GitHub account.

Don’t forget to set the following Callback URLs:

  • https://app.acme.com/api/auth/callback/github
  • http://localhost:3000/api/auth/callback/github for local development.

Optional: Set the “Email addresses” account permission to read-only in order to access private email addresses on GitHub.

Once your GitHub App is created, copy the Client ID and Client Secret into your .env file as the GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET environment variables.

Step 6: Set up Google OAuth

Next, you’ll need to set up Google OAuth. This will allow you to sign in to Agentset with your Google account.

1

Create Google OAuth App

In your Google Cloud Console, create a new OAuth client ID and client secret.

2

Set up Google OAuth environment variables

Once your Google OAuth App is created, copy the Client ID and Client Secret into your .env file as the GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET environment variables.

Step 7: Set up Cloudflare R2

Agentset stores file uploads in either S3 or S3-compatible services like Cloudflare R2.

We recommend using Cloudflare R2 for self-hosting Agentset, as it’s a more cost-effective solution compared to AWS S3. Here’s how you can set it up:

1

Create R2 bucket

You’ll need to subscribe to the R2 service if you haven’t already.

In your Cloudflare account, create a new R2 bucket. We recommend giving your bucket a descriptive name (e.g. agentset) and leaving the remaining settings as is.

In your bucket settings, copy the S3 API value – you’ll need it in Step 3.

2

Set up access to R2

From the R2 main page, click Manage R2 API Tokens on the right-hand column.

Then, click Create API Token.

Make sure to name your API token something relevant to the service that will be using the token.

Give it “Object Read & Write” permissions, and we recommend only applying ito to a single bucket.

You can leave the remaining settings (TTL, Client IP Address Filtering) as is, and click Create API Token.

After you create you token, copy the Access Key ID and Secret Access Key values – you’ll need them in the next step.

3

Set up R2 environment variables

Once you have your credentials, set them in your .env file:

.env
S3_ACCESS_KEY= // this is the Access Key ID value from Step 2
S3_SECRET_KEY= // this is the Secret Access Key value from Step 2
S3_ENDPOINT= // this is the S3 API value from Step 1
S3_BUCKET= // this is the name of the bucket you created in Step 1

Step 8: Set up Resend (optional)

Note that if you want to use magic link sign-in, this is a required step.

Next, you’ll need to set up Resend for transactional emails (e.g. magic link emails):

  1. Sign up for Resend and create your API key here.
  2. Copy the API key into your .env file as the RESEND_API_KEY environment variable.
  3. You’ll then need to set up and verify your domain by following this guide here.

Step 9: Deploy to Vercel

Once you’ve set up all of the above services, you can now deploy your app to Vercel.

1

Deploy code to GitHub

If you haven’t already, push up your cloned repository to GitHub by running the following commands:

Terminal
git add .
git commit -m "Initial commit"
git push origin main
2

Create a new Vercel project

In your Vercel account, create a new project. Then, select your GitHub repository and click Import.

Make sure that your Framework Preset is set to Next.js and the Root Directory is set to apps/web.

In the Environment Variables section, add all of the environment variables from your .env file by copying all of them and pasting it into the first input field. A few notes:

  • Replace the BETTER_AUTH_URL environment variable with the app domain that you will be using (e.g. https://app.acme.com).

Click on Deploy to deploy your project.

If you get a No Output Directory called "public" was found after the build completed error, make sure that your Vercel deployment settings to make sure that they match the following:

3

Done!

Once the deployment is complete, you should be able to visit your app domain (e.g. https://app.acme.com) and see the following login page:

Caveats

This guide is meant to be a starting point for self-hosting Agentset. It currently depends on the following services to work:

In the future, we plan to make it easier to self-host Agentset by providing Docker images and a CLI for easy setup.