# AI-Powered Scheduling

AI-Powered Scheduling uses artificial intelligence to automatically generate optimal shift assignments for your team. The AI considers employee availability, labor costs, hours fairness, seniority, and position coverage to fill open shifts -- saving you hours of manual scheduling work.

> **Note:** AI Scheduling is a Premium feature. Your store must have an active Premium subscription to use it.

---

## Accessing AI Scheduling

The AI scheduling feature is accessed from the Schedule Calendar. Look for the `Generate with AI` button (with a robot icon) in the primary header bar.

Requirements:
- Active Premium subscription for the store
- `uri_schedule_ai` permission to generate schedules
- `uri_schedule_ai_apply` permission to apply AI suggestions to shifts

If you do not see the button, check that your account has the required permissions and that Premium is active.

---

## How AI Scheduling Works

The AI scheduling process has three phases:

1. **Configure** -- Set your priorities and preferences in the configuration modal.
2. **Generate** -- The AI analyzes your team and open shifts, then produces suggested assignments.
3. **Review & Apply** -- Review each suggestion, select the ones you want, and apply them to your schedule.

The AI only fills **open shifts** (unassigned shifts). It does not modify or reassign existing employee shifts. Manually-assigned shifts are always preserved.

---

## Step 1: Configure the AI

Click `Generate with AI` on the Schedule Calendar to open the configuration modal.

### Usage Counter

At the top of the modal, you will see your usage status:

- **Runs used** / **Runs allowed** -- Shows how many AI generations you have used this pay period versus your limit (default: 5 per period).
- Usage resets at the start of each pay period.

If you have reached the limit, a warning banner appears and the Generate button is disabled.

### Schedule Week

The modal shows which week will be scheduled. This matches the week currently displayed on your calendar. Navigate to the desired week on the calendar before opening the AI modal.

The modal also displays the number of **open shifts to fill** for that week.

### Optimization Priorities

Drag to reorder the four optimization priorities. The AI weights higher-ranked items more heavily:

| Priority | Description |
|----------|-------------|
| **Labor Cost** | Prefer lower-cost employees when qualifications are equal |
| **Hours Fairness** | Distribute hours evenly among employees based on their requested hours |
| **Seniority** | Prefer more senior employees for shifts |
| **Position Coverage** | Ensure adequate role coverage per shift |

Drag the handle on the left side of each item to rearrange. The rank badges update automatically.

### Custom Instructions

Add free-text instructions (up to 500 characters) for special considerations. Examples:
- "Sarah prefers morning shifts"
- "Need extra coverage on Saturday"
- "Avoid scheduling new hires for closing shifts this week"

### Owner Scheduling

Store owners are excluded from AI scheduling by default. If you want an owner to be included, toggle them on in the Owner Scheduling section. Each owner shows their availability status.

### Additional Options

| Option | Description |
|--------|-------------|
| **Email me when schedule is ready** | Receive an email notification when the AI finishes generating |
| **Save these settings as defaults** | Remember your priority order and preferences for next time |

### Generate

Click `Generate Schedule` to start the process. A status indicator appears in the header bar showing that AI generation is in progress. You can continue using the calendar while the AI works.

To cancel a generation in progress, click the cancel button on the status indicator.

---

## Step 2: Review AI Suggestions

When the AI finishes, the Preview Panel opens automatically. If you navigated away, the panel will appear when you return to the calendar for that week.

### Summary Statistics

The top of the preview panel shows four key metrics:

| Metric | Description |
|--------|-------------|
| **Shifts Filled** | Number of open shifts the AI was able to assign |
| **Remaining Open** | Open shifts the AI could not fill (no suitable employee found) |
| **Total Hours** | Combined hours for all suggested assignments |
| **Est. Labor Cost** | Projected labor cost for the suggested assignments |

### AI Schedule Summary

Below the stats, the AI provides a human-readable summary explaining the key decisions it made and any trade-offs.

### Hours Distribution

An expandable section shows how hours are distributed across employees:

- **Existing hours** -- Hours from already-assigned shifts
- **+New hours** -- Additional hours from AI suggestions
- **Total hours** -- Combined total
- **OT Hours** -- Any overtime hours flagged

A badge indicates how many employees would be in overtime if all suggestions are applied.

### Day-by-Day Assignments

Assignments are organized by day of the week using tabs (Mon through Sun). Each tab shows a badge with the number of assignments for that day.

Each assignment card shows:

- **Employee name** and role badge
- **Shift time** and duration
- **Estimated labor cost** for that shift
- **Overtime badge** if the assignment would push the employee into overtime
- **Checkbox** to include/exclude this specific assignment

### Understanding AI Reasoning

Click "Why this assignment?" on any assignment card to expand the AI's reasoning. This explains why the AI chose this particular employee for this shift, considering factors like availability, cost, fairness, and qualifications.

For unfilled shifts, click "Why couldn't this be filled?" to understand the constraints that prevented assignment (e.g., no available employees, all qualified staff at hour limits).

### Stale Shift Warnings

If the schedule has been modified since the AI generated its suggestions, a warning banner appears. Individual assignments that are affected show a yellow "Shift modified since suggestion" badge. Consider regenerating for updated suggestions if significant changes were made.

### Selection Controls

- **Select All** / **Select None** -- Quickly select or deselect all assignments.
- **Individual checkboxes** -- Fine-tune which assignments to apply.
- The footer shows the count of selected assignments.

---

## Step 3: Apply or Dismiss

### Apply Selected Assignments

1. Review and select the assignments you want.
2. Click `Apply Selected` (the count updates as you check/uncheck).
3. A confirmation modal summarizes what will happen:
   - Selected shifts will be assigned to the suggested employees.
   - Unselected suggestions will be discarded.
   - Remaining open shifts can be filled manually.
4. Click `Apply Assignments` to confirm.

The selected assignments are written to the schedule and appear on the calendar.

### Dismiss All

If you do not want any of the suggestions:

1. Click `Dismiss All`.
2. Confirm in the dialog.
3. All suggestions are discarded. You can regenerate new suggestions if you have runs remaining.

---

## Re-Optimization

If you run AI generation on a week that already has AI-assigned shifts, a warning dialog appears:

- Shows the count of existing AI-assigned shifts.
- Warns that regenerating will **replace all existing AI assignments** with new suggestions.
- Manually-assigned shifts will not be affected.

Click `Replace & Regenerate` to proceed, or `Cancel` to keep the existing assignments.

---

## Locked Shifts

The AI recognizes "locked" shifts -- typically manager or owner shifts that are pre-assigned and recurring. These are displayed in a separate section at the bottom of the preview panel and are clearly marked with a lock icon. The AI works around locked shifts when generating suggestions.

---

## Best Practices

- **Create open shifts first** -- The AI only fills open shifts. Build your shift structure on the calendar (or load a template as open shifts) before running AI generation.
- **Set priorities thoughtfully** -- If labor cost is your top concern, rank it first. If fairness among staff is more important, move Hours Fairness to the top.
- **Use custom instructions** -- The AI can account for special requests like preferred shifts, training schedules, or coverage needs.
- **Review before applying** -- Always check the AI's reasoning for key assignments. The AI provides transparent explanations for every decision.
- **Run early in the week** -- Generate the schedule well before the target week so you have time to review and make manual adjustments.

---

## Troubleshooting

### "Generate with AI" button not visible
- Verify your store has an active Premium subscription.
- Confirm your user account has the `uri_schedule_ai` permission.

### "Weekly generation limit reached"
- Usage resets at the start of each pay period.
- Wait for the next period, or contact your administrator about increasing the limit.

### AI could not fill any shifts
- Check that there are open (unassigned) shifts on the calendar for the target week.
- Verify that employees have availability set for the target week's dates.
- Make sure employees are not already at their maximum hour limits.

### Suggestions seem incorrect
- Review the AI's reasoning by expanding the "Why this assignment?" section on each card.
- Adjust your optimization priorities and custom instructions, then regenerate.
- Ensure employee availability and hour preferences are up to date.

### A pending job is blocking new generation
- If a previous generation is still pending or processing, the modal will show a warning.
- Click `Cancel Job` to cancel the pending job, then start a new generation.

---

## Related Articles

- [Schedule Calendar](/support/articles/schedule-calendar) -- Managing the schedule calendar
- [Schedule Templates](/support/articles/schedule-templates) -- Saving and loading shift patterns
- [Timesheets & Time Tracking](/support/articles/timesheets-time-tracking) -- Reviewing employee hours
