> For the complete documentation index, see [llms.txt](https://docs.eyepop.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.eyepop.ai/deploying/scenarios.md). Agents can also search and read this documentation through its [MCP server](https://docs.eyepop.ai/~gitbook/mcp).

# Scenarios

Five common deployments, and where to start with each

A Pop is the same wherever it runs. What sets one deployment apart from another is where the media comes from, which networks it has to cross, and where the results have to end up. Each case below stands for a common class of deployment. Find the one closest to yours, start from its setup, and follow its links for the details.

| Case                                                              | The media                                                          | Inference runs                                                                 | Results go to                                   | What you run                                      |
| ----------------------------------------------------------------- | ------------------------------------------------------------------ | ------------------------------------------------------------------------------ | ----------------------------------------------- | ------------------------------------------------- |
| [Your media library](#your-media-library)                         | images and videos in your own storage                              | EyePop's cloud                                                                 | your script                                     | the CLI, or a script with an SDK                  |
| [Media from your app's users](#media-from-your-apps-users)        | photos and videos your users upload, for example from their phones | EyePop's cloud                                                                 | your public webhook                             | your backend                                      |
| [Cameras on a private network](#cameras-on-a-private-network)     | live cameras behind a firewall                                     | EyePop's cloud                                                                 | a webhook on your network or on the internet    | an on-premise instance in relay-only mode, no GPU |
| [Cameras managed by a VMS](#cameras-managed-by-a-vms)             | cameras your video management system records                       | EyePop's cloud                                                                 | back into the VMS                               | the EyePop integration for your VMS               |
| [Cameras with inference on site](#cameras-with-inference-on-site) | live cameras behind a firewall                                     | a machine of yours with a GPU, optionally with deep analysis in EyePop's cloud | a webhook or your applications, on your network | an on-premise instance with a GPU                 |

Three properties of a deployment select the case:

* **How the media reaches EyePop's cloud.** Media in your own storage reaches it as a signed url, which the cloud fetches, or as an upload from your code: the first two cases.
* **Whether the cameras have an inbound route.** Cameras on a network with no inbound route need a component on that network that sends their video out: an on-premise instance in relay-only mode in the third case, or the integration for your VMS in the fourth.
* **Whether the video may leave the site.** Video that must not leave it is analyzed on your own hardware: the fifth case.

## Your media library

Images and videos in your own storage, such as product photos, archived footage or a collection in a bucket, analyzed in batches. For each item, your script gives EyePop's cloud a **signed url**, and the cloud fetches the item from your storage itself, so the media does not pass through your script or your uplink. A file that is only on a disk is uploaded instead. The predictions come back to your script as the response.

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-bb5805c09d0d97f82adeda514127d93966d9ae22%2Fdeploying-media-library.svg?alt=media" alt="Your systems hold your storage, a bucket or files on disk, and your script, using the CLI, Python or Node SDK. The script sends EyePop&#x27;s cloud the pop and, for each item, a signed url or the uploaded file, and gets the predictions back as the response. With a signed url, EyePop&#x27;s cloud fetches the item directly from your storage. In the cloud, the pipeline API runs the pop and scales out on GPU compute."><figcaption><p>Your script sends signed urls, which EyePop fetches from your storage, or uploads files, and gets the predictions back.</p></figcaption></figure>

### Set it up

{% tabs %}
{% tab title="CLI" %}

```bash
eyepop run --ability eyepop.person:latest --media-path "$SIGNED_URL" --json
eyepop run --ability eyepop.person:latest --media-path ./photos --recursive --format text > people.tsv
```

Quote a signed url: its query string holds `&`. `--media-path` repeats, `--format text` writes one line per item with its path or url and its prediction, and `--concurrency` sets how many items are in flight at once, 4 by default.
{% endtab %}

{% tab title="Python" %}

```python
from eyepop import EyePopSdk
from eyepop.worker.worker_types import InferenceComponent, Pop

pop = Pop(components=[InferenceComponent(ability="eyepop.person:latest")])

with EyePopSdk.sync_worker(pop=pop) as endpoint:
    jobs = [endpoint.load_from(url) for url in signed_urls]  # EyePop fetches these
    jobs += [endpoint.upload(path) for path in files]        # these are uploaded
    for job in jobs:
        while result := job.predict():
            print(len(result.get("objects", [])), "people")
```

{% endtab %}

{% tab title="Node" %}

```typescript
import { EyePop, PopComponentType } from '@eyepop.ai/eyepop'

const endpoint = await EyePop.workerEndpoint({
    pop: { components: [{ type: PopComponentType.INFERENCE, ability: 'eyepop.person:latest' }] },
}).connect()

const sources = [...signedUrls.map((url) => ({ url })), ...files.map((path) => ({ path }))]
for (const source of sources) {
    for await (const result of await endpoint.process({ source })) {
        console.log(result.objects?.length ?? 0, 'people')
    }
}
await endpoint.disconnect()
```

{% endtab %}
{% endtabs %}

`signed_urls` and `files` are your own lists. A video gives one prediction per processed frame, so read until it ends, as the loops do.

### Plan for

* **Signed urls over uploads.** With a signed url, EyePop's cloud reads the item from your storage, and your script sends only the url. Sign each url to stay valid until EyePop has read it, since a batch queues items before it gets to them. Upload only files that are not in storage that can sign urls.
* **Reproducible throughput.** In production, a [Deployment](https://docs.eyepop.ai/deploying/cloud/deployment.md), a persistent session, keeps the Pop's models loaded between batches, so each batch runs at the same throughput.
* **Fewer frames.** For video, a lower [frame rate](https://docs.eyepop.ai/platform/sources-and-options/options/frame-rate.md) processes and bills fewer frames.

Read next: [Run Inference](https://docs.eyepop.ai/cli/run.md) with the CLI, Running Inference with [Python](https://docs.eyepop.ai/sdks/python/inference.md) or [Node](https://docs.eyepop.ai/sdks/node/inference.md), and [Sources and Options](https://docs.eyepop.ai/platform/sources-and-options.md).

## Media from your app's users

Your product takes photos and videos from its users, for example from their phones, into your own storage, and acts on EyePop's analysis of them. The part of your system that takes the uploads is separate from the part that acts on the results: your backend passes each upload to EyePop's cloud with an [output](https://docs.eyepop.ai/platform/outputs.md), and EyePop's cloud sends the predictions to your public webhook as they happen.

Your backend passes the media one of three ways:

* a **signed url** for the stored upload, which EyePop's cloud fetches from your storage;
* an **upload** of the stored file;
* a **stream** of the upload as it arrives from the device, before it is stored. This takes more code than fits here: see [Binary streams](https://docs.eyepop.ai/platform/sources-and-options/sources.md#binary-streams).

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-9b33e79f4e3e347d1b8ee8bdbc21f7937a046598%2Fdeploying-app-media.svg?alt=media" alt="Users&#x27; devices, your app on phones and in browsers, upload photos and videos to your backend, which holds the API key and stores them in your storage. The backend sends EyePop&#x27;s cloud the pop with an output, and each upload as a signed url, the file, or a stream as it arrives. With a signed url, EyePop&#x27;s cloud fetches the upload from your storage. EyePop&#x27;s cloud sends the predictions to the output, your webhook on the public internet."><figcaption><p>Your backend passes each upload to EyePop's cloud with an output; the predictions go to your webhook.</p></figcaption></figure>

### Set it up

For each upload, once it is in your storage, your backend hands EyePop its signed url with an output for your webhook. One header carries a secret your webhook checks; another tells it which upload the predictions are for:

```typescript
import { EyePop, PopComponentType } from '@eyepop.ai/eyepop'

const endpoint = await EyePop.workerEndpoint({
    pop: { components: [{ type: PopComponentType.INFERENCE, ability: 'eyepop.person:latest' }] },
}).connect()

const results = await endpoint.process({
    source: { url: signedUrl }, // or { path }, or { stream, mimeType }
    outputs: [{
        name: 'results',
        type: 'webhook',
        events: ['prediction.made'],
        webhook: {
            url: 'https://hooks.example.com/eyepop',
            headers: { Authorization: `Bearer ${process.env.HOOK_TOKEN}`, 'X-Upload-Id': uploadId },
        },
    }],
})
for await (const _ of results) {} // the webhook gets the predictions; this waits for the source to end
```

The webhook receives one JSON request per prediction, `prediction.made`. [Outputs](https://docs.eyepop.ai/platform/outputs.md) has the same in Python and the CLI, the events to choose from and what each request holds.

### Plan for

* **The API key stays on your backend.** It never goes to your app on the device.
* **Public webhooks only.** In EyePop's cloud a webhook must be on a public address. Have it check a secret header, as above.
* **At least once, in order.** A webhook can see the same event twice after a retry; `event_id` tells them apart. See [Delivery](https://docs.eyepop.ai/platform/outputs.md#delivery).

Read next: [Outputs (e.g. Webhooks)](https://docs.eyepop.ai/platform/outputs.md) and [Source Types](https://docs.eyepop.ai/platform/sources-and-options/sources.md).

## Cameras on a private network

IP cameras on a site's network that nothing on the internet can reach, with no GPU on site. An EyePop on-premise instance in **relay-only** mode runs on any small machine on that network: it reads the cameras and sends their video out over HTTPS to EyePop's cloud, which runs the Pop. No inbound port is opened, and if the connection to EyePop drops, the instance keeps the video and uploads it once it is back.

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-57b1af355db5f682656b3e8f595a8f5dd39565fe%2Frelay-network-overview.svg?alt=media" alt="Your network, behind a NAT firewall, holds your cameras, a host running an EyePop on-premise instance in relay-only mode, and optionally your own app using the CLI, Python or Node SDK, and a webhook sink. The instance reads the cameras over RTSP, or takes a pop and media from your app, and sends the video out through the firewall over HTTPS to EyePop&#x27;s cloud, with no inbound port. In the cloud the pipeline API runs the pop, scaling out on GPU compute. Results come back to the instance on the same connection, which hands them to your app or the webhook sink on your network, or they stay in the cloud, which sends them to a webhook sink on the public internet."><figcaption><p>The instance reads the camera and sends its video out; EyePop's cloud runs the pop, and the results come back into your network or go to a public webhook.</p></figcaption></figure>

### Set it up

This needs the [EyePop CLI](https://docs.eyepop.ai/cli/getting-started.md) 0.28.0 or later. Save a Pop that detects people as `person.json`:

```json
{
  "components": [
    { "type": "inference", "ability": "eyepop.person:latest" }
  ]
}
```

With the [EyePop CLI](https://docs.eyepop.ai/cli/getting-started.md) signed in, set up a relay-only instance on a machine that can reach the camera:

```bash
eyepop instance init --relay-only --history on
```

Then start the camera as a persistent stream, relayed to EyePop's cloud, with its predictions sent to a webhook. The instance keeps it running through camera dropouts, lost connections and restarts, until you stop it:

```bash
eyepop instance stream start door --url rtsp://user:password@192.168.1.20:554/stream1 \
  --pop ./person.json --relay --output webhook=https://hooks.example.com/eyepop
```

**Results on your network.** When the system that takes the predictions is on the camera's network too, keep them there: `--relay-results instance` brings them back into the instance, which sends them to a webhook on a private address, behind your firewall:

```bash
export HOOK_TOKEN="Bearer <your webhook token>"
eyepop instance stream start door --url rtsp://user:password@192.168.1.20:554/stream1 \
  --pop ./person.json --relay --relay-results instance \
  --output webhook=http://192.168.1.50:9099/hook,header=Authorization:env:HOOK_TOKEN
```

`eyepop instance stream list` shows how each stream, its relay and its output are doing. [Relay to the Cloud](https://docs.eyepop.ai/deploying/on-premise/relay.md) covers the rest: webcams and video files, the Python and Node SDKs, the backlog kept while EyePop cannot be reached, and how to cut the upload with frame rate, resolution and motion detection.

### Other ways in

* **A camera EyePop can reach.** A camera with a public `rtsp://` or `rtsps://` url needs no relay: EyePop's cloud reads it directly, as in [the first case](#your-media-library), with the camera's url as the media. See [RTSP cameras](https://docs.eyepop.ai/platform/sources-and-options/sources.md#rtsp-cameras).
* **Managed Tailscale.** [Tailscale](https://tailscale.com) puts the camera's network and EyePop's cloud on one private network, a tailnet, with stable addresses and no inbound firewall rule; EyePop's cloud then reads the camera directly. Setting up the tailnet on your side is yours to do, and EyePop's side is set up with you: contact <support@eyepop.ai>.

### Plan for

* **Outbound access.** The machine needs outbound HTTPS to EyePop. Nothing needs to reach it from outside.
* **Bandwidth.** A relayed camera uploads its video as the camera sends it, so plan for each camera's bitrate, or lower it on the machine. See [Local media optimization](https://docs.eyepop.ai/deploying/on-premise/relay.md#local-media-optimization).
* **Codecs.** A relay uploads H.264, H.265 (HEVC), MPEG-1, MPEG-2 and MPEG-4 Part 2 video as it comes.
* **Capture time.** Predictions carry the time the camera captured each frame, when the camera provides it. See [Capture time on a relayed camera](https://docs.eyepop.ai/deploying/on-premise/relay.md#capture-time-on-a-relayed-camera).
* **Billing.** EyePop's cloud work is billed to the account the instance is registered to, as for any cloud source.

Read next: [Relay to the Cloud](https://docs.eyepop.ai/deploying/on-premise/relay.md), [Persistent Streams](https://docs.eyepop.ai/deploying/on-premise/streams.md) and [Outputs (e.g. Webhooks)](https://docs.eyepop.ai/platform/outputs.md).

## Cameras managed by a VMS

Cameras that a video management system already records and shows to operators. An EyePop VMS integration runs next to the VMS: it takes the video of the cameras you turn it on for from the VMS, has EyePop's cloud run a Pop on it, and publishes the detections back into the VMS as bounding boxes and analytics events. Operators see them in the client they already use, and nothing about the cameras changes.

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-2911e60b1be481c4e062da0f3e6b535f8d6606a7%2Fdeploying-vms.svg?alt=media" alt="Your network, behind a NAT firewall, holds your cameras, your VMS (Milestone XProtect, or Network Optix Nx Witness or Nx Meta), the VMS client your operators use, and the EyePop VMS integration, a container next to the VMS. The cameras send RTSP video to the VMS, which hands it to the integration. The integration sends the video out through the firewall over HTTPS to EyePop&#x27;s cloud and gets the results back. It publishes boxes and analytics events into the VMS, which shows the detections on live video in the VMS client."><figcaption><p>The integration takes video from the VMS, has EyePop's cloud run the pop, and publishes the detections back into the VMS.</p></figcaption></figure>

### Set it up

1. Create an [API key](https://docs.eyepop.ai/api-keys.md) for the integration.
2. Run the integration for your VMS:
   * **Milestone XProtect:** the EyePop app runs as one more container in your Milestone AI Bridge's Docker Compose deployment. See [Milestone XProtect](https://docs.eyepop.ai/deploying/vms/milestone.md).
   * **Network Optix:** EyePop Vision AI runs as one container next to each NX Server that hosts cameras, for Nx Witness and Nx Meta. See [Network Optix](https://docs.eyepop.ai/deploying/vms/network-optix.md).
3. Turn EyePop on for a camera, and choose what it detects with a workflow, which carries a Pop. Each integration's Workflows page shows how.

### Plan for

* **Outbound access.** The host running the integration needs outbound HTTPS to EyePop, and its API key.
* **Where results go.** Detections go into the VMS, for its operators, its alarms and its recordings.
* **Billing.** EyePop's cloud work is billed to the account of the integration's API key.

Read next: [VMS](https://docs.eyepop.ai/deploying/vms.md), then the pages of your VMS.

## Cameras with inference on site

Cameras whose video must not leave the site, or that need answers with no network delay, or whose video would cost too much bandwidth to send out. An EyePop on-premise instance on a machine with a GPU, on the cameras' network, runs the Pop on every frame. The video stays on your network, and your applications on that network get the results.

With [temporal context](https://docs.eyepop.ai/platform/temporal-context.md), the instance can still hand deep analysis to EyePop's cloud: it detects and tracks every frame itself, a select operator picks the clearest view of each tracked object, and only that one crop goes to a [VLM ability](https://docs.eyepop.ai/platform/abilities/open-vocabulary/promptable-vlm-tasks.md) in EyePop's cloud, once per object rather than once per frame.

<figure><img src="https://1072321683-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FDoCvfjveqiJFmk0cnXCp%2Fuploads%2Fgit-blob-b4318825d682f254c44897a55cfd272c1702daa0%2Fdeploying-onprem-gpu.svg?alt=media" alt="Your network, behind a NAT firewall, holds your cameras, an EyePop on-premise instance on a host with a GPU that detects and tracks on every frame, your application using the Python or Node SDK in local mode, and optionally a webhook sink on your network. The instance reads the cameras over RTSP. Your application gives the instance a camera url and gets the predictions back. A persistent stream sends results to the webhook sink. Optionally, the instance sends one crop per tracked object out through the firewall over HTTPS to VLM abilities in EyePop&#x27;s cloud for deep analysis, and gets its answer back. The video stays on your network."><figcaption><p>The instance runs the pop on every frame on your network; only the crops a select operator picks go to EyePop's cloud, and only when the pop asks for deep analysis.</p></figcaption></figure>

### Set it up

This Pop detects and tracks people on every frame, picks the clearest view of each one, and asks `eyepop.qwen3.classify`, a VLM in EyePop's cloud, whether the person wears a hard hat or a high-visibility vest. Save it as `ppe.json`:

```json
{
  "components": [{
    "type": "inference",
    "ability": "eyepop.person:latest",
    "forward": {
      "operator": { "type": "crop" },
      "targets": [{
        "type": "tracking",
        "forward": {
          "operator": {
            "type": "select_crop",
            "select": {
              "mode": "most_relevant",
              "minTrackLengthSeconds": 1,
              "intervalSeconds": 10
            }
          },
          "targets": [{
            "type": "inference",
            "ability": "eyepop.qwen3.classify:latest",
            "params": {
              "prompts": [
                { "prompt": "a person wearing a hard hat", "label": "hard hat" },
                { "prompt": "a person with no hard hat", "label": "no hard hat" },
                { "prompt": "a person wearing a high-visibility vest", "label": "hi-vis vest" }
              ]
            }
          }]
        }
      }]
    }
  }]
}
```

With the [EyePop CLI](https://docs.eyepop.ai/cli/getting-started.md) signed in, set up the instance on the GPU machine with this Pop and its history database, which [persistent streams](https://docs.eyepop.ai/deploying/on-premise/streams.md) need. The CLI picks the runtime that fits the machine's GPU:

```bash
eyepop instance init --pop ./ppe.json --history on
```

Then start the camera as a persistent stream, with its results sent to a webhook on your network. The stream runs the instance's Pop, and the instance keeps it running through camera dropouts and restarts until you stop it:

```bash
eyepop instance stream start entrance --url rtsp://user:password@192.168.1.20:554/stream1 \
  --output webhook=http://192.168.1.50:9099/hook
```

An output without `events` gets every event of the stream: a `prediction.made` for each frame, the tracker's `track.started` and `track.ended`, and a `prediction.selected` for each selection, a little after the frame it is about. A selection carries the VLM's answer for one person on the frame that was selected, and `"selected": true`:

```json
{
  "schema": "eyepop.agent_event.v1",
  "event_type": "prediction.selected",
  "stream_id": "entrance",
  "content": {
    "seconds": 5.929,
    "source_width": 1920,
    "source_height": 1080,
    "objects": [
      { "classLabel": "person", "confidence": 0.9223, "trackId": 1,
        "x": 464.208, "y": 25.938, "width": 963.382, "height": 1039.869,
        "classes": [{ "classLabel": "no hard hat", "confidence": 0.9578 }] }
    ],
    "selected": true
  }
}
```

A webhook that wants only the VLM's answers names them, `--output webhook=http://192.168.1.50:9099/hook,events=prediction.selected`. This needs eyepop-worker 4.31.2 or later on the instance; before it, an output without `events` left the selections out.

To watch the selections on the machine, `eyepop run` (EyePop CLI 0.28.0 or later) with no target runs the instance's Pop on the camera and shows each selection as it arrives, between the live frames:

```bash
eyepop run --media-path rtsp://user:password@192.168.1.20:554/stream1
```

```
Selected: the frame at 4.160s
  person #1: no hard hat 96%
```

With `--json`, a selection's line carries `"selected": true`, so `jq -c 'select(.selected)'` keeps only those. Press Ctrl-C to end the run. See [Selected predictions](https://docs.eyepop.ai/cli/run.md#selected-predictions).

Your own application can read the camera through the instance in local mode instead, and take the selections from the predictions it gets back:

```python
from eyepop import EyePopSdk

# EYEPOP_LOCAL_MODE=true points the SDK at the instance on this machine
with EyePopSdk.sync_worker() as endpoint:
    job = endpoint.load_from("rtsp://user:password@192.168.1.20:554/stream1")
    while result := job.predict():
        if result.get("selected"):
            person = result["objects"][0]
            labels = [c["classLabel"] for c in person.get("classes", [])]
            print(f"person #{person['trackId']}: {', '.join(labels) or 'none of the prompts'}")
```

Without a VLM stage in the Pop, nothing leaves the machine at all.

### Plan for

* **Hardware.** [Platforms](https://docs.eyepop.ai/deploying/on-premise/platforms.md) lists the GPUs and accelerators an instance runs on, and [Optimize Models](https://docs.eyepop.ai/deploying/on-premise/optimize.md) tunes the models for the machine.
* **What leaves the site.** Only the crops the select operator picks, over outbound HTTPS, and only for a Pop with a cloud ability. The VLM calls are billed to the instance's account; everything else runs on your hardware.
* **Watching it.** [Prometheus Metrics](https://docs.eyepop.ai/deploying/on-premise/metrics.md) and [Operate It](https://docs.eyepop.ai/deploying/on-premise/operate.md) cover health, dropped frames and updates.

Read next: [On-Premise](https://docs.eyepop.ai/deploying/on-premise.md), [Call It From Your Application](https://docs.eyepop.ai/deploying/on-premise/applications.md), [Temporal Context in Videos](https://docs.eyepop.ai/platform/temporal-context.md) and [Select Operators](https://docs.eyepop.ai/platform/temporal-context/select-operators.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.eyepop.ai/deploying/scenarios.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
