> For the complete documentation index, see [llms.txt](https://boxlang.ortusbooks.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://boxlang.ortusbooks.com/getting-started/configuration/scheduler.md).

# Scheduler

BoxLang includes a powerful built-in task scheduler that allows you to schedule and manage tasks at the runtime level. The scheduler is managed by the `SchedulerService` and can be configured globally or programmatically.

## Configuration Structure

The scheduler configuration is located in the `scheduler` section of your `boxlang.json` file:

```json
{
  "scheduler": {
    "executor": "scheduled-tasks",
    "cacheName": "default",
    "schedulers": [],
    "tasksFile": "${boxlang-home}/config/tasks.json"
  }
}
```

## Configuration Properties

### executor

**Type:** `string` **Default:** `"scheduled-tasks"` **Description:** The name of the executor to use for running scheduled tasks. This must reference a valid executor defined in the `executors` section.

```json
"executor": "scheduled-tasks"
```

### cacheName

**Type:** `string` **Default:** `"default"` **Description:** The cache to leverage for server fixation or distribution. This is useful when running BoxLang in clustered environments to coordinate scheduled tasks across multiple instances.

```json
"cacheName": "default"
```

### schedulers

**Type:** `array` **Default:** `[]` **Description:** An array of absolute paths to BoxLang scheduler files (`.bx`) that should be registered upon runtime startup. You can use variable substitutions like `${user-dir}` or `${boxlang-home}`.

```json
"schedulers": [
  "${user-dir}/schedulers/MainScheduler.bx",
  "/path/to/custom/MyScheduler.bx"
]
```

### tasksFile

**Type:** `string` **Default:** `${boxlang-home}/config/tasks.json`

Path to the JSON file where the `bx:schedule` component persists task definitions. Tasks are written to this file on every create, update, or delete operation and reloaded from it on runtime startup.

```json
"tasksFile": "${boxlang-home}/config/tasks.json"
```

Override this path when you want multiple BoxLang instances to share a common task store (for example, via a shared mounted volume in a cluster).

## Programmatic Scheduling

You can create and manage scheduled tasks at runtime using:

* [**bx:schedule component**](/boxlang-framework/asynchronous-programming/scheduling-component.md) — tag/script API for HTTP-driven tasks; changes persist automatically to `tasksFile`
* [**Tasks File Reference**](/boxlang-framework/asynchronous-programming/scheduling-component.md#tasks-file-reference-tasksjson) — full `tasks.json` field-by-field schema with examples
* [**Scheduler DSL**](/boxlang-framework/asynchronous-programming/scheduled-tasks.md) — fluent class-based API for running arbitrary BoxLang code on a schedule

The configuration above provides the foundation and default settings for the scheduler service.

## Related Configuration

* [Executors](/getting-started/configuration/executors.md) - Configure the thread pools used by the scheduler
* [Caches](/getting-started/configuration/caches.md) - Configure caches used for task coordination
* [Logging](/getting-started/configuration/logging.md) - Configure logging for scheduler operations


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://boxlang.ortusbooks.com/getting-started/configuration/scheduler.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
