Platform jobs API
The platform jobs API provides a durable, priority-based background job queue. You can enqueue provisioning and chat jobs that run asynchronously with automatic retries and status tracking.These endpoints are backend-internal and require a valid internal API key passed in the
Authorization header. Web clients should use the Jobs API proxy endpoints instead.Job model
Every job follows a common lifecycle:- A job is created with status
queued. - A worker claims the job and moves it to
running. - On success the job moves to
completedwith aresultpayload. - On failure the job is retried (up to
maxAttempts) or moves tofailed.
running state for more than ten minutes are automatically requeued.
Job types
| Type | Lane | Description |
|---|---|---|
provision_managed_runtime | deploy | Provisions a new managed agent runtime |
gateway_chat_completion | runtime_exec | Sends a chat completion request through a gateway |
runtime_sync | recovery | Synchronizes runtime state with the platform |
retry_repair | recovery | Retries a previously failed operation to repair state |
Job statuses
| Status | Description |
|---|---|
queued | Waiting to be picked up by a worker |
running | Currently being processed |
completed | Finished successfully |
failed | Exhausted all retry attempts |
Enqueue a provision job
202 Accepted status.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
userId | string | Yes | User identifier |
email | string | Yes | User email address |
agentId | string | Yes | Agent identifier to provision |
plan | string | No | Subscription plan. Defaults to solo. |
aiProvider | string | No | AI provider. Defaults to openrouter. |
agentType | string | No | Agent type. Defaults to creative. |
autoProvision | boolean | No | Whether to provision automatically. Defaults to false. |
stripeSubscriptionId | string | null | No | Stripe subscription identifier, if applicable. Defaults to null. |
Response (202)
Errors
| Code | Description |
|---|---|
| 400 | Missing or invalid userId, email, or agentId |
| 500 | Failed to enqueue the job |
Enqueue a chat job
202 Accepted status.
Request body
| Field | Type | Required | Description |
|---|---|---|---|
userId | string | Yes | User identifier |
agentId | string | Yes | Agent identifier |
gatewayUrl | string | Yes | Gateway URL to send the chat request to |
message | string | Yes | User message content |
systemPrompt | string | null | No | Optional system prompt prepended to the conversation. Defaults to null. |
Response (202)
Errors
| Code | Description |
|---|---|
| 400 | Missing or invalid userId, agentId, gatewayUrl, or message |
| 500 | Failed to enqueue the job |
Get a job
Path parameters
| Parameter | Type | Description |
|---|---|---|
jobId | string | Job identifier (prefixed with job_) |
Response
Job response fields
| Field | Type | Description |
|---|---|---|
job.id | string | Job identifier |
job.userId | string | null | User who owns this job |
job.agentId | string | null | Associated agent identifier |
job.lane | string | Processing lane: deploy for provisioning jobs, runtime_exec for chat completions, or recovery for sync and repair operations |
job.jobType | string | Job type (see job types) |
job.status | string | Current status (see job statuses) |
job.priority | number | Priority value. Higher values are processed first. |
job.attempts | number | Number of processing attempts so far |
job.maxAttempts | number | Maximum number of attempts before the job is marked as failed |
job.runAt | string | ISO 8601 timestamp of when the job is eligible to run |
job.lockedAt | string | null | ISO 8601 timestamp of when a worker locked this job |
job.startedAt | string | null | ISO 8601 timestamp of the first processing attempt |
job.completedAt | string | null | ISO 8601 timestamp of completion or final failure |
job.error | string | null | Error message from the most recent failed attempt |
job.result | object | null | Result payload when the job completes successfully |
job.payload | object | Sanitized input payload |
job.createdAt | string | ISO 8601 creation timestamp |
job.updatedAt | string | ISO 8601 last update timestamp |
Errors
| Code | Description |
|---|---|
| 404 | Job not found |
| 500 | Failed to fetch the job |
Get job metrics
Response
| Field | Type | Description |
|---|---|---|
counts | array | Job counts grouped by lane and status |
counts[].lane | string | Processing lane |
counts[].status | string | Job status |
counts[].count | number | Number of jobs in this lane and status |
oldestQueuedAgeSeconds | number | Age in seconds of the oldest queued job. Returns 0 when the queue is empty. |
Errors
| Code | Description |
|---|---|
| 500 | Failed to fetch metrics |
Retry behavior
Failed jobs are automatically retried with exponential backoff:| Attempt | Delay |
|---|---|
| 1 | 30 seconds |
| 2 | 60 seconds |
| 3 | 90 seconds |
| 4 | 120 seconds |
| 5+ | 300 seconds (capped) |
failed.