Skip to content

Worker complete callback

POST
/internal/computer-use/{session_id}/complete

Called by the Cloud Run container on successful completion. Internal only — no auth required, protected by VPC routing.

Authorizations

Parameters

Path Parameters

session_id
required

The computer-use session UUID

string format: uuid

The computer-use session UUID

Request Body required

Request body for the worker complete callback.

Attributes: steps_executed: Number of screenshot-action iterations completed. tenant_id: Tenant UUID (passed by container for routing). usage: Accumulated LLM token usage, or None from a container image that predates usage reporting.

object
steps_executed
required
integer
tenant_id
required
string
usage
Any of:

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
cache_creation_input_tokens
integer
cache_read_input_tokens
integer
input_tokens
integer
model
string
""
output_tokens
integer
turns
integer

Responses

200

Successful Response

object
key
additional properties
string

422

Validation Error

object
detail
Array<object>
object
ctx
object
input
loc
required
Array
msg
required
string
type
required
string