|
| 1 | +--- |
| 2 | +title: Scheduled Tasks |
| 3 | +icon: CalendarClock |
| 4 | +description: Run any Agent or Assistant on a cron schedule, fixed interval, or one-shot future date — completely decoupled from the active chat session. |
| 5 | +--- |
| 6 | + |
| 7 | +Scheduled Tasks turn an Agent or Assistant into a background worker. Define a schedule, hand it a prompt, and the task runs in its own conversation context every time it fires — with the same tools, MCP servers, web search, and code execution your interactive chats have access to. |
| 8 | + |
| 9 | +Useful for repeatable work such as: |
| 10 | + |
| 11 | +- Daily summaries (open PRs, tickets, news) delivered every morning |
| 12 | +- Periodic data checks via an MCP-exposed system |
| 13 | +- One-shot reminders at a specific wall-clock time |
| 14 | +- Fire-and-forget automations that post a notification via an MCP webhook tool |
| 15 | + |
| 16 | +## Prerequisites |
| 17 | + |
| 18 | +Scheduled Tasks are backed by [BullMQ](https://docs.bullmq.io/) and require a running Redis instance. The same Redis you already use for caching and resumable streams works — no extra service to operate. |
| 19 | + |
| 20 | +```bash filename=".env" |
| 21 | +USE_REDIS=true |
| 22 | +REDIS_URI=redis://localhost:6379 |
| 23 | +``` |
| 24 | + |
| 25 | +If Redis is not configured the backend boots normally but the UI's task definitions will never fire. See [Redis Configuration](/docs/configuration/redis) for hosted / cluster setups. |
| 26 | + |
| 27 | +## Creating a Task |
| 28 | + |
| 29 | +Open the **Scheduled Tasks** tab in the unified left sidebar (calendar-clock icon) and click the **+** button. |
| 30 | + |
| 31 | +### Target and Prompt |
| 32 | + |
| 33 | +- **Target Type** — `Agent` or `Assistant`. |
| 34 | +- **Target ID** — the unique ID of an Agent / Assistant you own. |
| 35 | +- **Prompt** — the message sent to the target every time the task runs. Treated identically to a chat input. |
| 36 | + |
| 37 | +### Trigger |
| 38 | + |
| 39 | +Pick one of three trigger types: |
| 40 | + |
| 41 | +- **Cron** — a standard 5-field expression, e.g. `0 9 * * 1-5` for _9 AM every weekday_. The task builder also ships a **Quick presets…** dropdown beneath the cron input (every minute, every 15 minutes, hourly, weekdays at 09:00, etc.); a friendly description is shown below the field when LibreChat recognizes the pattern. Power users can still type any 5-field expression directly — [crontab.guru](https://crontab.guru/) is a good visual helper. |
| 42 | +- **Interval** — a fixed delay in **milliseconds**, e.g. `3600000` for hourly. |
| 43 | +- **Date** — a one-shot execution at a specific datetime. Date triggers in the past simply produce no queued job. |
| 44 | + |
| 45 | +Cron and Date triggers honor an IANA timezone (e.g. `America/New_York`, `Asia/Kolkata`). New tasks default to your browser's detected zone, and cron schedules respect Daylight Saving Time transitions for the chosen zone. Interval triggers are timezone-agnostic. |
| 46 | + |
| 47 | +### Per-Task Capabilities |
| 48 | + |
| 49 | +The task builder mirrors the in-chat tool picker, scoped per task rather than inherited from the target Agent's default: |
| 50 | + |
| 51 | +- **Tools** — Web Search, File Search, Code Execution toggles. |
| 52 | +- **MCP Servers** — checkbox list of servers configured for your account; only the ones you tick are exposed to this task's run. |
| 53 | + |
| 54 | +This makes it easy to ship narrow, least-privilege background jobs (e.g. _"only the GitHub MCP server, nothing else"_). Per-task switches can only enable capabilities that are also enabled globally in `librechat.yaml` — if an admin has disabled Web Search, the task's Web Search toggle is a no-op. |
| 55 | + |
| 56 | +## Output Handling |
| 57 | + |
| 58 | +Every run starts a **fresh conversation** so background activity never pollutes your interactive chat history. |
| 59 | + |
| 60 | +- Scheduled-run conversations are marked `isScheduled: true` and excluded from the default conversation list. |
| 61 | +- The **History** (clock) icon on each task card opens the **Task Runs** modal listing every persisted run, newest first. Clicking an entry navigates to that conversation where you can read the output, inspect tool invocations, and continue manually if you want. |
| 62 | +- Check **Run as Temporary Chat** in the builder to skip persisting the conversation entirely — useful for fire-and-forget tasks that only need to perform a side effect. Temporary runs do not appear in the Task Runs modal. |
| 63 | + |
| 64 | +## Managing Tasks |
| 65 | + |
| 66 | +Each task card in the panel exposes inline controls for the most common workflows: |
| 67 | + |
| 68 | +- **Pause / Resume** — pause stops a recurring task without losing its configuration or history; resume re-arms the schedule. |
| 69 | +- **Edit** — reopens the builder pre-populated with the task's current settings. Saving atomically replaces the underlying schedule. |
| 70 | +- **History** — opens the Task Runs modal described above. |
| 71 | +- **Delete** — removes the task and its scheduled job. Past run conversations keep `isScheduled: true` and remain filtered out of the main chat sidebar even after deletion; they're still accessible via their direct conversation URL. |
0 commit comments