Worker fail callback
POST /internal/computer-use/{session_id}/fail
Called by the Cloud Run container on failure. Internal only — no auth required, protected by VPC routing. Refunds 25 credits if they were deducted.
Authorizations
Parameters
Path Parameters
The computer-use session UUID
The computer-use session UUID
Request Body required
Request body for the worker fail callback.
Attributes: error: Error message from the container. tenant_id: Tenant UUID (passed by container for routing). steps_executed: Iterations completed before the failure. usage: Accumulated LLM token usage. A failed run still burned every token it burned before failing, so this is carried on the failure path too and is NOT refunded.
object
Accumulated Anthropic token usage reported by the container.
The worker cannot bill from inside its isolated Cloud Run container
(no Redis, no Postgres, no CreditManager — same isolation as the
D-13 deviation documented in src/workers/computer_use_worker.py),
so it counts tokens across every turn of the computer-use loop and
reports the totals here. ComputerUseExecutor._meter_llm_usage
runs the reserve/settle against the tenant’s real balance on receipt.
Every field defaults so a container image predating this contract still parses. A body with no tokens is NOT billed as zero silently: the executor logs the missing report at ERROR.
Attributes:
model: Model the container actually called (priced against this).
input_tokens: Summed usage.input_tokens across all turns.
output_tokens: Summed usage.output_tokens across all turns.
cache_creation_input_tokens: Summed cache-write tokens.
cache_read_input_tokens: Summed cache-read tokens.
turns: Number of provider round-trips.
object
Responses
200
Successful Response
object
422
Validation Error