Skip to Content
ConceptsCargo Lifecycle

Cargo Lifecycle

Every request (cargo) goes through a series of status transitions.

Status Flow

Status Descriptions

StatusDescription
pendingWaiting to be assigned to a batch
batchedAssigned to a batch job, waiting for submission
processingBatch submitted to provider, awaiting results
completedProvider returned results
failedProvider returned an error
callback_pendingResult ready, callback delivery in progress
callback_deliveredCallback successfully delivered
callback_failedCallback delivery failed after all retries

Batching Logic

Requests are batched when either threshold is met:

ThresholdDefaultConfig Variable
Request count100BATCH_SIZE_THRESHOLD
Time elapsed1 hourBATCH_TIME_THRESHOLD_SECONDS

The worker checks for pending requests every 30 seconds (BATCH_CHECK_INTERVAL_SECONDS).

Timeline Example

T+0s Request submitted → pending T+30s Worker checks, not enough → pending T+60s 100 requests reached → batched T+61s Batch submitted to Bedrock → processing T+5min Bedrock completes → completed T+5min Callback delivery starts → callback_pending T+5min Webhook receives result → callback_delivered

Terminal States

These statuses indicate the request is complete:

  • callback_delivered - Success, result delivered
  • callback_failed - Result ready but delivery failed
  • failed - Provider processing failed
Last updated on