Skip to content

Scheduling

Talon’s scheduler lets agents create, manage, cancel, and delete durable scheduled tasks. Schedules are stored in SQLite, survive daemon restarts, and run through the normal message queue.

Context matters here: use Talon’s schedule_manage host tool for anything you want to keep. Native model-side cron helpers such as CronCreate and CronDelete are session-bound and disappear when the conversation ends.

Grant the schedule.manage:own capability to the persona:

personas:
- name: assistant
capabilities:
allow:
- schedule.manage:own
- channel.send:my-telegram

The agent manages schedules through the schedule_manage host tool.

ParameterTypeDescription
actioncreate, update, cancel, delete, listOperation to perform
scheduleIdstringRequired for update, cancel, and delete
cronExprstring5-field cron expression. Required for create; optional for update
labelstringHuman-readable label
promptstringInline prompt text
promptFilestringPrompt alias from the persona’s prompts/ directory (resolved at fire time)

Rules that matter:

  • Schedules are cron-based. Cron expressions use the 5-field format and evaluate in system local time
  • A scheduled run does not reply by itself. The agent must call channel_send to reach the user (see Delivering results)
  • cancel disables a schedule without deleting it
  • delete removes it permanently
  • prompt and promptFile are mutually exclusive
  • promptFile is a prompt alias such as daily-summary, not a filesystem path
  • When an agent creates a schedule via schedule_manage, it runs on a dedicated thread scoped to that persona and channel (see Dedicated schedule threads below)

Example agent-side call:

{
"action": "create",
"cronExpr": "0 8 * * 1-5",
"label": "Morning briefing",
"prompt": "Check my open tasks and send a short morning briefing."
}
Terminal window
npx talonctl add-schedule \
--persona assistant \
--channel my-telegram \
--cron "0 9 * * 1-5" \
--label "Morning briefing" \
--prompt "Good morning. Please summarize what I should focus on today."
# Or use a prompt file (resolved at fire time)
npx talonctl add-schedule \
--persona assistant \
--channel my-telegram \
--cron "0 9 * * 1-5" \
--label "Morning briefing" \
--prompt-file daily-summary
npx talonctl list-schedules
npx talonctl list-schedules --persona assistant
# Permanently delete one schedule
npx talonctl remove-schedule <schedule-id>

--persona, --channel, --cron, and --label are required, plus exactly one of --prompt or --prompt-file.

A schedule created from the CLI has no origin chat. Its prompt must tell the agent where to deliver the result. See Schedules created from the CLI.

The scheduler tick interval controls how often due schedules are checked. Default is 5 seconds.

scheduler:
tickIntervalMs: 5000

Reduce this for near-real-time scheduling. For low-traffic deployments, 30 seconds or more is fine.

For recurring prompts, store the prompt in the persona’s prompts/ directory and reference it by alias:

personas/assistant/prompts/daily-summary.md
Check my open tasks and recent messages. Summarize:
- What's pending from yesterday
- What's due today
- Any blockers or things that need my attention
Keep it short.

The matching host-tool call uses promptFile: "daily-summary". Talon resolves that alias when the schedule fires, so you can update the prompt file without changing the schedule row.

talonctl add-schedule supports --prompt-file as an alternative to --prompt. The value is a basename (no .md extension) in the persona’s prompts/ directory. The scheduler resolves it to file content at fire time.

Terminal window
npx talonctl add-schedule \
--persona assistant \
--channel my-telegram \
--cron "0 9 * * 1-5" \
--label "Morning briefing" \
--prompt-file daily-summary

--prompt and --prompt-file are mutually exclusive. The scheduler stores the alias in the schedule payload and reads the file each time the schedule fires, so edits to the prompt file take effect on the next run without touching the schedule row.

If a schedule was created with --prompt "file:daily-summary" (or file:///daily-summary), the scheduler detects the file: prefix at fire time, promotes it to a proper promptFile alias, and logs a warning. The schedule still works — no manual migration needed — but you should update the row to use the explicit promptFile field for clarity.

When a schedule is created — whether via schedule_manage or talonctl add-schedule — Talon assigns it a dedicated thread scoped to the persona and channel combination. Each scheduled run executes in isolation from live conversations.

This matters for two reasons:

  1. No double responses. Previously, scheduled runs reused the live conversation thread, which caused the agent to reply both in its dedicated thread and in the original channel. Dedicated threads fix this by isolating execution.
  2. Clean live thread. Scheduled runs do not pollute the live thread’s session state. The agent processes the scheduled prompt with a fresh context.

For a schedule that the agent created via schedule_manage, the dedicated thread records the origin chat’s external_id in its metadata (kind: "schedule", originExternalId). channel_send reads that field and delivers to the chat where the schedule was set up. List, update, cancel, and delete operations remain persona-scoped, so schedules stay visible and editable from the live chat where the agent was invoked.

A scheduled task only reaches the user when the agent calls channel_send. Talon does not send the agent’s final wrap-up text of a scheduled run to the channel and does not store it as an outbound message. Write the schedule prompt so that it tells the agent to send its result.

Talon stores each successful channel_send delivery as an outbound message on the live recipient thread. When the user replies, the agent sees the scheduled message in the conversation context. To make sure of that, Talon also rotates the provider session of the recipient thread when a delivery comes from another thread. The next run on that thread starts a fresh session with the recent messages injected, including the scheduled one. This costs one cache miss per delivery.

Where a channel_send message goes depends on how the schedule was created:

Schedule createdDelivered to
By the agent, with schedule_manage, in a chatThat chat
By the agent, inside a Telegram topicThat topic
With talonctl add-scheduleNowhere by default: the agent must pass externalChatId

Talon records the conversation a schedule was created in and routes channel_send back to it, as long as the agent does not pass externalChatId. An explicit externalChatId always wins, so a persona that has learned one fixed chat ID will send every reminder there. The log line channel.send: message sent successfully shows the recipient and the recipientSource (schedule origin, externalChatId argument or current thread).

To deliver a CLI-created schedule into a Telegram topic, put the topic’s thread key in its prompt, for example “send the result with externalChatId -1004452318413:42”. Send /chatid inside the topic to get that key. See Telegram topic workspaces.

A schedule created with talonctl add-schedule has no origin chat in its thread metadata. channel_send cannot infer a recipient, so a call without an explicit target fails with an error that points to the tools below.

ToolUse
channel_listLists the channels bound to the persona and, per channel, the chat IDs it can deliver to
channel_send with externalChatIdSends to one specific chat on the channel (for example a Telegram chat_id)
channel_broadcastSends one message to every chat the persona is bound to, across all bound channels
{
"channelId": "my-telegram",
"content": "Good morning. Here is your briefing.",
"externalChatId": "123456789"
}

channel_broadcast takes content and an optional replyTo. It returns a { delivered, skipped, failed } summary. It skips channel-default bindings, which have no thread, and reports them as a warning in the result. Use it only for deliberate fan-out.

All three tools are covered by the channel.send capability. No extra grant is needed.

  1. The scheduler checks for schedules whose nextRunAt is due.
  2. Due schedules are enqueued like normal messages for the target persona and channel.
  3. The agent processes the prompt through the normal queue and tool pipeline.
  4. After a successful run, Talon computes the next cron fire time and updates the row.

Scheduled tasks compete with user messages in the same FIFO queue. They don’t preempt active conversations. They are subject to the same retry and dead-letter policies as regular messages.

Each scheduled execution is a short-context, one-shot run. This keeps the context of a recurring task from growing with every run. A scheduled run:

  • does not use thread provider affinity
  • does not restore or store a provider session ID
  • does not get the earlier transcript of the schedule thread injected
  • does not run context rotation or observational-memory compression
  • does not store its final assistant text as an outbound message