import{_ as t,o as a,c as s,ag as n}from"./chunks/framework.CAXxHpAX.js";const p=JSON.parse('{"title":"Scheduled Tasks","description":"","frontmatter":{},"headers":[],"relativePath":"getting-started/schedule.md","filePath":"getting-started/schedule.md","lastUpdated":1774459922000}'),i={name:"getting-started/schedule.md"};function o(r,e,d,l,h,c){return a(),s("div",null,[...e[0]||(e[0]=[n(`

Scheduled Tasks

Scheduled Tasks allow you to automate recurring bot actions using cron expressions. This is useful for sending periodic reports, checking external data, performing maintenance, or triggering any routine task without manual intervention.

Concept: Cron-Based Automation

A Schedule is a cron-triggered rule bound to a specific bot. When a schedule fires, it sends a command to the agent, which executes it using its available tools, skills, and context. The bot can then deliver results to any connected channel.


Schedule Fields

FieldDescription
NameA display name for the task (e.g., "Morning News Summary").
DescriptionA brief explanation of what the task does.
PatternA cron expression that defines when the task runs (e.g., 0 9 * * * for daily at 9:00 AM).
CommandThe natural-language instruction sent to the agent when the schedule triggers (e.g., "Summarize today's top tech news and send it to the Telegram channel").
EnabledWhether the schedule is currently active.
Max CallsOptional limit on the total number of executions. Leave empty for unlimited.
Current CallsThe number of times this schedule has already fired.

Cron Pattern Reference

The pattern field uses standard cron syntax with five fields. It is evaluated in the server's configured timezone. By default, Memoh uses UTC, and you can change it with the top-level timezone config value.

┌───────────── minute (0–59)
│ ┌───────────── hour (0–23)
│ │ ┌───────────── day of month (1–31)
│ │ │ ┌───────────── month (1–12)
│ │ │ │ ┌───────────── day of week (0–6, Sun=0)
│ │ │ │ │
* * * * *

Common examples:

PatternMeaning
0 9 * * *Every day at 9:00 AM
*/30 * * * *Every 30 minutes
0 0 * * 1Every Monday at midnight
0 8,20 * * *Every day at 8:00 AM and 8:00 PM
0 0 1 * *First day of every month at midnight

Viewing Schedules

  1. Navigate to the Bot Detail Page.
  2. Select the Schedule tab.
  3. The list shows all schedules for this bot, including their name, cron pattern, enabled status, and execution counts.
  4. Click Refresh to reload the list.

Creating Schedules

Schedules are primarily created in two ways:

Via the Bot (Conversational)

The bot itself has access to a schedule tool. You can ask the bot to create a schedule in natural language:

"Create a schedule called 'Daily Digest' that runs every day at 8 AM and sends me a summary of my unread emails."

The bot will translate this into a cron expression and register the schedule automatically.

Via the API

You can also create schedules programmatically using the REST API:

POST /api/bots/{bot_id}/schedule
json
{
  "name": "Daily Digest",
  "description": "Summarize unread emails every morning",
  "pattern": "0 8 * * *",
  "command": "Summarize my unread emails and send the result to Telegram.",
  "enabled": true,
  "max_calls": null
}

Execution Flow

When a schedule fires:

  1. The cron service triggers the schedule.
  2. The current_calls counter is incremented.
  3. If max_calls is set and reached, the schedule is automatically disabled.
  4. The agent receives the command along with the schedule context.
  5. The agent executes the command using its tools (e.g., web search, file read, send message).
  6. Results can be delivered to any connected channel.

Schedule vs. Heartbeat

FeatureScheduleHeartbeat
TriggerCron expression (flexible timing)Fixed interval (minutes)
CommandCustom natural-language instructionGeneric "routine check" prompt
Max CallsOptional execution limitUnlimited
Use CaseSpecific recurring tasksPeriodic autonomous thinking

Both features complement each other: use Heartbeat for general-purpose periodic activity and Schedule for precise, task-oriented automation.

`,35)])])}const g=t(i,[["render",o]]);export{p as __pageData,g as default};