Skip to content

Run a background worker with BullMQ, Celery or Sidekiq, with your AI (2026)

Sending emails, running exports and heavy processing don’t belong in your requests. Connected to while over MCP, your AI deploys the worker that handles them in the background, with its queue.

By Aloïs Oddon, co-founder of Nextmap. Facts checked on November 19, 2026.

View as Markdown

Run a background worker with BullMQ, Celery or Sidekiq, with your AI: a worker and its queue with Claude Code, Cursor or Codex, on while, hosted in France

The short version. Over MCP, your AI deploys the worker that processes your BullMQ, Celery or Sidekiq queue, with its Redis-compatible cache. What matters, like deleting a database, waits for a person’s approval.

Prerequisites

  • An app that puts tasks in a queue: BullMQ, Celery, RQ or Sidekiq.
  • An AI that works in a terminal: Claude Code, Codex, Cursor or Gemini CLI.

Step 1: Give your AI this message

Open your AI in your app’s folder, and paste this message into it:

The message to give your AI
Connect to while with my account (while.sh/agents), then put my app on while.

Your AI adds while’s MCP server itself. If it asks you to, restart it. On the first call to while, a page opens in your browser. In Claude Code, if it doesn’t open, type /mcp, choose while, then Authenticate. On that page, choose “A new app”, then click Authorize.

Step 2: Open your app

Your AI gives you your app’s address, for example https://mon-appli.while.cloud, over HTTPS.

What your AI does

It adds the worker and its queue to while.yaml:

while.yaml
apiVersion: while/v1
project: mon-appli
services:
  - name: web
    port: 3000
  - name: worker
    type: worker
    command: [node, worker.js]
caches:
  - name: file
    durable: true

The worker runs nonstop, with no public address, and with the same code as your app. Its queue lives in a durable Redis-compatible cache: nothing is lost on restart. Its address, password included, arrives in REDIS_URL, as in this BullMQ worker1:

worker.js
import { Worker } from 'bullmq';
import IORedis from 'ioredis';

const connection = new IORedis(process.env.REDIS_URL, { maxRetriesPerRequest: null });

new Worker('emails', async (job) => {
  await envoyerEmail(job.data);
}, { connection });
A worker and its queue with while: credentials kept out of the AI's reach, every call logged in the history, a person's approval for what matters and a daily backup, in France
Around every app, while keeps the credentials, the history, the approvals and the backups.

Run a Celery worker

You, to your AI: Add a Celery worker for the exports.

Your AI declares the worker with the command celery -A monappli worker, connected to the same cache: it gives REDIS_URL to Celery, with broker=os.environ['REDIS_URL'].

See what your worker is doing

You, to your AI: Why are the emails going out late?

Your AI reads the worker’s logs in while, finds the task that is stuck and fixes it.

Add memory

You, to your AI: Give the exports worker more memory.

Your AI changes resources in while.yaml, and the worker restarts with it on the next deployment.

Go back to the previous version

You, to your AI: Go back to the previous version of the worker.

The previous version of the worker resumes in a few seconds. Your AI reads the error in the logs, fixes it and deploys again.

In the docs: Worker, Valkey cache (Redis), Scheduled jobs and Versions and rollback.

Next steps

Sources

  1. BullMQ, workers, accessed November 2, 2026

Questions

Does my worker run twice during an update?

No: a new version replaces the old one, and the two never run at the same time.

Celery, RQ or Sidekiq?

All of them: the worker runs the command of your choice, with the same code as your app.

What about a job that runs at a fixed time?

A scheduled job costs less: it only runs for as long as the work takes.

Does my worker have a public address?

No, it runs without an address: no one can call it from outside.

Where do my app and its data run?

In France, at Nextmap. The database is backed up every day, with a way back over 14 days, once a person approves.

Give your AI the message, and it takes care of the rest

Give this to your AI

Read while.sh/agents and help me get started with while.

Copy the message

In 3 minutes, with no sign-up, the tool has its own address. To keep it, create your account.

For a company project, write to the while team: hello@while.sh