run_job #

View this page as Markdown

On this page

Generated automatically from the published contract sources.

A script calls this action over HTTPS at POST https://tzcloud.turnzero.ai/v1/run_job, with a bearer credential and the action's payload as the JSON body. An MCP connection lists this action as the tool tzcloud_run_job.

OAuth access tokens and minted tokens, including the turnzero command's computer token, are bearer credentials. The action determines which kinds, scopes and grants it accepts (Sign-in, sessions, and tokens).

Build metadata: Registered in this build. Registration describes the default dispatcher in this build. It does not guarantee that a caller has the required credential or grant, that a tool is listed for that connection, or that the required service is configured.

Contract description #

Start a declared job. Use a job declared by the version serving the selected environment. When jobs are off on this estate, Turn Zero refuses new manifest submissions that declare jobs. Ask the account owner before starting a production run unless they already asked for it. The response includes the run ID and current state. Use its next call to read the run. If you retry the start, use the same application, job, environment, and request_id.

More about this action #

A job runs a script in its own container. A schedule calls a handler at set times. A new run may already be running, may be waiting to start, or may have failed to start. If a deploy or promote is still setting up the job for the serving version, the run can stay starting while Cloud tries to assign it again. Cloud marks a run still unassigned as failed with reason not_claimed when it checks at least 90 seconds after the request. When a retry returns an existing run, the response includes repeated: true.

If the environment has no serving version, deploy first. On a two-environment application, promote to serve a version on production. If the environment is halted, use halt_environment with resume: true before trying again. A paused or suspended account cannot start a run. If you get database_move_in_flight or cell_move_in_flight, wait for the move to finish, then retry with the same request_id.

For no_such_job, check the job name and the manifest of the version serving the selected environment. To add the job, submit the manifest with its job entry and deploy. On an app with two environments, promote that version before starting the job on production. jobs_not_available comes from submitting a manifest that declares jobs on an estate where they are off.

An account can have three unfinished runs at once. If the account is at its limit, wait for a run to end or cancel one. If the hosting cell is at capacity, wait a minute and retry with the same request_id.

Access and action metadata #

{
  "name": "run_job",
  "resource": "application",
  "tier": "reversible",
  "surface": "tzcloud",
  "addresses": [
    "tzcloud"
  ],
  "product": "cloud",
  "summary": "Start a job that the version serving the chosen environment declares. The response includes the run ID and its current state. Use the `read_job_runs` call in `next` to follow the run. To retry a start, send the same `request_id`. If the retry passes the start checks, it returns the original run.",
  "annotations": {
    "readOnlyHint": false,
    "destructiveHint": true,
    "openWorldHint": true
  }
}

MCP catalog entry #

{
  "name": "run_job",
  "title": "Run a job",
  "tier": "reversible",
  "scenario": "CHI-L0-09",
  "summary": "Start a declared job. Use a job declared by the version serving the selected environment. When jobs are off on this estate, Turn Zero refuses new manifest submissions that declare jobs. Ask the account owner before starting a production run unless they already asked for it. The response includes the run ID and current state. Use its `next` call to read the run. If you retry the start, use the same application, job, environment, and `request_id`.",
  "owners": [
    "JOB-L0-04",
    "JOB-L0-08",
    "MAPI-04"
  ]
}

request #

JSON pointer Description and constraints
"" (root) Type: object
Required fields: ["application","job"]
/properties/application The application ID from list_applications.

Type: string
/properties/job The name of a job declared by the version serving the chosen environment.

Type: string
/properties/environment Choose development or production. The default is production. If the application has no development environment, the request returns environment_not_created.

Type: string
/properties/request_id An ID for this start, 1 to 255 UTF-16 code units. Many emoji count as two. Reuse the same ID to retry this start in the same application and environment.

Type: string

response #

JSON pointer Description and constraints
"" (root) Type: object
Required fields: ["contract_version","run","detail","next"]
/properties/contract_version Required value: 1
/properties/reference The ten-character call reference. Include it if you report a problem.

Type: string
Pattern: ^[0-9a-f]{10}$
/properties/run $ref: #/shapes/job_run
/properties/repeated Present when this request_id returns an existing run.

Required value: true
/properties/detail A short explanation of the result.

Type: string
/properties/next The read_job_runs call to check this run.

Type: object
Required fields: ["action","arguments"]
Additional properties: false
/properties/next/properties/action Required value: read_job_runs
/properties/next/properties/arguments Type: object
Required fields: ["application","run"]
Additional properties: false
/properties/next/properties/arguments/properties/application Type: string
/properties/next/properties/arguments/properties/run Type: string

Complete payload contract #

{
  "request": {
    "type": "object",
    "required": [
      "application",
      "job"
    ],
    "properties": {
      "application": {
        "type": "string",
        "description": "The application ID from `list_applications`."
      },
      "job": {
        "type": "string",
        "description": "The name of a job declared by the version serving the chosen environment."
      },
      "environment": {
        "type": "string",
        "description": "Choose `development` or `production`. The default is `production`. If the application has no development environment, the request returns `environment_not_created`."
      },
      "request_id": {
        "type": "string",
        "description": "An ID for this start, 1 to 255 UTF-16 code units. Many emoji count as two. Reuse the same ID to retry this start in the same application and environment."
      }
    }
  },
  "response": {
    "type": "object",
    "required": [
      "contract_version",
      "run",
      "detail",
      "next"
    ],
    "properties": {
      "contract_version": {
        "const": 1
      },
      "reference": {
        "type": "string",
        "pattern": "^[0-9a-f]{10}$",
        "description": "The ten-character call reference. Include it if you report a problem."
      },
      "run": {
        "$ref": "#/shapes/job_run"
      },
      "repeated": {
        "const": true,
        "description": "Present when this `request_id` returns an existing run."
      },
      "detail": {
        "type": "string",
        "description": "A short explanation of the result."
      },
      "next": {
        "type": "object",
        "required": [
          "action",
          "arguments"
        ],
        "properties": {
          "action": {
            "const": "read_job_runs"
          },
          "arguments": {
            "type": "object",
            "required": [
              "application",
              "run"
            ],
            "properties": {
              "application": {
                "type": "string"
              },
              "run": {
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "additionalProperties": false,
        "description": "The `read_job_runs` call to check this run."
      }
    }
  }
}

Shared contracts #