Skip to main content

Scheduled Agents

Run agents and workflows on a recurring schedule using cron expressions. Built on BullMQ repeatable jobs with Redis — production-grade, timezone-aware, and zero custom infrastructure.
Requires the @agentium/queue package with bullmq and ioredis peer dependencies.

Quick Start


queue.schedule()

Create a recurring schedule for an agent or workflow.
string
required
Unique schedule identifier (e.g. "daily-report").
string
required
Cron expression (e.g. "0 9 * * *" for daily at 9am, "*/5 * * * *" for every 5 minutes).
string
IANA timezone (e.g. "America/New_York", "UTC"). Defaults to the server’s local timezone.
object
Agent to run: { name, input, sessionId?, userId? }.
object
Workflow to run: { name, initialState? }.
Provide either agent or workflow, not both.

queue.unschedule(id)

Remove a recurring schedule.

queue.listSchedules()

List all active schedules with their cron pattern, timezone, and next run time.

Examples

Workflow Schedule

Health Check Every 5 Minutes

One-Off Delayed Job

If you need a single delayed execution instead of a recurring schedule, use enqueueAgentRun directly:

REST API

Enable schedule management endpoints by passing your AgentQueue as the scheduler option in createAgentRouter:
This exposes:

Example: Create via HTTP

Example: List Schedules


Cron Expression Reference

Format: minute hour day-of-month month day-of-week

Unique Agent Names

Agentium enforces unique names across agents, teams, and workflows. Attempting to register two agents with the same name throws an error:
This ensures that scheduled jobs always resolve to the correct agent.