> ## Documentation Index
> Fetch the complete documentation index at: https://piyushvyas.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# bap run

> Optimized workflow execution with compilation into fused batches and action cache warming.

# bap run

The fastest way to execute recorded workflows. Compiles workflow steps into fused batches for fewer server calls, and leverages the action cache for repeat runs.

## Usage

<CodeGroup>
  ```bash Execute a workflow theme={null}
  bap run qa-checkout
  ```

  ```bash With parameters theme={null}
  bap run qa-checkout --param email=user@test.com --param search=speakers
  ```

  ```bash Preview execution plan theme={null}
  bap run qa-checkout --dry-run
  ```

  ```bash Force cache warming theme={null}
  bap run qa-checkout --warm
  ```
</CodeGroup>

<ParamField path="name" type="string" required>
  Name of the saved workflow to execute.
</ParamField>

<ParamField path="--param" type="string" repeatable>
  Parameter substitution in `key=value` format. Can be specified multiple times.
</ParamField>

<ParamField path="--dry-run" type="flag">
  Show the compiled execution plan without running it. Displays batch structure, fusion flags, and
  step reduction percentage.
</ParamField>

<ParamField path="--warm" type="flag">
  Force cache warming before execution. Pre-resolves selectors into the action cache.
</ParamField>

## Compilation

`bap run` compiles sequential workflow steps into optimized batches:

* Adjacent interaction steps are merged into single `act` calls
* Navigation steps get fused `observe` parameters
* Fusion flags (`preObserve`, `postObserve`, `responseTier`) are applied automatically

### Dry Run Output

```bash theme={null}
bap run qa-checkout --dry-run
```

```
Execution Plan: qa-checkout
Steps: 6 -> 3 batches (50% reduction)

  Batch 1 navigate (1 steps) [postObserve, tier:interactive]
    -> goto https://shop.example.com
  Batch 2 act (3 steps) [postObserve]
    -> fill label:"Search"="headphones"
    -> press Enter
    -> click role:link:"Sony WH-1000XM5"
  Batch 3 act (2 steps)
    -> click role:button:"Add to Cart"
    -> click role:button:"Checkout"
```

## Cache Warming

The action cache stores resolved CSS selectors from previous runs (24h TTL). On repeat executions, cached selectors skip the full resolution chain.

```
Running: qa-checkout
Compiled: 6 steps -> 3 batches (50% fewer calls)
Cache: 4/6 warm (67%)
```

Cache manifests are saved after each run with batch timings and selector mappings for analysis.

## Output

```
Running: qa-checkout
Compiled: 6 steps -> 3 batches (50% fewer calls)
Cache: 4/6 warm (67%)

  PASS Step 1: goto https://shop.example.com  120ms
  PASS Step 2: fill label:"Search"="headphones"  45ms
  PASS Step 3: press Enter  30ms
  PASS Step 4: click role:link:"Sony WH-1000XM5"  230ms
  PASS Step 5: click role:button:"Add to Cart"  95ms
  PASS Step 6: click role:button:"Checkout"  110ms

PASS -- 6 passed, 0 failed (630ms)
```

<Tip>
  Use `--format=json` for machine-readable output. The JSON includes step-level timing, cache hit
  rates, and batch structure.
</Tip>

## bap run vs bap workflow run

| Feature       | `bap workflow run`      | `bap run`                   |
| ------------- | ----------------------- | --------------------------- |
| Execution     | Sequential, as recorded | Compiled into fused batches |
| Server calls  | One per step            | One per batch               |
| Cache warming | No                      | Yes                         |
| Dry run       | No                      | Yes (`--dry-run`)           |
| Use case      | Debugging, step-by-step | Production, speed           |
