Docs
Quickstart
Local developer quickstart (≤5 minutes)
If you are integrating with a hosted GovAI backend, start here instead (canonical):
Goal: create an API key, send your first evidence event, run a compliance check, and interpret the result.
This guide uses the core v1 HTTP API (api/govai-http-v1.openapi.yaml) and the shipped govai CLI (python/aigov_py/cli.py).
CLI command catalog
Search commands — click copy to use in your terminal.
CI gates
Commands used in release and compliance pipelines.
govai checkGET /compliance-summary — exit 0 only on VALID.govai verify-evidence-packDigest + optional export cross-check against hosted ledger.govai submit-evidence-packReplay CI evidence JSON to POST /evidence.
Evidence packs
govai evidence-pack initStarter run JSON + digest manifest.govai preflightLocal validation before submit.
Read APIs via CLI
govai compliance-summaryPrint authoritative verdict JSON.govai export-runExport run artefacts for audit review.
Evidence lifecycle
How an evidence event moves from emission to an auditable ledger record.
Record evidence
Emit a lifecycle event to the audit ledger (read-only preview — no live call).
PreviewPOST /evidence
View expected output
Prereqs#
- Rust toolchain
- Python ≥ 3.10
- PostgreSQL reachable via
DATABASE_URL
0) Install the CLI (local editable)#
1) Create an API key (shared secret)#
GovAI audit API keys are configured on the audit service via GOVAI_API_KEYS (comma-separated). When set, audit routes require Authorization: Bearer <secret>.
Note (local/dev vs hosted):
This quickstart uses GOVAI_API_KEYS for simple local/dev setups. Hosted / staging / production deployments MUST define GOVAI_API_KEYS_JSON so each API key is mapped to a tenant id and ledger isolation is enforced correctly. Dev mode without API keys is not suitable for pilots: hosted pilots must run with real key → tenant mapping.
- Ledger tenant isolation is derived from the API key → tenant mapping (not from request headers).
X-GovAI-Projectis optional metadata (usage/billing label) and does not isolate ledger tenant.
Generate a local key:
2) Start the audit service with that key#
3) Send your first evidence event (HTTP)#
Pick a run_id (GOVAI_RUN_ID), then append one data_registered event.
Register evidence for a new run
- 1Set run_id
- 2Set event_id
- 3POST evidence
Expected output
4) Run a compliance check (HTTP + CLI)#
[!summary]
After one evidence event, compliance-summary should return BLOCKED until the full promotion sequence is recorded.
Read the authoritative decision
- 1HTTP compliance-summary
Query the immutable ledger verdict for your run_id using your API key.
Expected output
- 2CLI gate check
The CLI prints the verdict and exits non-zero when the run is not VALID.
Expected output
At this point (only 1 event), the expected verdict is BLOCKED.
- The server only returns
VALIDwhen evaluation passed, risk reviewed (approve), human approved (approve), and promotion executed for the run. - With only
data_registered, those prerequisites are missing, so the run is intentionally blocked.
Get a full end-to-end VALID run (CLI)#
The fastest path to a complete, policy-satisfying sequence is the built-in scripted demo flow.
Expected stdout:
Note: govai run demo generates its own run_id internally. It is a separate path from the API-only steps above (which use your $GOVAI_RUN_ID).
Optional: minimal VALID evidence sequence (API-only)#
If you want to reach VALID using only the HTTP API, append the remaining required evidence for the same $GOVAI_RUN_ID (in this order):
model_trainedevaluation_reported(with"passed": true)risk_recordedrisk_mitigatedrisk_reviewed(with"decision": "approve")human_approved(with"scope":"model_promoted"and"decision":"approve")model_promoted
Copy/paste (uses deterministic IDs derived from $GOVAI_RUN_ID):
Now the expected verdict is VALID:
Expected:
GET /compliance-summary:"verdict":"VALID"govai check: stdoutVALID, exit code0
5) Interpret the result#
GET /compliance-summary returns:
verdict: one ofVALID,INVALID,BLOCKEDcurrent_state: the projected state derived from the evidence logpolicy_versionand deploymentenvironmentmetadata
Minimal, machine-friendly check (exit code 0 only if VALID):
6) Export the run (machine-readable JSON)#
Use the dedicated export endpoint to fetch a stable JSON document that includes:
- decision extracts (evaluation / approval / promotion)
- hashes (canonical bundle SHA-256 + append-only chain hashes)
CLI:
HTTP: