# Background jobs

Queue-shaped apps — the platform pulls work from the organization's job queue and delivers it to your route.

Some apps have no visitors at all: connectors that sync a vendor's API,
scheduled processors, notification fan-outs. On Pilvia App these are the
same kind of app as everything else — same runtime, same manifest, same
bindings — that opts into the organization's **job queue**:

```json
{
  "name": "vendor-sync",
  "jobs": { "path": "/sync" }
}
```

> [!NOTE]
> **Early access**
>
> The job queue belongs to an organisation in Pilvia Mieli, which an
> early-access account does not include: see [Data & AI](/data/overview.md).

With a `jobs` block, the host claims work queued for this app and delivers
it as ordinary requests to the declared route, running as the app's own
principal. Without one — the default — the host never runs the app except
on a real request.

## Pull, never push

The queue does not call into your app from outside. The platform **pulls**:
it claims a job under a lease, POSTs it to your route, and your handler
processes a slice of work and says whether more remains. The host loops —
slice by slice, with a cursor — until the job reports done or the slice
ceiling is hit. Long imports become many short requests, which is exactly
what an instance-per-request runtime wants, and a crash mid-job means
redelivery after the lease expires rather than lost work.

```json
{
  "jobs": {
    "path": "/sync",
    "lease_secs": 900,
    "max_slices": 100,
    "poll_secs": 30
  }
}
```

Every knob is bounded by the host — a manifest declares intent, it does not
set unbounded budgets. The lease must cover a whole run: there is no
renewal, so a sweep that outlives its lease gets redelivered.

## No inbound surface required

A pure connector declares no public routes and serves no hostname —
nothing to firewall, nothing to scan. If outside systems also need to poke
it (a webhook, a manual trigger), combine jobs with
[`auth: token`](/auth/overview.md): scheduled work arrives through the queue
with no token involved, and the token path stays for genuine outside
callers.

## Observability

Each slice leaves an access record like any request, and a whole run shares
one trace id — "what did last night's sync do" is a query, not
archaeology. See [Request IDs and headers](/reference/headers.md).
