API Reference

Agenda

Lightweight job scheduling for Node.js backed by MongoDB, with cron, interval, and one-off jobs.

Official Documentation ↗
CompatibilityThis documentation covers version v6.2.7. Check the official docs for the latest API surface.

Installation

npmnpm install agenda

Methods

Agenda persists jobs in MongoDB and multiple worker processes cooperate on the same queue.

Key Features

  • Cron, interval, and scheduled jobs
  • Persistent job state in MongoDB
  • Multiple cooperating workers

Usage Notes

Pin a version and check the official docs for the API surface you depend on before upgrading.

Errors

The following points are quoted verbatim from the official documentation. 来源:https://cdn.jsdelivr.net/gh/agenda/agenda@latest/README.md · 取证方式:HTTP GET 官方 README/文档页(HTML 去标签) · 抓取时间:2026-11-07T13:48:00.920Z. Any error type, throw condition or recovery step not stated there is left unspecified; this page does not infer exception classes or return values.

FAQ

What happens if the process restarts?
Jobs persist in MongoDB, so scheduled work survives restarts; mark jobs unique to avoid duplicate scheduling on each boot.
How do multiple workers behave?
Workers lock jobs before running them, so each job is processed once even with several Agenda instances connected.
Do handlers need to be idempotent?
Yes. A crashed worker can leave a job to be reprocessed, so handlers should tolerate being run more than once.