Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/manusapis/Agix/llms.txt

Use this file to discover all available pages before exploring further.

The Agix scheduler turns your spreadsheet from a reactive tool into a proactive one. Instead of manually triggering a data pull or re-running an analysis, you register a ScheduledTask once and let the scheduler fire it on whatever cadence you need — from every minute to once a week. The service is backed by setInterval and lives entirely in the browser, so it requires no server-side infrastructure.

Types

All scheduler types are defined in src/types/scheduler.types.ts.

ScheduledTask

interface ScheduledTask {
  taskId: string;            // UUID assigned by register()
  name: string;
  schedule: ScheduleConfig;
  action: TaskAction;
  enabled: boolean;
  lastRunAt?: string;        // ISO-8601 timestamp of the most recent execution
  lastStatus?: TaskRunStatus;
}

ScheduleConfig

interface ScheduleConfig {
  frequency: "minute" | "hourly" | "daily" | "weekly" | "monthly" | "custom";
  cronExpression?: string;
  timezone: string;
  startAt?: string;          // ISO-8601 — when to begin firing
  endAt?: string;            // ISO-8601 — when to stop firing
}

TaskAction

interface TaskAction {
  type: "fetch-data" | "refresh-analysis" | "regenerate-report" | "send-alert" | "custom";
  params: Record<string, unknown>;
}

TaskRunLog

interface TaskRunLog {
  taskId: string;
  startedAt: string;
  finishedAt: string;
  status: "success" | "failure" | "running" | "skipped";
  error?: string;            // Present only when status is "failure"
}

Frequency tiers

schedulerService.resolveInterval() maps each named frequency to a millisecond value for setInterval:
FrequencyInterval
minute60,000 ms (1 minute)
hourly3,600,000 ms (1 hour)
daily86,400,000 ms (24 hours)
weekly604,800,000 ms (7 days)
monthly3,600,000 ms (falls back to hourly — not natively supported yet)
custom3,600,000 ms (falls back to hourly — use cronExpression for fine-grained control)

Task action types

The five TaskAction types map to different runtime behaviours:
Action typeWhat it does
fetch-dataPulls fresh rows from a configured data source into the sheet
refresh-analysisRe-runs forecasting, anomaly detection, or sentiment analysis
regenerate-reportRebuilds the executive summary, PDF, or PowerPoint output
send-alertDispatches a notification when a condition is met
customExecutes arbitrary logic supplied in params

Service methods

schedulerService.register(task)    // Creates a task, starts it if enabled, returns ScheduledTask
schedulerService.start(task)       // Begins firing setInterval for the task's frequency
schedulerService.stop(taskId)      // Clears the interval without removing the task
schedulerService.remove(taskId)    // Stops and deletes the task entirely
schedulerService.list()            // Returns all registered ScheduledTask objects
schedulerService.execute(task)     // Runs the task immediately and returns a TaskRunLog

Registering a task

1

Define the task

Construct a task object with a name, schedule config, and action. You do not need to provide taskIdregister() assigns a UUID automatically.
2

Call register()

Pass the object to schedulerService.register(). If enabled is true, the interval starts immediately.
3

Monitor runs

Call schedulerService.list() at any time to inspect lastRunAt and lastStatus on each task.

Daily revenue refresh example

import { schedulerService } from "@/services/scheduler/scheduler.service";

const task = schedulerService.register({
  name: "Daily Revenue Refresh",
  schedule: {
    frequency: "daily",
    timezone: "America/New_York",
  },
  action: {
    type: "fetch-data",
    params: { source: "stripe", resource: "charges" },
  },
  enabled: true,
});

console.log(`Registered task ${task.taskId}`);
// Fires every 86,400,000 ms — once per day

Stopping and removing tasks

// Pause without deleting
schedulerService.stop(task.taskId);

// Re-enable later
schedulerService.start(task);

// Remove permanently
schedulerService.remove(task.taskId);

Running a task on demand

const log = await schedulerService.execute(task);
// log: { taskId, startedAt, finishedAt, status: "success" | "failure", error? }

if (log.status === "failure") {
  console.error(`Task failed: ${log.error}`);
}

Listing all tasks

const tasks = schedulerService.list();

tasks.forEach((t) => {
  console.log(`${t.name}${t.schedule.frequency} — last: ${t.lastStatus ?? "never"}`);
});
The scheduler uses setInterval and stores task state in an in-memory Map. Tasks do not persist across page reloads or sidebar closes. If the Excel task pane is closed or refreshed, all registered intervals are lost and must be re-registered. For production use, persist your task definitions to a settings store and re-register them when the task pane initialises.
Combine a fetch-data task with the Stripe connector for effortless daily revenue updates. Set action.params to { source: "stripe", resource: "charges" }, use the "daily" frequency, and Agix will pull the latest charge records into your sheet every 24 hours — ready for the scheduler’s regenerate-report action to rebuild the executive summary automatically.

Build docs developers (and LLMs) love