HTTP service
Run plans over HTTP
dive serve runs Dive as an HTTP service: your app starts plan runs, watches their entries and cancels them.
dive serve serves the plans in a project's .dive/ over HTTP. Your app's backend starts a plan run with one request and gets the run's id back at once. The run keeps going after the request ends. Any client with a token for the run's tenant can then read the run, watch its entries as they're written, or cancel it.
Every request carries a run token: a JWT your app signs with its private key. Dive holds only the public key. See Run tokens.
Try it locally
Start the server with a development key
In a project with plans in .dive/plans/:
DIVE_SERVE_DOCS=1 dive serve --dev-key --listen 127.0.0.1:8080--dev-key creates an Ed25519 key in the data directory the first time, as serve/dev-key.pem, and trusts it. Without [identity] in the project config, runs are recorded with deployment serve and environment development. DIVE_SERVE_DOCS turns on the API reference at http://127.0.0.1:8080/docs.
Get tokens
In another terminal, in the same project:
START=$(dive serve token --plan triage --tenant acme --sub ada@example.com)
READ=$(dive serve token --tenant acme --sub ada@example.com)The first token starts one run of triage. The second reads and cancels the tenant's runs. Each lasts an hour.
Start a run
curl -s http://127.0.0.1:8080/v1/plans/triage/runs \
-H "Authorization: Bearer $START" \
-H "Content-Type: application/json" \
-d '{"input": {"issue": "ENG-142"}}'{ "run_id": "0b6f…", "session_id": "a91e04c2b7d1", "status": "running", "entries_url": "/v1/runs/0b6f…/entries" }Watch it
curl -N http://127.0.0.1:8080/v1/runs/0b6f…/entries -H "Authorization: Bearer $READ"Entries arrive as server-sent events until the run ends. Then read the result:
curl -s http://127.0.0.1:8080/v1/runs/0b6f… -H "Authorization: Bearer $READ"How it runs
- Serve mode.
dive servereads only the project's.dive/config.tomland the plans and tools inside the project. It ignores~/.config/dive, records no tool shapes, refuses drafting saves, and starts exec tools from an empty environment. See[serve]. - Sessions and runs. Each start creates a new plan session holding one run, stamped with the token's
tenantandsub. The run's id is the token'sjti. - Plans you can start. Plans from the project's plan directories and from installed packs, except a pack's private plans. Built-in plans aren't served.
- Asks. Nobody can answer an
askstep yet, so each one follows itswhenUnanswered. - Limits.
[serve].max_runscaps the runs one process runs at once, andmax_runs_per_tenantcaps one tenant's. A start over either limit gets429 at_capacity. Atmax_runs,/readyzreturns 503 so a load balancer sends starts elsewhere. - Stopping. On SIGTERM or Ctrl-C, the server stops taking new connections,
/readyzreturns 503, and every running plan run stops before its next tool call and endsinterrupted. Open streams close after therun_endedentry reaches them. A run still inside a tool call 2 seconds before[serve].shutdown_grace_secsruns out is endedinterruptedwithout waiting for the tool, and the process exits. - After a crash. A run whose process stopped keeps its lease for 30 seconds.
dive servechecks for expired leases when it starts and every 10 seconds while it runs, and ends those runsinterrupted.
One dive serve process per data directory for now. Running several replicas against one store comes with a Postgres store.
Configure a deployment
version = 7
[identity]
deployment = "app"
environment = "production"
[serve]
listen = "0.0.0.0:8080"
issuer = "https://app.example.com"
audience = "dive"
public_keys = ["/etc/dive/keys/app-2026-11.pem"]
max_runs = 32
max_runs_per_tenant = 8Serve mode needs [identity].deployment and [identity].environment. Without --dev-key, dive serve refuses to start when [serve], issuer, audience or public_keys is missing. Relative key paths are read from the project directory.