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
npm
npm install agendaMethods
No methods match this filter.
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.
- A job will automatically unlock once a returned promise resolves/rejects (or if done is specified in the signature and done() is called). (https://cdn.jsdelivr.net/gh/agenda/agenda@latest/README.md)
- When a job fails, it can be automatically rescheduled based on the backoff strategy you define. (https://cdn.jsdelivr.net/gh/agenda/agenda@latest/README.md)
- Returns a Promise resolving to the number of cancelled jobs, or rejecting on error. (https://cdn.jsdelivr.net/gh/agenda/agenda@latest/README.md)
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.
Report a problem with this API docOpens a pre-filled issue on GitHub.