---
title: "Worker: your background processing, the while.sh docs"
url: https://while.sh/en/docs/building-blocks/worker/
updated: 2026-11-09
---

# Workers

A process that runs all the time, with no web address: it drains a job queue or follows a stream of events, and a new version replaces it without running twice.

> You, to your agent: Add a worker that sends the pending emails.

## What your agent writes

Your agent writes it in while.yaml, at the root of your app:

```yaml titre="while.yaml"
services:
  - name: jobs
    type: worker
    command: [node, worker.js]
```

## What your app receives

Your app receives these environment variables at every deployment:

| Variable | What it holds |
|---|---|
| `WHILE_SERVICE` | The worker's name. |
| `DATABASE_URL` | The address of the project's database, if it has one. |
| `SERVICE_<NAME>_URL` | The address of the project's other services. |

## When to use it

For what runs non-stop without answering requests: draining a queue, following an event stream. A worker never sleeps: for work at a fixed time, a scheduled job costs less.

## How it works

A worker runs continuously, with no web address, to drain a queue or follow a stream. A new version replaces it without ever running twice.

## Pricing

These prices are the same on every plan, excluding VAT:

| Resource | Price | Details |
|---|---|---|
| CPU and memory | €17 per vCPU·month and €8.50 per GiB·month | apps by usage, caches by reservation |

## Guides

- [Run a background worker with BullMQ, Celery or Sidekiq, from your AI agent](/en/guides/background-worker-queue/)
