> 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/deploy/deploy-a-workflow.md).

# Deploy a Workflow

Choose Cloud Streaming for managed live cameras, the Cloud API for requests, Batch Processing for stored data, or your own runtime.

Choose how to run your Workflow based on the input and how long processing should continue.

<table data-search="false"><thead><tr><th>Option</th><th>Best for</th></tr></thead><tbody><tr><td><a href="https://docs.roboflow.com/deployment/roboflow-cloud/cloud-streaming">Cloud Streaming</a></td><td>Live cameras on managed cloud compute, with source setup, previews, continuous deployments, and explicit stop controls.</td></tr><tr><td>HTTP API</td><td>Individual image requests to a hosted or self-hosted endpoint.</td></tr><tr><td><a href="https://docs.roboflow.com/deployment/roboflow-cloud/dedicated-deployments">Dedicated Deployments</a></td><td>A private cloud runtime provisioned for your use.</td></tr><tr><td><a href="/workflows/deploy/video-processing.md">Self-hosted video processing</a></td><td>Webcams, network cameras, or files processed on your own Inference Server.</td></tr><tr><td><a href="https://docs.roboflow.com/deployment/roboflow-cloud/batch-processing">Batch Processing</a></td><td>Finite asynchronous jobs over stored images and videos.</td></tr><tr><td><a href="https://docs.roboflow.com/reference/inference/inference-cli/workflows">Inference CLI</a></td><td>Images, directories, or video files from a command line.</td></tr><tr><td>Inference Python package</td><td>The <a href="/workflows/developer-guide/developer-guide/execution-engine.md#running-the-execution-engine-in-python">Execution Engine</a> inside your application without an HTTP hop.</td></tr></tbody></table>

{% hint style="warning" %}
Per-request Workflow execution on the Serverless Cloud API has two limits to plan around:

* Workflow runtime is capped at 20 seconds.
* The response payload is capped at 6 MB, so Workflows with many visualization blocks, or with large input images, can fail.

These request limits do not describe Cloud Streaming jobs. Self-hosted and dedicated deployments have their own runtime configuration.
{% endhint %}

If you run your Workflow on your own hardware, you can run it on both images and video files (including streams from regular **webcams** and professional **CCTV cameras**).

By choosing on-premises deployment, you can run Workflows on any system where you can deploy Inference. This includes:

* NVIDIA Jetson
* AWS EC2, GCP Cloud Engine, and Azure Virtual Machines
* Raspberry Pi

{% hint style="info" %}
Roboflow Enterprise customers have access to additional video stream options, such as running inference on Basler cameras. To learn more about our offerings, [contact the Roboflow sales team](https://roboflow.com/sales).
{% endhint %}

### Deploy a Workflow

Open "Use Workflow" in the Workflow editor to choose a deployment path. Select "Cloud Streaming" for a connected live source, or use the relevant API or self-hosted instructions below.

The code snippets in your Workflows editor will be pre-filled with your Workflows URL and API key.

Snippets match the runtime your editor is running on. If you switch the editor to a local Inference server or a [Dedicated Deployment](https://docs.roboflow.com/deployment/roboflow-cloud/dedicated-deployments), the `api_url` in each snippet points at that server, and the matching tab is marked as recommended. Snippets also fill in an example image from your saved Workflow preview when there is one.

{% hint style="info" %}
To learn more about usage limits for Workflows, refer to the [Roboflow pricing page](https://roboflow.com/workflows).
{% endhint %}

#### Process Images

You can run your Workflow on single images using the Roboflow API or local Inference server.

First, install the Roboflow Inference SDK:

```bash
pip install inference-sdk inference-cli
```

If you run locally, follow the [official Docker installation instructions](https://docs.docker.com/get-docker/) to install Docker on your machine and start Inference server:

```
inference server start
```

Then, create a new Python file and add the following code:

```python
from inference_sdk import InferenceHTTPClient, InferenceConfiguration

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",  # or "http://127.0.0.1:9001" for local deployment
    api_key="API_KEY"
).configure(InferenceConfiguration(api_key_transport="header"))

result = client.run_workflow(
    workspace_name="workspace-name",
    workflow_id="workflow-id",
    images={
        "image": "YOUR_IMAGE.jpg"
    }
)

```

Above, replace `API_KEY` with your Roboflow API key. Replace `workspace-name` and `workflow-id` with your Roboflow workspace name and Workflow IDs.

To find these values, open your Roboflow Workflow and click "Deploy Workflow". Then, copy your workspace name and workflow ID from the code snippet that appears on the page.

Local execution works on CPU and NVIDIA CUDA GPU devices. For the best performance, deploy on a GPU-enabled device such as an NVIDIA Jetson or a cloud server with an NVIDIA GPU.

If you prefer to call the endpoint directly, from any language, send an HTTP request:

```bash
curl --location 'https://serverless.roboflow.com/infer/workflows/<your-workspace-name>/<your-workflow-id>' \
    --header 'Content-Type: application/json' \
    --header 'Authorization: Bearer <YOUR-API-KEY>' \
    --data '{
    "inputs": {
        "image": {"type": "url", "value": "https://your-image-url"},
        "parameter": "some-value"
    }
}'
```

{% hint style="info" %}
Sending the key as an `?api_key=` query parameter or `api_key` body field is the legacy channel. It still works, but the `Authorization: Bearer` header keeps your key out of URLs and logs. See [Authenticate with the REST API](https://docs.roboflow.com/reference/platform/rest-api/authenticate-with-the-rest-api).
{% endhint %}

The keys of the `inputs` object are dictated by your Workflow, so the names differ depending on the inputs you defined. Inputs declared as `WorkflowImage` take an object with `type` and `value` keys; over HTTP the supported `type` values are `url` and `base64`.

The examples above run a Workflow that is saved on the Roboflow platform. You can also send a full Workflow definition with the request, which is useful for Workflows built from scratch that do not use API-key gated blocks. See the [Inference SDK](https://docs.roboflow.com/reference/inference/inference-sdk/workflows) for the `specification` argument.

#### Process a video stream

For managed live cameras, use [Cloud Streaming](https://docs.roboflow.com/deployment/roboflow-cloud/cloud-streaming). Open "Use Workflow" → "Cloud Streaming", select a source, review its Workflow inputs and processing estimate, then start processing. Follow the [quickstart](https://docs.roboflow.com/deployment/roboflow-cloud/cloud-streaming/quickstart) to connect a camera, see results, and explicitly stop the run.

The editor's "Run" action can preview a draft beside a deployment. Promoting an eligible preview preserves its exact running snapshot and disabled sinks without publishing or restarting. See [Workflow lifecycle](https://docs.roboflow.com/deployment/roboflow-cloud/cloud-streaming/run-a-workflow) before applying edits to a continuous run.

For video on your own Inference Server, the Inference SDK WebRTC client remains available:

```bash
pip install "inference-sdk[webrtc]"
```

```python
from inference_sdk import InferenceHTTPClient, InferenceConfiguration
from inference_sdk.webrtc import StreamConfig, WebcamSource

client = InferenceHTTPClient(
    api_url="http://localhost:9001",
    api_key="API_KEY",
).configure(InferenceConfiguration(api_key_transport="header"))

session = client.webrtc.stream(
    source=WebcamSource(),
    workflow="workflow-id",
    workspace="workspace-name",
    config=StreamConfig(data_output=["predictions"]),
)

@session.on_data("predictions")
def handle_predictions(predictions, metadata):
    print(predictions)

session.run()
```

Start the [self-hosted Inference Server](https://docs.roboflow.com/deployment/self-hosted/inference-server) first and replace the workspace, Workflow, and API-key values. See [Video processing with Workflows](/workflows/deploy/video-processing.md) for other source types and output handling. This WebRTC client is not the Cloud Streaming source and job API.

#### Process Batches of Data

You can efficiently process entire batches of data - directories of images and video files - using the Roboflow Batch Processing service. This fully managed solution requires no coding or local computation. Simply select your data and Workflow, and let Roboflow handle the rest.

We support both UI, CLI and REST API interactions with Batch Processing. Below, we present CLI commands. Discover [all options](https://docs.roboflow.com/deployment/roboflow-cloud/batch-processing#cli).

To run the processing, install Inference CLI:

```
pip install inference-cli
```

Then you can ingest your data:

```
inference rf-cloud data-staging create-batch-of-images \
    --images-dir <your-images-dir-path> \
    --batch-id <your-batch-id>
```

When data are loaded, start the processing job:

```
inference rf-cloud batch-processing process-images-with-workflow \
    --workflow-id <workflow-id> \
    --batch-id <batch-id>
```

Progress of the job can be displayed using:

```
inference rf-cloud batch-processing show-job-details \
    --job-id <your-job-id>  # job-id will be displayed when you create a job
```

And when the job is done, export the results:

```
inference rf-cloud data-staging export-batch \
    --target-dir <dir-to-export-result> \
    --batch-id <output-batch-of-a-job>
```

#### Process a Local Directory with the CLI

For data that already sits on the machine you are running from, `inference-cli` can run a Workflow over individual images, a directory of images, or a video file without any code:

```bash
pip install inference-cli
```

```bash
inference workflows process-images-directory \
    -i {your_input_directory} \
    -o {your_output_directory} \
    --workspace_name {your-roboflow-workspace-url} \
    --workflow_id {your-workflow-id} \
    --api-key {your_roboflow_api_key}
```

In the output directory you will find one sub-directory per input file, each containing a `results.json` file with that file's Workflow results plus any images produced during execution, and an `aggregated_results.csv` file with the results for every input concatenated together.

See the [Inference CLI reference](https://docs.roboflow.com/reference/inference/inference-cli/workflows) for all options.

## Next steps

* Run the Execution Engine directly inside your own Python application: see the [Developer Guide](/workflows/developer-guide/developer-guide.md).
* Understand the shape of the results a Workflow returns: see [Workflow execution](/workflows/developer-guide/developer-guide/workflow-execution.md#output-construction).
