Complete a harness stage
POST https://weights.fyi/run/v1/compute/plans/{plan_id}/stages/{stage_id}/complete
Authorization: Bearer <token> scope: submit
Content-Type: application/json- Available since
- 2026-10-28: included in this build; see What is live for deployment status.
- Answer time
- synchronous result commit, cost roll-up and dependency update.
Records successful completion of your active awow_harness_lease stage. This account-authenticated route accepts harness results; service-managed stages require their worker's separate completion authority and cannot be completed by adding lease fields to this body. The tenant grant must still be valid.
The JSON body is the result itself. The first success stores it, revokes the stage's scoped token, emits stage_completed and makes satisfied dependencies eligible for scheduling. Once all stages finish successfully, the plan becomes completed and emits plan_completed. An identical result can be retried; a different result after completion conflicts.
Request
| Name | Where | Required | Meaning |
|---|---|---|---|
Authorization | header | yes | Bearer token with submit; use the account token, not the stage's scoped chat token. |
plan_id, stage_id | path | yes | Your plan and its stage identifiers. |
| Result object | body | yes | JSON object of at most 1 MiB; {} is valid for a harness result. Do not wrap it in result. |
output_uri, output_checkpoint_uri | body | no | Non-null values must name this tenant's output, using r2://tenants/<tenant_id>/<path> or s3://<bucket>/tenants/<tenant_id>/<path>. |
total_cost_usd_micros | body | no | Nonnegative integer, maximum 9,223,372,036,854,775,807. Null, fractions and booleans are invalid. |
| Additional result fields | body | no | Retained in the durable result and compared on replay; not echoed in the plan receipt. |
Return value
200 OK with the current plan receipt. The completed stage reports state: "completed"; other stages can remain pending or active.
For a harness stage, accrued cost includes charges already attached to its scoped token, never less than the existing accrued amount or reported total. Completion rolls those charges up without debiting them again. Replaying an identical result does not complete or charge the stage twice.
Errors
| Status | Code | Meaning |
|---|---|---|
400 | invalid_json, invalid_compute_plan | Invalid result object, output path or cost. |
401 | unauthorized, invalid_token, token_revoked, token_expired | Supply a valid account token. |
403 | scope_required, account_suspended, compute_tenancy_unauthorized | Missing scope, active account or tenant grant. |
403 | — | A service-managed stage requires worker completion authority. |
404 | compute_plan_not_found, compute_stage_not_found | Plan or stage is absent or inaccessible to this account. |
409 | compute_plan_conflict | Stage is not executing, stream work remains unsettled, or the result differs from its completed result. |
413 | body_too_large | Body exceeds 1 MiB. |
429 | rate_limited | Wait for Retry-After before retrying. |
Examples
After the harness finishes successfully:
curl -s https://weights.fyi/run/v1/compute/plans/PLAN_ID/stages/STAGE_ID/complete \
-H "Authorization: Bearer $WEIGHTS_API_KEY" -H "Content-Type: application/json" \
-d '{}'Selected response fields:
{"plan_id":"example-plan","state":"completed","stages":[{"stage_id":"sessions","state":"completed","accrued_cost_usd_micros":1200}],"total_accrued_cost_usd_micros":1200,"last_event_seq":42}History
- 2026-10-28: documented harness completion and identical-result replay.