# Using Private Workers

> Run tasks on your own hardware.

**URL:** https://inference.sh/docs/private/using
**Last updated:** 2026-11-14

---

Run tasks on your own hardware.

---

## In the workspace

Toggle to "Private" when running an app:

```
Run on: [○ Cloud] [● Private]
```

---

## Via API

```python
result = client.run({
    "app": "my-app",
    "input": {...},
    "infra": "private"
})
```

Use `infra: "private_first"` when you want private workers when available, with automatic cloud fallback:

```python
result = client.run({
    "app": "my-app",
    "input": {...},
    "infra": "private_first"
})
```

---

## Specific workers

Target exact workers:

```python
result = client.run({
    "app": "my-app",
    "input": {...},
    "infra": "private",
    "workers": ["my-server-gpu-0"]
})
```

Every ID must be a worker of your workspace. An unknown ID, or another workspace's, is refused at submit with **400** `validation_error` (`workers not found in team <username>: …`). If none of the listed workers is online, the task fails with `none of the listed workers is online`.

---

## Agents on private

An agent's [app tools](/docs/api/agent/app-tools) run as tasks. Whoever runs the agent chooses where those tasks go, with `infra` on the run request:

```bash
curl -X POST https://api.inference.sh/agents/run \
  -H "Authorization: Bearer inf_your_key" \
  -H "Content-Type: application/json" \
  -d '{"agent":"my-team/my-agent","input":{"text":"upscale this image"},"infra":"private_first"}'
```

| Value | Where the agent's app tasks run |
|-------|---------------------------------|
| `cloud` | Cloud workers. The default |
| `private` | Your workspace's own workers only |
| `private_first` | Your own workers when one can take the task, cloud workers otherwise |

- **It is kept on the chat.** Later messages in the same chat use it without sending it again. A request that names another value replaces it. [Chat settings](/docs/api/rest/agents#chat-settings) change it too.
- **It covers every app the agent runs** in that chat: the tools it lists, the apps it finds and runs by name, and the app tools of its sub-agents.
- **It is not part of the agent.** An agent's author cannot set it, so a shared or published agent never forces `private` on a workspace with no engines.
- **Embeds, triggers and channels start on the cloud.** A visitor of a public embed cannot set it. For a chat a trigger or channel started, set it in chat settings.

`infra` does not change where the agent's model runs, or where a sandbox its `sandbox_create` tool makes is placed.

See [Agents API — Run agent](/docs/api/rest/agents).

---

## Sandboxes on private

A [managed sandbox](/docs/api/rest/sandboxes) can run on your own engine. The engine must host sandboxes: it reports the `sandboxes` [capability](/docs/api/rest/engines#engine-capabilities). [`engine setup`](/docs/private/installing) installs boxd, which runs the sandbox VMs, for the `sandbox` role on a Linux host with KVM; `--roles sandbox` asks for the role.

Set `infra` when you create the sandbox:

```bash
curl -X POST https://api.inference.sh/sandboxes \
  -H "Authorization: Bearer inf_your_key" \
  -H "Content-Type: application/json" \
  -d '{"name":"dev-box","infra":"private"}'
```

| Value | Where the sandbox is placed |
|-------|-----------------------------|
| `cloud` | Platform engines. The default |
| `private` | Your workspace's engines only |
| `private_first` | Your engines when one has room, platform engines otherwise |

On your own engine a sandbox costs nothing and starts with no balance. [Plan limits](/docs/extend/sandbox-limits#plan-limits) and the [purchase condition](/docs/extend/sandbox-limits#who-can-create-sandboxes) apply as on the cloud.

See [Sandboxes API — Where a sandbox runs](/docs/api/rest/sandboxes#where-a-sandbox-runs).

---

## Monitoring

In the sidebar, open **Resources** → **Engines** ([`/engines`](https://app.inference.sh/engines)) to check status:

- Online/offline status
- Resource usage
- Running tasks
- **Drain** / **Update** — graceful maintenance (see [Updating](/docs/private/installing#updating-the-engine))

To drain or upgrade an engine without killing in-flight tasks, see [Managing engines](/docs/private/managing-engines).

Use **Drain** before maintenance or **Update** for a safe binary upgrade (in-flight tasks finish first). The same operations are available via the [Engines API](/docs/api/rest/engines) or `client.engines.drain()` / `client.engines.updateBinary()` in the JavaScript SDK.

---

## Caching

The engine caches:
- App code
- Downloaded models
- Container images

Second runs are much faster.

---

## Next

| Guide | Topic |
|-------|--------|
| [Managing engines](/docs/private/managing-engines) | Drain, update, and restart |
| [Configuration](/docs/private/config) | Engine and worker settings |
| [Why private?](/docs/private/why) | When to use your own hardware |

→ [Back to Docs](/docs)
