Skip to content
v0.8.4stable

Run Governance API

Every endpoint uses the Gateway listener and Authorization: Bearer gw_.... POST requests require Content-Type: application/json, a body no larger than 16 KiB, and Idempotency-Key.

Scopes and endpoints
ScopeMethods and paths
work_unit:createPOST /halro/v1/work-units, POST /halro/v1/work-units/{id}/close
run:createPOST /halro/v1/runs, POST /halro/v1/runs/{id}/close
run:attachAccept X-Halro-Run-ID on model calls; also requires inference
governance:readGET /halro/v1/work-units/{id}, GET /halro/v1/runs/{id}
outcome:writePOST /halro/v1/work-units/{id}/outcomes

Every resource is scoped to the Gateway Key’s Project. Cross-Project reads and attachments do not reveal resource existence.

POST /halro/v1/work-units
{"outcome_definition_ids":["odef_xxx"]}

outcome_definition_ids is optional, accepts at most eight IDs, and every ID must belong to the same Project and currently be enabled. Creation freezes the Definition ID and version. The first success returns 201; replaying the same Idempotency-Key and body returns 200 with the same resource.

GET /halro/v1/work-units/{id}
POST /halro/v1/work-units/{id}/close

GET returns work_unit, its runs, and its outcomes. The close body must be {}. No new Run can be created after closing; repeating close is an idempotent replay.

POST /halro/v1/runs
{
"work_unit_id": "wku_xxx",
"budget_micros_usd": 500000,
"ttl_seconds": 3600
}

An omitted or zero budget/TTL uses the Project default; an explicit value cannot exceed the Project ceiling. One Work Unit accepts at most 32 Runs. budget_state is available, fully_reserved, or depleted; remaining_micros_usd already subtracts committed, reserved, and in-process pending cost.

GET /halro/v1/runs/{id}
POST /halro/v1/runs/{id}/close

Close can send {"reason":"completed"}; omission defaults to completed, and the value must be 1–64 characters. Expiry is derived from the read clock. A closed or expired Run rejects new attached calls.

POST /halro/v1/work-units/{id}/outcomes
Report an Outcome
FieldRequiredConstraint
definition_idYesMust be a Definition frozen when the Work Unit was created
valueYesMust be within the BOOLEAN/CATEGORICAL allowed values
observed_atYesRFC 3339 business observation time
evidence_refNoOpaque reference up to 128 characters; URLs, control characters, and credential-shaped values are rejected
evidence_sha256No64-character lowercase hexadecimal SHA-256
supersedes_outcome_idFor a revisionMust identify the current Outcome for this Work Unit/Definition

The first report returns 201; an idempotent replay returns 200. A revision creates a new out_... and retains the old record. Each head accepts at most 20 revisions, and the write window remains open for 30 days after Work Unit close.

Main errors
HTTPcodeCaller action
400invalid_request / invalid_outcomeRepair fields, value domain, or Content-Type; do not retry unchanged
400invalid_idempotency_keySupply a legal stable Key for this logical operation
403gateway_key_scope_deniedUse an authorized Key; do not retry blindly
403run_budget_exceededStop this Run, or change policy and create a new compliant Run
404work_unit_not_found / run_not_foundVerify Project and resource ID
409idempotency_conflictSame Key was used for a different request; investigate before creating a new operation
409run_not_active / work_unit_closedStop writing to or attaching requests to a terminal resource
409outcome_revision_conflictRead the current Outcome and resubmit using its ID
409outcome_write_closedRevision count or post-close write window was exceeded
429governance_rate_limited / governance_resource_limitHonor Retry-After or reduce resource creation rate
503run_governance_unavailable / governance_unavailableAuthority cannot be verified; do not interpret failure as empty data or success

See Integrate Run Governance for the complete business flow.