Documentation Index
Fetch the complete documentation index at: https://docs.retab.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
When a workflow reaches a gated block — a block withconfig.hil whose predicate flagged its output for review — the run pauses and a review overlay is created.
The overlay is a versioned sidecar attached to one (run_id, block_id) pair. It is the single object you read and mutate to walk a review from “the model produced this” to “a human approved (or corrected, or rejected) it, and the run resumed.” Everything is driven through client.workflows.runs.reviews.*.
The overlay replaces the legacy v1 HIL decision endpoints (
/v1/workflows/runs/{run_id}/hil-decisions and the agent-review endpoint). Those have been removed — the review overlay is the only HIL surface.The overlay shape
AReviewOverlay carries four logs plus a compare-and-swap token:
| Field | What it holds |
|---|---|
versions[] | Every version of the gated block’s output. Sequence 0 is always the model’s original. Each later sequence is a corrective edit. |
decisions[] | Every verdict submitted against the overlay. |
audit[] | The append-only audit trail — every claim, release, edit, and decision. |
claim | The ReviewClaim currently held on the overlay ({holder, claimed_at, expires_at}), or null. |
rev | The overlay’s compare-and-swap token. See the CAS contract. |
Actor shape:
versions[].author, decisions[].decided_by, audit[].actor, and claim.holder are all the same type — you never special-case “was this a person or a model.”
The version_stamp contract
The overlay is mutated concurrently — a human in the dashboard, an agent reviewer, and your own integration can all touch the same overlay. To keep those writers from clobbering each other, every mutating call is a compare-and-swap.
- Read the overlay with
reviews.get(...). It carries arev— the overlay’s compare-and-swap token. - Pass that
revback (as theversion_stamprequest parameter) on the next mutating call —edit,approve,reject,claim,release. - If the overlay advanced since you read it, the stamp is stale and the call fails with HTTP 409. Re-read the overlay and retry with the fresh stamp.
retab.exceptions.ConflictError; in JavaScript it surfaces as an APIError with .status === 409.
The review loop
1. Find the work
List the queue to find overlays awaiting a decision. Filter byworkflow_id, status, or mine (overlays you hold the claim on).
2. Claim it (optional, advisory)
Claiming records you inclaim so a shared inbox shows the item is being worked. It does not lock the overlay — the version_stamp CAS is the real concurrency guarantee. Submitting a decision does not require holding the claim.
3. Inspect the output
The effective output is the latest version. The model’s original is always sequence0.
4. Decide
There are two verdicts:| Verdict | Effect on the run |
|---|---|
approved | The effective output flows downstream and the run resumes. |
rejected | The run is cancelled. A reason is required. |
Approve with edits
When the model’s output is close but wrong, you don’t reject — you correct and approve. Passedited_output to approve and the server appends a corrective version and then approves it in one atomic step. The model’s original is preserved as version 0; your corrected payload becomes the new effective version.
edit:
overlay.versions.
command_id idempotency
Every mutating method accepts an optional command_id. A retried call carrying the same command_id is deduplicated server-side — safe to use when a network blip leaves you unsure whether your decision landed.
Waiting for a decision
If your integration submits a gated run and needs to block until a human (or agent) resolves it, usewait_for. It polls the overlay until it leaves the awaiting_review state and returns the settled overlay.
API reference
| Endpoint | Method |
|---|---|
| List Reviews | reviews.list(...) |
| Get Review | reviews.get(run_id, block_id) |
| Append Version | reviews.edit(...) |
| Submit Decision | reviews.approve / reject(...) |
| Claim Review | reviews.claim(...) |
| Release Review | reviews.release(...) |