benchweave serve

Run a BenchWeave gateway locally (foreground; systemd Type=simple).

benchweave serve [OPTIONS]

Wires the environment into :func:app_entry.build — the same composition the integration suites boot — and runs it under uvicorn in the FOREGROUND (uvicorn.run blocks; daemonization belongs to the service manager, which is why the unit is Type=simple). The production secret posture is enforced inside build: with BENCHWEAVE_ENV=production a default/absent BENCHWEAVE_SECRET refuses before anything touches disk.

Issue #422 increment 1: the data-dir locator (--data-dir / BENCHWEAVE_DATA_DIR, or today’s BENCHWEAVE_DB parent) also auto-bridges <data-dir>/benchweave.env into the environment, set-if-not-set, before build() — the secret setup wrote to disk no longer needs the operator’s grep/cut/export dance. A systemd EnvironmentFile still wins by construction (process environment first), and the file may only carry allowlisted service keys (:func:benchweave.cli.env_file.serve_env_file_keys); anything else refuses typed with the env_file: prefix.

Full --help output
Usage: benchweave serve [OPTIONS]

  Run a BenchWeave gateway locally (foreground; systemd Type=simple).

  Wires the environment into :func:`app_entry.build` — the same composition
  the integration suites boot — and runs it under uvicorn in the FOREGROUND
  (``uvicorn.run`` blocks; daemonization belongs to the service manager, which
  is why the unit is ``Type=simple``). The production secret posture is
  enforced inside ``build``: with ``BENCHWEAVE_ENV=production`` a
  default/absent ``BENCHWEAVE_SECRET`` refuses before anything touches disk.

  Issue #422 increment 1: the data-dir locator (``--data-dir`` /
  ``BENCHWEAVE_DATA_DIR``, or today's ``BENCHWEAVE_DB`` parent) also auto-
  bridges ``<data-dir>/benchweave.env`` into the environment, set-if-not-set,
  before ``build()`` — the secret ``setup`` wrote to disk no longer needs the
  operator's grep/cut/export dance. A systemd ``EnvironmentFile`` still wins
  by construction (process environment first), and the file may only carry
  allowlisted service keys
  (:func:`benchweave.cli.env_file.serve_env_file_keys`); anything else refuses
  typed with the ``env_file:`` prefix.

Options:
  --host TEXT      Bind address (loopback by default — the gateway is local-
                   only).  [default: 127.0.0.1]
  --port INTEGER   Bind port.  [default: 8125]
  --data-dir PATH  At-rest data directory (holds state.sqlite + content/).
                   serve: this locates benchweave.env, whose allowlisted keys
                   are bridged into the environment set-if-not-set (explicit
                   process environment always wins; BENCHWEAVE_DB is derived
                   from the directory when unset).
  --help           Show this message and exit.

Options

--host: TEXT = 127.0.0.1
Bind address (loopback by default — the gateway is local-only). Environment variable: BENCHWEAVE_HOST.
--port: INTEGER = 8125
Bind port. Environment variable: BENCHWEAVE_PORT.
--data-dir: PATH
At-rest data directory (holds state.sqlite + content/). serve: this locates benchweave.env, whose allowlisted keys are bridged into the environment set-if-not-set (explicit process environment always wins; BENCHWEAVE_DB is derived from the directory when unset). Environment variable: BENCHWEAVE_DATA_DIR.