Skip to content

Self-host

Run the gateway, the dashboard and Postgres on your own machine or cloud, and sign in to your own copy of the app.

Nothing phones home and nothing leaves by default: a fresh install has outbound calls switched off and answers with a built-in test model, so it works end to end with no model key.

Docker Compose

  1. Get the code and make two secrets

    The gateway refuses to start without both. Keep a copy of the signing key outside the database: it is what makes the audit trail tamper-evident.

    bash
    git clone https://github.com/architsharm/agentfox.git && cd agentfox
    export AGENTFOX_SERVICE_AUTH_SECRET="$(openssl rand -hex 32)"
    export AGENTFOX_AUDIT_SIGNING_KEY="$(openssl rand -hex 32)"
  2. Start it

    This starts Postgres, the gateway on port 8080 and the dashboard on port 3000. Change the database password in deploy/docker-compose.yml before real use.

    bash
    docker compose -f deploy/docker-compose.yml up -d
  3. Load the policies and controls

    The gateway creates its tables when it starts. init also loads the control catalog and the shipped policy packs, every one watching, so they show on Policies. It is safe to run again.

    bash
    docker compose -f deploy/docker-compose.yml exec gateway agentfox init --path /tmp
  4. Create the first owner

    No demo data is loaded. This creates you as owner and prints a token, once.

    bash
    docker compose -f deploy/docker-compose.yml exec gateway \
      agentfox admin users create you@example.com --role owner --token
  5. Sign in

    Open http://localhost:3000/login, choose Self-hosted? Sign in with an API token and paste the token. You land on Agents, with the setup card. The browser gets a session of its own: signing out ends that session and never revokes the token you pasted, so the CLI and your app keep working.

    To add a teammate, open Settings → Members, enter their email and a role, and send them the sign-in key it shows once (it works for 7 days).

  6. Connect your agents to it

    Follow the Quickstart against your own dashboard, or point clients at http://localhost:8080 as in Any language (HTTP).

Render

render.yaml at the repository root creates Postgres, the gateway and the dashboard. In Render choose New, Blueprint, and pick your fork. It asks for AGENTFOX_AUDIT_SIGNING_KEY once: paste a random value and keep a copy. It also asks for GITHUB_CLIENT_ID and GITHUB_CLIENT_SECRET for GitHub sign-in; set the OAuth app's callback to https://<dashboard-host>/api/auth/github/callback. Google and Microsoft sign-in are optional: set GOOGLE_CLIENT_ID/GOOGLE_CLIENT_SECRET or MICROSOFT_CLIENT_ID/MICROSOFT_CLIENT_SECRET, with callbacks at /api/auth/google/callback and /api/auth/microsoft/callback.

A Python app

If you already run Python services and want no containers:

bash
pip install "agentfox[postgres]"
export AGENTFOX_DATABASE_URL="postgresql+psycopg://agentfox:PASSWORD@db.internal:5432/agentfox"
export AGENTFOX_ENVIRONMENT=production    # plus the two secrets above
agentfox init
agentfox serve --host 0.0.0.0 --port 8080

Then create the owner with agentfox admin users create as above. To keep it running on Linux, with scheduled jobs, use the systemd guide.

Health checks

Point a load balancer or uptime probe at GET /health on the gateway (the same answer is at /api/health). It needs no sign-in and returns 200 with "status": "ok" while the process is serving, plus the running version. governance_healthy is false when too many recent checks were answered without a detector they should have run (for example, one keeps timing out); alert on that rather than restart, since the process itself is fine.

bash
curl -s http://localhost:8080/health

Upgrades

Back up the database, pull the new image or package, then migrate before the new version serves traffic. In Compose or Render, run this inside the gateway container:

bash
agentfox admin db upgrade

Every setting, including models, detectors and outbound calls, is on Configuration. Before real traffic, go through the Production checklist.

If something goes wrong

You seeDo this
refusing to start in environment 'production'Set the variable it names to a random value, not a published default.
401 on every /api callProduction needs a token. Create one with agentfox admin auth issue.
unknown user, when issuing a tokenNo owner exists yet. Run agentfox admin users create first.
GitHub sign-in failsGITHUB_CLIENT_* is unset, or AGENTFOX_SERVICE_AUTH_SECRET differs between gateway and dashboard. Token sign-in works without either.
cannot use a string pattern on a bytes-like objectThe Postgres database is SQL_ASCII. Create it as UTF-8.