Skip to content

.scheduler()

Replace the process-local scheduler used by recurring tasks.

Updated View as Markdown

Signature

agent.scheduler(driver: XsafSchedulerDriver): XsafAgent

Usage

import { cron } from "@xsaf/agent/scheduler/cron";

const bot = agent(config).scheduler(cron()).schedule({
  cron: "*/15 * * * *",
  prompt: "Check service status",
});

Only one scheduler may be configured. Without .scheduler(), scheduled tasks use XSAF’s built-in process-local cron scheduler.

Register the scheduler before .schedule(). Custom drivers implement the structural XsafSchedulerDriver contract exported from @xsaf/agent/types.

Navigation

Type to search…

↑↓ navigate↵ selectEsc close