> For the complete documentation index, see [llms.txt](/llms.txt).
> A full single-fetch corpus is available at [llms-full.txt](/llms-full.txt).
---
title: Deploy a serverless endpoint to Vercel
description: Mount AGNT5 on Next.js route handlers, deploy an immutable Vercel release, and activate it safely.
last_verified: 2026-07-20
---

A **serverless endpoint** exposes AGNT5 workflow code through signed HTTP routes. This guide adds those routes to a Next.js application, deploys them to Vercel, and syncs the immutable Vercel deployment into AGNT5.

## 1. Add the handler

Install the TypeScript SDK and generate the route files:

```bash
npm install @agnt5/sdk@0.6.0
agnt5 serverless init --provider vercel --name orders-api
```

The command creates a shared handler plus `GET /.well-known/agnt5` and `POST /agnt5/invoke` route handlers. Keep the generated invoke route on the Edge runtime and keep its `maxDuration` greater than the AGNT5 request timeout.

## 2. Configure signing

Generate one secret and store the same value in Vercel and AGNT5:

```bash
( umask 077 && openssl rand -base64 32 > .agnt5-serverless-secret )
vercel env add AGNT5_SERVERLESS_SIGNING_SECRET production \
  < .agnt5-serverless-secret
```

Add `.agnt5-serverless-secret` to `.gitignore` before continuing.

## 3. Deploy and validate

Deploy an immutable production release:

```bash
vercel deploy --prod
agnt5 serverless validate https://<vercel-deployment-host>
```

For a protected deployment, pass Vercel's automation bypass header:

```bash
export VERCEL_AUTOMATION_BYPASS_SECRET=<vercel-bypass-secret>
agnt5 serverless validate https://<vercel-deployment-host> \
  --invoke-header-env x-vercel-protection-bypass=VERCEL_AUTOMATION_BYPASS_SECRET
```

## 4. Sync and activate

Import the release without changing active routes:

```bash
export AGNT5_SERVERLESS_SIGNING_SECRET="$(cat .agnt5-serverless-secret)"

agnt5 serverless sync https://<vercel-deployment-host> \
  --provider vercel \
  --env production \
  --immutable-ref <vercel-deployment-id> \
  --signing-secret-env AGNT5_SERVERLESS_SIGNING_SECRET \
  --request-timeout-ms 10000 \
  --yield-before-timeout-ms 1000 \
  --activate=false
```

Run **`agnt5 serverless status --deployment-id <deployment-id> --verify`**. Repeat the sync with `--activate=true` only after verification passes.

## Next steps

- [Serverless SDK reference](/docs/run/serverless-sdk-reference.md): use durable steps, timers, events, and budget suspension.
- [Operate serverless endpoints](/docs/run/operate-serverless-endpoints.md): promote, disable, recover, and roll back releases.
- [Serverless CLI reference](/cli/serverless.md): inspect every sync and provider-header option.
