> For the complete documentation index, see [llms.txt](https://docs.talus.network/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.talus.network/talus-docs-v2.1.0/reference/move/nexus_scheduler/schedule.md).

# nexus\_scheduler::schedule

* [Struct `Occurrence`](#struct-occurrence)
* [Struct `Recurrence`](#struct-recurrence)
* [Struct `Schedule`](#struct-schedule)
* [Struct `WithdrawnOccurrence`](#struct-withdrawnoccurrence)
* [Struct `ScheduleDelta`](#struct-scheduledelta)
* [Enum `OccurrenceSource`](#enum-occurrencesource)
* [Enum `OccurrenceWithdrawalReason`](#enum-occurrencewithdrawalreason)
* [Constants](#constants)
* [Function `advertised_occurrence`](#function-advertised_occurrence)
* [Function `is_idle`](#function-is_idle)
* [Function `is_exhausted`](#function-is_exhausted)
* [Function `pending_count`](#function-pending_count)
* [Function `dispatched_count`](#function-dispatched_count)
* [Function `next_occurrence_id`](#function-next_occurrence_id)
* [Function `occurrence_id`](#function-occurrence_id)
* [Function `occurrence_start_time_ms`](#function-occurrence_start_time_ms)
* [Function `occurrence_deadline_ms`](#function-occurrence_deadline_ms)
* [Function `occurrence_priority_fee_percentage`](#function-occurrence_priority_fee_percentage)
* [Function `occurrence_source`](#function-occurrence_source)
* [Function `occurrence_source_is_standalone`](#function-occurrence_source_is_standalone)

### Struct `Occurrence`

One bounded unit of scheduled work.

```move
public struct Occurrence has copy, drop, store
```

<details>

<summary>Fields</summary>

`id: u64start_time_ms: u64deadline_ms: std::option::Option<u64>priority_fee_percentage: u64source:` [`nexus_scheduler::schedule::OccurrenceSource`](#nexus_scheduler_schedule_OccurrenceSource)

</details>

#### Struct `Recurrence`

One lazily materialized recurring candidate.

```move
public struct Recurrence has copy, drop, store
```

<details>

<summary>Fields</summary>

`next:` [`nexus_scheduler::schedule::Occurrence`](#nexus_scheduler_schedule_Occurrence)`interval_ms: u64remaining: std::option::Option<u64>iteration: u64`

</details>

#### Struct `Schedule`

Bounded ordering state for a \[`Task`].

```move
public struct Schedule has store
```

<details>

<summary>Fields</summary>

`pending: vector<`[`nexus_scheduler::schedule::Occurrence`](#nexus_scheduler_schedule_Occurrence)`>recurrence: std::option::Option<`[`nexus_scheduler::schedule::Recurrence`](#nexus_scheduler_schedule_Recurrence)`>advertised_occurrence_id: std::option::Option<u64>`[`next_occurrence_id`](#nexus_scheduler_schedule_next_occurrence_id)`: u64`[`dispatched_count`](#nexus_scheduler_schedule_dispatched_count)`: u64last_dispatch_ms: std::option::Option<u64>`

</details>

#### Struct `WithdrawnOccurrence`

One occurrence removed from a \[[`Schedule`](#nexus_scheduler_schedule_Schedule)] without dispatch.

```move
public struct WithdrawnOccurrence has copy, drop
```

<details>

<summary>Fields</summary>

[`occurrence`](#nexus_scheduler_schedule_occurrence)`:` [`nexus_scheduler::schedule::Occurrence`](#nexus_scheduler_schedule_Occurrence)[`reason`](#nexus_scheduler_schedule_reason)`:` [`nexus_scheduler::schedule::OccurrenceWithdrawalReason`](#nexus_scheduler_schedule_OccurrenceWithdrawalReason)

</details>

#### Struct `ScheduleDelta`

Complete identity changes produced by one schedule mutation.

```move
public struct ScheduleDelta has drop
```

<details>

<summary>Fields</summary>

[`scheduled`](#nexus_scheduler_schedule_scheduled)`: vector<`[`nexus_scheduler::schedule::Occurrence`](#nexus_scheduler_schedule_Occurrence)`>`[`withdrawn`](#nexus_scheduler_schedule_withdrawn)`: vector<`[`nexus_scheduler::schedule::WithdrawnOccurrence`](#nexus_scheduler_schedule_WithdrawnOccurrence)`>`

</details>

#### Enum `OccurrenceSource`

Origin of one scheduled \[[`Occurrence`](#nexus_scheduler_schedule_Occurrence)].

```move
public enum OccurrenceSource has copy, drop, store
```

<details>

<summary>Variants</summary>

Variant `Standalone`An occurrence scheduled directly, independent of any recurrence.Variant `Recurring`An occurrence generated by a recurrence with its iteration index.`iteration: u64`

</details>

#### Enum `OccurrenceWithdrawalReason`

Reason an \[[`Occurrence`](#nexus_scheduler_schedule_Occurrence)] left its \[[`Schedule`](#nexus_scheduler_schedule_Schedule)] without dispatch.

```move
public enum OccurrenceWithdrawalReason has copy, drop, store
```

<details>

<summary>Variants</summary>

Variant `RecurrenceReplaced`A new recurrence replaced the recurrence candidate.Variant `RecurrenceCleared`The controller cleared the recurrence.Variant `TaskCanceled`The controller canceled the \[`Task`].Variant `TaskRejected`Current runtime rejected the immutable proposal contract.

</details>

#### Constants

```move
const MAX_PENDING_OCCURRENCES: u64 = 64;
```

```move
#[error]
const EPendingOccurrenceLimit: vector<u8> = b"Task pending occurrence limit reached";
```

```move
#[error]
const ERecurrenceNotAllowed: vector<u8> = b"Skill does not permit recurrence";
```

```move
#[error]
const ERecurrenceIntervalTooShort: vector<u8> = b"Recurrence interval is below the skill minimum";
```

```move
#[error]
const EOccurrenceLimit: vector<u8> = b"Skill occurrence limit reached";
```

```move
#[error]
const EOccurrenceNotAdvertised: vector<u8> = b"Occurrence is not currently advertised";
```

```move
#[error]
const EOccurrenceNotFound: vector<u8> = b"Advertised occurrence is missing";
```

#### Function `advertised_occurrence`

Returns the currently advertised occurrence.

```move
public fun advertised_occurrence(self: &nexus_scheduler::schedule::Schedule): std::option::Option<nexus_scheduler::schedule::Occurrence>
```

#### Function `is_idle`

Returns whether no future occurrence exists.

```move
public fun is_idle(self: &nexus_scheduler::schedule::Schedule): bool
```

#### Function `is_exhausted`

Returns whether the skill dispatch quota is exhausted.

```move
public fun is_exhausted(self: &nexus_scheduler::schedule::Schedule, policy: nexus_interface::agent::SkillSchedulePolicy): bool
```

#### Function `pending_count`

Returns the number of pending standalone occurrences.

```move
public fun pending_count(self: &nexus_scheduler::schedule::Schedule): u64
```

#### Function `dispatched_count`

Returns the number of dispatched occurrences.

```move
public fun dispatched_count(self: &nexus_scheduler::schedule::Schedule): u64
```

#### Function `next_occurrence_id`

Returns the next occurrence identity that will be allocated.

```move
public fun next_occurrence_id(self: &nexus_scheduler::schedule::Schedule): u64
```

#### Function `occurrence_id`

Returns the occurrence identity.

```move
public fun occurrence_id(self: nexus_scheduler::schedule::Occurrence): u64
```

#### Function `occurrence_start_time_ms`

Returns the requested start timestamp.

```move
public fun occurrence_start_time_ms(self: nexus_scheduler::schedule::Occurrence): u64
```

#### Function `occurrence_deadline_ms`

Returns the optional absolute deadline.

```move
public fun occurrence_deadline_ms(self: nexus_scheduler::schedule::Occurrence): std::option::Option<u64>
```

#### Function `occurrence_priority_fee_percentage`

Returns the priority fee percentage.

```move
public fun occurrence_priority_fee_percentage(self: nexus_scheduler::schedule::Occurrence): u64
```

#### Function `occurrence_source`

Returns the occurrence source.

```move
public fun occurrence_source(self: nexus_scheduler::schedule::Occurrence): nexus_scheduler::schedule::OccurrenceSource
```

#### Function `occurrence_source_is_standalone`

Returns whether an occurrence is independent of a recurrence.

```move
public fun occurrence_source_is_standalone(source: nexus_scheduler::schedule::OccurrenceSource): bool
```


---

# 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 following URL with the `ask` and `goal` query parameters:

```
GET https://docs.talus.network/talus-docs-v2.1.0/reference/move/nexus_scheduler/schedule.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `build a script that syncs our docs to a CMS` lets GitBook tailor the answer to that use case.

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.
