> 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/deployment/self-hosted/enterprise/offline-mode.md).

# Offline Mode

Prepare cached models and Workflows, verify TensorRT readiness, and test offline restarts and recovery.

Offline Mode lets Roboflow Inference run models and Workflows from a local cache without contacting Roboflow. Prepare the cache while connected, then test a restart without internet access before deploying to an air-gapped site.

{% hint style="info" %}
Offline Mode is available to Roboflow Enterprise customers using Inference Docker containers.
{% endhint %}

Check that every Workflow step can run offline, including models and output destinations. Test with local images, video files, or cameras on your local network. Deployment Manager still needs connectivity for remote management and monitoring; its Offline Mode setting applies to the inference service.

## Web App

Prepare your device in [Deployment Manager](/deployment/self-hosted/enterprise/deployment-manager.md) while it is online. Follow [Prepare a Device for Offline Operation](/deployment/self-hosted/enterprise/deployment-manager/setting-up/prepare-a-device-for-offline-operation.md) to complete container downloads and set up networking and cameras. Leave "Offline Mode" off while you prepare the cache.

### Pin Workflows and models

1. Open the device's "Streams" tab and scroll to "Workflows".
2. Click "Add Workflow", select the Workflow, and click "Save". The device downloads its latest published version and the models it can identify. A pin keeps the Workflow cached even when no stream uses it.
3. In "Pinned Models" below "Workflows", click "Add Model", enter the "Model ID" (ex: `parts/2`), and click "Save". Repeat for each model you need, including models called directly without a Workflow.
4. Wait for the device to apply the changes. On production devices with configuration approval enabled, pins can wait for approval.

A Workflow marked "May Need Internet" selects some models at runtime, so its cache report may not list them all. Pin each possible model ID, then run the Workflow online with each selection. Verify every selection in the disconnected restart test below.

### Check cache completeness

Wait for the "Reported" timestamp to update after your changes. This confirms you are checking a recent cache report. The "Cached" column shows when the Workflow definition was saved.

Check each required item:

* Confirm the Workflow's "Version" matches the version you intend to run. "Latest" refers to the last published version the device fetched.
* Wait for "Waiting for Device" to clear, and resolve any "Not Cached" status or cache error.
* Hover over each count in the "Models" column to inspect the model IDs. Resolve every "Not cached" entry. A cached Workflow definition alone does not mean its models are cached.
* Check individual pins in "Pinned Models" and test every runtime-selected model. "Selected when run" does not confirm that those models are present.

Allow enough disk space and cache capacity for all required models and engines. Cache size limits can remove model files. The device needs connectivity to download them again, even when they are pinned.

### Check TensorRT readiness

If your deployment uses TensorRT, run each model and Workflow online on the target device with the inference engine settings you will use offline. Wait for compilation to finish, which can take several minutes on the first run.

In "Workflows", hover over the "TensorRT" value to inspect each model:

* "Built": engine files are present for all cached models that report engine status.
* "N of M Built": only some of those models have engine files.
* `--`: engine status is unavailable. Check the model through a test run and logs.

In "Pinned Models", check each model that requires TensorRT for "Built".

Missing models are excluded from the TensorRT count, so check cache completeness first. The disconnected restart test verifies that the engines load on your device.

### Enable Offline Mode

Open the device's "Configuration" tab, turn on "Offline Mode", and save the change. Follow [Update Device Configuration](/deployment/self-hosted/enterprise/deployment-manager/making-changes/update-device-configuration.md) for approval and maintenance-window behavior. The setting takes effect when the inference service restarts.

Confirm the device shows "Offline Mode", then complete the [disconnected restart test](#test-a-disconnected-restart). Published Workflow changes and new model versions do not reach inference while Offline Mode is on.

## CLI

For a self-managed container, store the whole model cache in a persistent volume. Choose the image for your hardware from the [Linux](/deployment/self-hosted/inference-server/install/linux.md) or [Jetson](/deployment/self-hosted/inference-server/install/jetson.md) installation guide. Use the same image version, device, cache paths, and engine settings for preparation and offline testing.

### Populate the cache

This CPU example uses a named Docker volume at the default `MODEL_CACHE_DIR`, `/tmp/cache`. Replace `<version>` with the image version you plan to deploy.

```bash
export INFERENCE_IMAGE="roboflow/roboflow-inference-server-cpu:<version>"
docker volume create roboflow
docker run -d --name inference-server \
  -p 127.0.0.1:9001:9001 \
  --mount source=roboflow,target=/tmp/cache \
  -e USE_FILE_CACHE_FOR_WORKFLOWS_DEFINITIONS=True \
  "$INFERENCE_IMAGE"
```

While connected, [run each model](/deployment/self-hosted/self-hosted.md#run-inference) and [Workflow](https://docs.roboflow.com/workflows/deploy/deploy-a-workflow) against this local server. Use the same API key, Workspace, Workflow, and requested Workflow version that your application will use offline. Run every model selected at runtime with local test inputs.

For TensorRT, run all required models on the target hardware and wait for compilation to finish. If `TENSORRT_CACHE_PATH` is outside `MODEL_CACHE_DIR`, mount a persistent volume there too. See [cache configuration](/deployment/self-hosted/inference-server/configuration/docker-configuration.md#model-cache).

### Restart in Offline Mode

Review [runtime authorization](#runtime-authorization), then recreate the container with `OFFLINE_MODE=True` and the same volume. Keep any GPU flags, engine settings, credentials, and other deployment options from the online run.

```bash
docker stop inference-server
docker rm inference-server
docker run -d --name inference-server \
  -p 127.0.0.1:9001:9001 \
  --mount source=roboflow,target=/tmp/cache \
  -e USE_FILE_CACHE_FOR_WORKFLOWS_DEFINITIONS=True \
  -e OFFLINE_MODE=True \
  "$INFERENCE_IMAGE"
```

A Docker restart alone does not change environment variables. Keep the cache volume when removing the container, and complete the [disconnected restart test](#test-a-disconnected-restart).

## Test a disconnected restart

Use this test for both managed devices and self-managed containers. Keep local access to logs and controls so you can recover without Deployment Manager.

1. While online, record the expected Workflow versions, model IDs, outputs, and startup time from a successful run. Enable Offline Mode and confirm inference starts with that setting.
2. Disconnect internet access while keeping any required local cameras, clients, and output destinations reachable.
3. Restart the inference service with the network still disconnected. For a self-managed container, use `docker restart inference-server`. If the deployment must survive a device reboot, test that too. This verifies that inference can load the cache from disk.
4. Run every required model and Workflow, including each runtime model selection. Confirm expected outputs, local integrations, startup time, and throughput. Inspect local logs for missing files, failed downloads, and engine load or compilation errors.

When you use TensorRT through ONNX Runtime, Offline Mode disables engine file caching and may compile engines in memory. Check startup time and throughput after the disconnected restart, even if the online report shows "Built".

If a test fails, restore connectivity, turn Offline Mode off, resolve the errors, and rerun the affected models and Workflows. Repeat the disconnected test before deployment.

## Test recovery

1. Restore connectivity. Confirm Deployment Manager reconnects if you use it. Inference remains in Offline Mode until you change its setting.
2. Turn "Offline Mode" off and apply the change, or recreate your self-managed container with `OFFLINE_MODE=False`. Keep the same cache volume. Confirm inference restarts and can fetch the intended published Workflow and model versions.
3. Rerun the workloads and check logs and outputs. On managed devices, wait for a fresh cache report and recheck model and TensorRT status before enabling Offline Mode again.

Repeat readiness testing after changes to model selections, Workflows, container images, hardware, engine settings, or cache paths and limits.

## Cached fallback during an API outage

With Offline Mode off, Inference still contacts Roboflow. Inference 1.8.4 or newer can use a previously cached definition after a connection failure, timeout, or HTTP 5xx error when `USE_FILE_CACHE_FOR_WORKFLOWS_DEFINITIONS=True` (the default). The entry must match the API key, Workspace, Workflow, and requested version.

Fallback does not cover authorization errors, missing Workflows, HTTP 429 responses, or absent cache entries. It only recovers the Workflow definition; model loading and steps that need remote services can still fail.

Test this separately from deliberate Offline Mode: leave `OFFLINE_MODE=False`, run the exact requests your application uses while online, interrupt API connectivity, and restart the workload. Confirm the Workflow loads from cache, then restore access and verify that API requests succeed.

## Runtime authorization

Offline Mode cannot perform online Workspace or per-model API-key checks. If `MODELS_CACHE_AUTH_ENABLED=True`, startup also requires `ALLOW_OFFLINE_MODEL_CACHE_AUTH_BYPASS=True` for trusted single-tenant use. Review [offline authorization](/deployment/self-hosted/inference-server/configuration/model-security.md#offline-authorization) and [Offline Custom Python](/deployment/self-hosted/inference-server/configuration/security-migration.md#offline-custom-python) before enabling Offline Mode.
