> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Scheduled Tasks

> Durable named timers — queue, schedule, and every survive restarts and retry on failure.

`this.queue()`, `this.schedule()`, and `this.every()` let you defer work durably. Tasks
survive pod restarts — the scheduler uses the actor's built-in alarm mechanism.
A task's name must match a method on your class.

```ts theme={null}
// Run immediately (next alarm tick)
await this.queue("process");

// Run after a delay (in seconds)
await this.schedule(3600, "sendReminder");

// Run repeatedly (interval in seconds)
await this.every(300, "checkStatus");

// With a stable id — re-scheduling replaces the prior task (dedup)
await this.schedule(86_400, "nudge", null, { id: "daily-nudge" });

// Cancel a named task
await this.cancelSchedule("daily-nudge");

// List pending tasks
const tasks = await this.listSchedules();
```

## Task dispatch

When a task fires, the platform calls the method by name on your actor instance:

```ts theme={null}
export class MyAgent extends Agent {
  async sendReminder(): Promise<void> {
    // runs when the scheduled timer fires
  }

  // Fallback for tasks whose method name doesn't exist on the class
  protected override async onTask(name: string, payload: unknown): Promise<void> {
    console.error(`Unknown task: ${name}`);
  }
}
```

## Retries

Tasks retry up to 5 times by default on failure. Configure with `maxRetries`:

```ts theme={null}
await this.queue("process", data, { maxRetries: 3 });
```
