Skip to Content
कवच

Deploy

Put the site, docs and dashboard demo on Cloudflare, run the bot under test in an Agent37 sandbox, and host the API.

Kavach has three parts you might deploy, and they go to different places.

PartWhat it isWhere it goes
SiteThis landing page, the docs and the dashboard's recorded demo, as static filesCloudflare Workers static assets
Target botDiwaliMart Support, the bot being attackedAn Agent37 sandbox, or any machine that runs Python
APIThe orchestrator, agents and event streamAny machine that runs Python; your laptop is fine

The site needs no backend: the dashboard demo replays a recording bundled into the build.

The site, on Cloudflare

Sign in once

pnpm --filter @kavach/web exec wrangler login

Build and deploy

pnpm deploy:site

This syncs the docs from docs/, builds the dashboard into the site under /dashboard/, exports everything as static HTML (STATIC_EXPORT=1) to apps/web/out and uploads it with wrangler deploy. Set NEXT_PUBLIC_SITE_URL to the final address first, so social cards use absolute links.

Check it before it goes live (optional)

pnpm --filter @kavach/web build:cf
pnpm --filter @kavach/web preview:cf     # serves out/ on a local Workers runtime

The Worker is configured in apps/web/wrangler.jsonc: it serves ./out, adds trailing slashes the way the export expects and returns the site's own 404 page for unknown paths. There is no server code, so it runs on the free plan.

Deploy on every push

.github/workflows/deploy-site.yml builds the static site on every push to main that touches the apps, packages, docs or recorded runs. Add two repository secrets and it deploys too:

  • CLOUDFLARE_API_TOKEN, a token with Workers Scripts: Edit
  • CLOUDFLARE_ACCOUNT_ID

Without them, the workflow still builds, so a broken export fails the check, and skips the upload. It works out the site address from your workers.dev subdomain, or from a SITE_URL repository variable if you set one.

Ship a new recording

The demo plays runs/demo_run.jsonl. Record one with pnpm demo, commit it, and deploy again. Until there is one, the demo plays the sample run and labels it as simulated.

The target bot, on Agent37

An Agent37 instance is a throwaway microVM, so a bot that issues real refunds can be attacked without touching anything you care about.

AGENT37_API_KEY=... ANTHROPIC_API_KEY=... ./scripts/deploy_target_agent37.sh

The script creates an instance, clones the repo into it, installs the backend, starts the bot on port 8000 in the background, waits for its health check and prints the two lines to put in .env:

TARGET_URL=https://<instance-preview-url>
TARGET_EXTRA_HEADERS={"X-Agent37-Key": "<your Agent37 key>"}

Optional variables: TARGET_MODEL (default anthropic/claude-haiku-5-5), PORT, REPO_URL and INSTANCE_ID to reuse an instance. The script passes only the one provider key that TARGET_MODEL needs. When the demo is over, stop the billing:

./scripts/deploy_target_agent37.sh delete <instance_id>

The API

The API is a FastAPI app in backend/. Anywhere with Python 3.11 or newer and uv can run it:

cd backend
uv sync
make api        # Kavach API on :8000
make target     # the bot on :8001, if it is not on Agent37

Set DASHBOARD_ORIGIN to wherever the dashboard is served from, and keep .env and agent_config.yaml on that machine only. Runs and reports are written to RUNS_DIR.

On this page