---
title: "engine.batch: Run Commands (Batch) — Motion kit command — Kition"
description: "Runs several commands in one call and one undo step: `steps` [{command, params}]; a string \"$N\" or \"$N.key\" in params is step N's result (1-based), e.g. {\"layer\": \"$1.layer\"}. `atomic` (default true) rolls all back if a step fails."
canonical: "https://developer.kition.ai/docs/kits/motion/commands/engine.batch"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/motion/commands/engine.batch](https://developer.kition.ai/docs/kits/motion/commands/engine.batch)

# engine.batch

**Run Commands (Batch).** Runs several commands in one call and one undo step: `steps` [{command, params}]; a string "$N" or "$N.key" in params is step N's result (1-based), e.g. {"layer": "$1.layer"}. `atomic` (default true) rolls all back if a step fails.

- Kit: Motion 0.1.0 (.kmotion); reference: [Motion kit commands](https://developer.kition.ai/docs/kits/motion.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `atomic` | `boolean` | no | default true: a failing step rolls the whole batch back |
| `comp` | `integer \| string` | no | read by the command beside its listed parameters |
| `label` | `string` | no | undo step name, default Batch |
| `steps` | `object[]` | no | [{command, params?}] |

## Call through motion_run

```text
motion_run {
  "path": "<file>.kmotion",
  "steps": [{ "command": "engine.batch" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `atomic`, `comp`, `label`, `steps`. motion_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "atomic": {
      "description": "default true: a failing step rolls the whole batch back",
      "type": "boolean"
    },
    "comp": {
      "description": "read by the command beside its listed parameters",
      "oneOf": [
        {
          "description": "comp's item id as motion_inspect lists it",
          "type": "integer"
        },
        {
          "description": "the item id as receipts print it (\"1\"), or the comp's name",
          "type": "string"
        }
      ],
      "x-khp-name": "name",
      "x-khp-types": [
        "Item"
      ]
    },
    "label": {
      "description": "undo step name, default Batch",
      "type": "string"
    },
    "steps": {
      "description": "[{command, params?}]",
      "items": {
        "additionalProperties": true,
        "properties": {
          "command": {},
          "params": {}
        },
        "type": "object"
      },
      "type": "array"
    }
  },
  "returns": "{steps, results: [each step's result]}; a string param \"$N\" or \"$N.key.0\" is step N's result (1-based), e.g. {\"layer\": \"$1.layer\"}",
  "type": "object"
}
```

Generated from the command list of @kition/motion-darwin-arm64@0.1.0 and the kit itself (motion_commands through @kition/cli@0.1.1, built from KitionAI/kition-motion@4719aa7).
