Skip to main content
The Scheduler manages timed agent execution. Register triggers (interval, one-shot, cron) as jobs, and the scheduler fires them on schedule with concurrency control and persistence.

Quick Start

Triggers

Interval

Fire at regular intervals:
float
required
Interval between executions in seconds. Must be greater than 0.

OneShot

Fire exactly once, then stop:
float
Seconds from now until fire. Use either delay or fire_at.
float
Absolute Unix timestamp to fire at. Use either delay or fire_at.

Handler Return Values

Handlers control what happens when a trigger fires:

Scheduler

Constructor

Job Management

Callbacks

Job Lifecycle

Persistence

InMemoryJobStore (default)

Jobs are lost when the process exits.

SQLiteJobStore

Persist jobs across restarts:
SQLiteJobStore must be initialized with await store.initialize() before the scheduler starts. Trigger objects are not serialized — they must be re-attached when restoring jobs.

Agent Integration

Agents with triggers auto-create a scheduler:
When using agent.serve(), the scheduler starts automatically alongside interfaces, webhooks, and HTTP endpoints.

Imports