> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/workflows/blocks/blocks/data-storage/vision-event-bundle.md).

# Write Vision Event Bundle

Write vision events as self-contained tarball bundles to a local directory.

Serialize vision events as self-contained tarball bundles on the local filesystem instead of sending them to the Roboflow Vision Events API. Designed for air-gapped and OT-network deployments where the inference server has no route to the cloud: a customer file-mover service transports the bundles out of the network, and an uploader later POSTs each bundle to Roboflow's `POST /vision-events/bundle` endpoint without unpacking it.

## Bundle Format (version 1)

One tarball per event, written to `target_directory`:

```
event_<UTC timestamp>_<eventId>.tar.gz    # or your own `file_name`
├── payload.json               # the event payload (versioned contract, camelCase)
└── images/<file_id>.jpg       # image members, file_id is a uuid4
```

`payload.json` has the same shape as the `POST /vision-events` request body, with these differences:

* `bundleFormatVersion` identifies the bundle contract version (currently `1`)
* `images[].file` / `images[].inputFile` reference tar member paths instead of `sourceId` / `inputSourceId` (the cloud resolves them to source ids at ingest time)
* `useCaseId` is only present when the optional **Use Case** field is set on this block; air-gapped deployments typically leave it unset so no cloud identifiers are stored in the OT network, and the uploader supplies it via the `useCaseId` query parameter instead

Media members live under type-named directories (`images/` today); future media types will use sibling directories, so consumers should ignore unknown top-level directories.

## Atomic Writes

Bundles are written to a dot-prefixed temporary file in the target directory, fsynced, and atomically renamed to their final `*.tar.gz` name (the directory is fsynced after the rename). A file-mover service that matches `*.tar.gz` (or skips dotfiles) can never pick up a partially written bundle.

## Output Routing

By default the file name is `event_<UTC timestamp>_<eventId>.tar.gz`. Set **File Name** to replace it outright - typically wired from another step that composes the name - so no part of Roboflow's naming is imposed on the output. `.tar.gz` is appended when absent.

Because `target_directory` is per-block too, several bundle blocks in one workflow can own their output completely: a person-detection block writing `person_*.tar.gz` into `/media/person` alongside an episode block writing the default `event_*.tar.gz` into `/media/event`, letting a downstream file mover route purely by folder and name. The upload endpoint ignores the file name entirely, so it is free to carry deployment-specific meaning.

The generated name embeds a uuid4 and is unique by construction. A custom name is not: if the target file already exists the block raises rather than overwriting it, so a name that repeats across events will fail the workflow run. Compose something unique per event.

## Rate Limiting

Video workflows can run many times per second, which by default would write a bundle for every frame. The block enforces a cooldown between consecutive events: at most one event per second is written by default. Events triggered during the cooldown period are dropped and the `throttling_status` output is set to `True`. Adjust `cooldown_seconds` to your needs, or set it to `0` to disable rate limiting entirely.

## Requirements

**Local Filesystem Access**: This block requires write access to the local filesystem and is intended for self-hosted `inference`. Filesystem access can be controlled via environment variables:

* Set `ALLOW_WORKFLOW_BLOCKS_ACCESSING_LOCAL_STORAGE=False` to disable the block (it will raise an error)
* Set `WORKFLOW_BLOCKS_WRITE_DIRECTORY` to an absolute path to restrict writes to a specific directory and its subdirectories only

No Roboflow API key is required: the block never talks to the network.

## Event Types

* **quality\_check**: Manufacturing/inspection QA with pass/fail result and optional confidence
* **inventory\_count**: Inventory tracking with location, item count, and item type
* **safety\_alert**: Safety violations with alert type, severity (low/medium/high), and description
* **custom**: User-defined events with a free-form value string
* **operator\_feedback**: Operator review/correction of previous events (correct/incorrect/inconclusive)

### Type identifier

Use the following identifier in step `"type"` field: `roboflow_core/vision_event_bundle@v1` to add the block as a step in your workflow.

### Properties

| **Name**            | **Type**                                  | **Description**                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Refs |
| ------------------- | ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---- |
| `name`              | `str`                                     | Enter a unique identifier for this step..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | ❌    |
| `target_directory`  | `str`                                     | Directory path where event bundles will be written. Created automatically if it does not exist. If WORKFLOW\_BLOCKS\_WRITE\_DIRECTORY is set, this path must be a subdirectory of the allowed directory..                                                                                                                                                                                                                                                                                                                                             | ✅    |
| `file_name`         | `str`                                     | Optional file name for the bundle, replacing the generated `event_<UTC timestamp>_<eventId>.tar.gz` name entirely. Usually wired from another step that composes the name, so nothing of Roboflow's naming is imposed. `.tar.gz` is appended when absent. May contain letters, digits, `.`, `_` and `-`, must start with a letter or digit, and must be at most 200 characters. The block errors if the resulting file already exists, so a custom name must be unique per event. Leave unset for the default name, which is unique by construction.. | ✅    |
| `event_type`        | `str`                                     | The type of vision event to create..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | ✅    |
| `solution`          | `str`                                     | Optional use case to bake into the bundle as `useCaseId`. Leave unset in air-gapped deployments so no cloud identifiers are stored in the bundle - the uploader supplies the use case at upload time instead. A `useCaseId` query parameter passed to the ingest endpoint always overrides the bundled value..                                                                                                                                                                                                                                        | ✅    |
| `external_id`       | `str`                                     | External identifier for correlation with other systems (max 1000 chars)..                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | ✅    |
| `qc_result`         | `str`                                     | Quality check result: pass or fail..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | ✅    |
| `location`          | `str`                                     | Location identifier for inventory count..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | ✅    |
| `item_count`        | `int`                                     | Number of items counted..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | ✅    |
| `item_type`         | `str`                                     | Type of item being counted..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | ✅    |
| `alert_type`        | `str`                                     | Alert type identifier (e.g. no\_hardhat, spill\_detected)..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | ✅    |
| `severity`          | `str`                                     | Severity level for the safety alert..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 | ✅    |
| `alert_description` | `str`                                     | Description of the safety alert..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | ✅    |
| `custom_value`      | `str`                                     | Arbitrary value for custom events..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   | ✅    |
| `related_event_id`  | `str`                                     | The event ID of the event being reviewed..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | ✅    |
| `feedback`          | `str`                                     | Operator feedback on the related event..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              | ✅    |
| `custom_metadata`   | `Dict[str, Union[bool, float, int, str]]` | Flat key-value metadata to attach to the event. Keys must match pattern \[a-zA-Z0-9\_ -]+ (max 100 chars). String values max 1000 chars..                                                                                                                                                                                                                                                                                                                                                                                                             | ✅    |
| `fire_and_forget`   | `bool`                                    | If True, the bundle is written asynchronously and the workflow continues without waiting. If False, the block waits for the write to finish..                                                                                                                                                                                                                                                                                                                                                                                                         | ✅    |
| `disable_sink`      | `bool`                                    | If True, the block is disabled and no bundles are written..                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           | ✅    |
| `cooldown_seconds`  | `Union[float, int]`                       | Minimum number of seconds between consecutive event bundles written by this block. Events triggered during the cooldown period are dropped and the `throttling_status` output is set to True. Defaults to 1 second so high-frequency video workflows do not write a bundle per frame. Set to 0 to disable rate limiting for intentionally bursty use cases..                                                                                                                                                                                          | ✅    |

The **Refs** column marks possibility to parametrise the property with dynamic values available in `workflow` runtime. See *Bindings* for more info.

### Runtime compatibility

`soft` - runtime `hosted_serverless`, `dedicated_deployment`; execution `remote` : Cooldown / rate-limit timer is stored in process memory. With remote step execution on stateless or multi-replica HTTP runtimes each request gets a fresh worker, so cooldown does not throttle. Cooldown only behaves as documented with local step execution inside an InferencePipeline.

`soft` - runtime `dedicated_deployment` : Bundles are persisted on the deployment's volume but are not retrievable through the Roboflow API; this block is intended for self-hosted deployments with a file-mover process.

`soft` - runtime `hosted_serverless` : Container disk is ephemeral, so bundles are lost when the worker scales down; if there's more than one replica consuming workflow requests the result will be non deterministic.

### Input and Output Bindings

The available connections depend on its binding kinds. Check what binding kinds `Write Vision Event Bundle` in version `v1` has.

<details>

<summary>Input and output bindings</summary>

* input
  * `target_directory` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Directory path where event bundles will be written. Created automatically if it does not exist. If WORKFLOW\_BLOCKS\_WRITE\_DIRECTORY is set, this path must be a subdirectory of the allowed directory..
  * `file_name` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Optional file name for the bundle, replacing the generated `event_<UTC timestamp>_<eventId>.tar.gz` name entirely. Usually wired from another step that composes the name, so nothing of Roboflow's naming is imposed. `.tar.gz` is appended when absent. May contain letters, digits, `.`, `_` and `-`, must start with a letter or digit, and must be at most 200 characters. The block errors if the resulting file already exists, so a custom name must be unique per event. Leave unset for the default name, which is unique by construction..
  * `input_image` ([*`image`*](/workflows/developer-guide/developer-guide/kinds/image.md)): The original input image. Stored in the bundle and used as the base image for detection annotations..
  * `output_image` ([*`image`*](/workflows/developer-guide/developer-guide/kinds/image.md)): An optional output/visualized image (e.g., from a visualization block). Displayed as the primary image once the event is ingested..
  * `predictions` (*Union\[*[*`classification_prediction`*](/workflows/developer-guide/developer-guide/kinds/classification-prediction.md)*,* [*`instance_segmentation_prediction`*](/workflows/developer-guide/developer-guide/kinds/instance-segmentation-prediction.md)*,* [*`keypoint_detection_prediction`*](/workflows/developer-guide/developer-guide/kinds/keypoint-detection-prediction.md)*,* [*`object_detection_prediction`*](/workflows/developer-guide/developer-guide/kinds/object-detection-prediction.md)*]*): Optional model predictions to include as detection annotations on the input image. Supports object detection, instance segmentation, keypoint detection, and classification predictions..
  * `event_type` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): The type of vision event to create..
  * `solution` (*Union\[*[*`roboflow_solution`*](/workflows/developer-guide/developer-guide/kinds/roboflow-solution.md)*,* [*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)*]*): Optional use case to bake into the bundle as `useCaseId`. Leave unset in air-gapped deployments so no cloud identifiers are stored in the bundle - the uploader supplies the use case at upload time instead. A `useCaseId` query parameter passed to the ingest endpoint always overrides the bundled value..
  * `external_id` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): External identifier for correlation with other systems (max 1000 chars)..
  * `qc_result` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Quality check result: pass or fail..
  * `location` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Location identifier for inventory count..
  * `item_count` ([*`integer`*](/workflows/developer-guide/developer-guide/kinds/integer.md)): Number of items counted..
  * `item_type` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Type of item being counted..
  * `alert_type` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Alert type identifier (e.g. no\_hardhat, spill\_detected)..
  * `severity` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Severity level for the safety alert..
  * `alert_description` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Description of the safety alert..
  * `custom_value` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Arbitrary value for custom events..
  * `related_event_id` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): The event ID of the event being reviewed..
  * `feedback` ([*`string`*](/workflows/developer-guide/developer-guide/kinds/string.md)): Operator feedback on the related event..
  * `custom_metadata` ([*`*`*](/workflows/developer-guide/developer-guide/kinds/wildcard.md)): Flat key-value metadata to attach to the event. Keys must match pattern \[a-zA-Z0-9\_ -]+ (max 100 chars). String values max 1000 chars..
  * `fire_and_forget` ([*`boolean`*](/workflows/developer-guide/developer-guide/kinds/boolean.md)): If True, the bundle is written asynchronously and the workflow continues without waiting. If False, the block waits for the write to finish..
  * `disable_sink` ([*`boolean`*](/workflows/developer-guide/developer-guide/kinds/boolean.md)): If True, the block is disabled and no bundles are written..
  * `cooldown_seconds` (*Union\[*[*`float`*](/workflows/developer-guide/developer-guide/kinds/float.md)*,* [*`integer`*](/workflows/developer-guide/developer-guide/kinds/integer.md)*]*): Minimum number of seconds between consecutive event bundles written by this block. Events triggered during the cooldown period are dropped and the `throttling_status` output is set to True. Defaults to 1 second so high-frequency video workflows do not write a bundle per frame. Set to 0 to disable rate limiting for intentionally bursty use cases..
* output
  * `error_status` ([`boolean`](/workflows/developer-guide/developer-guide/kinds/boolean.md)): Boolean flag.
  * `throttling_status` ([`boolean`](/workflows/developer-guide/developer-guide/kinds/boolean.md)): Boolean flag.
  * `event_id` ([`string`](/workflows/developer-guide/developer-guide/kinds/string.md)): String value.
  * `bundle_path` ([`string`](/workflows/developer-guide/developer-guide/kinds/string.md)): String value.
  * `message` ([`string`](/workflows/developer-guide/developer-guide/kinds/string.md)): String value.

</details>

<details>

<summary>Example JSON definition</summary>

```json
{
	    "name": "<your_step_name_here>",
	    "type": "roboflow_core/vision_event_bundle@v1",
	    "target_directory": "/data/vision-event-bundles",
	    "file_name": "$steps.compose_name.output",
	    "input_image": "$inputs.image",
	    "output_image": "$steps.visualization.image",
	    "predictions": "$steps.object_detection_model.predictions",
	    "event_type": "quality_check",
	    "solution": "my-use-case",
	    "external_id": "batch-2025-001",
	    "qc_result": "pass",
	    "location": "warehouse-A",
	    "item_count": 42,
	    "item_type": "widget",
	    "alert_type": "no_hardhat",
	    "severity": "high",
	    "alert_description": "Worker detected without hardhat in zone B",
	    "custom_value": "anomaly detected at 14:32",
	    "related_event_id": "evt_abc123",
	    "feedback": "correct",
	    "custom_metadata": {
	        "camera_id": "cam_01",
	        "location": "$inputs.location"
	    },
	    "fire_and_forget": true,
	    "disable_sink": false,
	    "cooldown_seconds": 1
	}
```

</details>
