Skip to main content
Run any agent on a cron / interval / one-shot and post the reply to a channel — from a few lines of YAML, with no Python.
See also: Gateway Inbound Hooks — the inbound HTTP trigger counterpart to this outbound scheduled delivery surface.

Quick Start

1

YAML — simplest form

Create gateway.yaml with a single schedules: entry:
Start the gateway — the schedule loads at boot and fires through the shared tick + delivery loop:
2

CLI — manage schedules from the terminal

3

Agent-centric — wire the agent in Python

The schedule references an agent by id; define that agent so the gateway can run it on each fire:

How It Works

The scheduler fires on the trigger, runs the agent, and routes the reply through the same channel-bot send path as inbound hooks.

Choosing a Trigger — cron vs every vs at

Exactly one of cron / every / at must be set on each schedule.

Schedule Reference

Every field on a schedules: entry. Zero triggers raises schedule requires exactly one of 'cron', 'every' or 'at'; more than one raises schedule accepts only one of 'cron', 'every' or 'at'.

Delivery

deliver: reuses the same channel-bot send path as inbound hooks — omit it for a run-only job with no channel post.

Pre-run Gate

Set pre_run to a cheap shell/python command that runs before the model turn — if it outputs nothing to do, the run is skipped with no LLM call and no delivery.

Idempotency & Hot-Reload

Each schedule gets a stable id cfg-<sha1(gateway-schedule:{name})[:12]> derived from its YAML key, so re-loading the same config upserts instead of duplicating.
  • Idempotent on stable id — the SHA1-prefixed id is deterministic from the YAML key; boots and hot-reloads never accumulate duplicates.
  • last_run_at is carried forward on upsert, so an interval or one-shot job is not re-fired after a restart or edit.
  • Removed schedules stop firing — a schedule deleted from the YAML is pruned on the next reload (only cfg- prefixed jobs are ever pruned).
  • Chat-created jobs are untouched — jobs created in-chat via the agent-callable schedule tool carry random ids and are never reconciled.
GatewayServer._load_declarative_schedules(config) runs right before the scheduler tick starts and again on every hot-reload, so additions, edits and removals all take effect without a process restart.

Failure Semantics

The gateway loads schedules best-effort so a single bad entry never blocks startup.
  • Malformed entries are skipped, not fatal — a single bad entry logs Skipping invalid schedule 'x': ... and startup continues. A warning also surfaces at load time.
  • Refuses to clobber a broken config — CLI add / remove will not overwrite a gateway.yaml it could not read as a YAML mapping; the original file is preserved and the command exits 1.
  • Exit codes — passing zero or more than one trigger flag, or a missing --agent / --prompt, exits 1.

CLI Reference

add

list

Prints one line per schedule with agent, trigger, and delivery target:

remove


Real User-Interaction Flow

At 8am Telegram chat ${OWNER_CHAT_ID} gets a summary of the user’s calendar and unread priorities. The user can reply in the same chat — because continuable: true — and the personal agent resumes the conversation.

Common Patterns

Daily brief to Telegram (cron)

Hourly health-check poll to Slack (every)

One-shot launch reminder (at)


Best Practices

A cheap pre_run command that prints nothing to do skips the model turn entirely — no tokens spent and no delivery when there’s nothing new.
Use every when the exact minute doesn’t matter (health polls); use cron when the delivery must land at a specific wall-clock time (an 8am brief).
The stable id derives from the YAML key — renaming a schedule creates a new job and drops the old one’s run-state.
A bare alert that shouldn’t open a conversation thread should set continuable: false so a reply doesn’t resume an agent turn.

Gateway Inbound Hooks

The inbound HTTP trigger counterpart to this outbound scheduled surface.

Schedule CLI

The standalone praisonai schedule CLI — store poller, tick, and job management.

Proactive Delivery

Friendly aliases for scheduled delivery.

Gateway Overview

Gateway architecture and how channels, agents, and routing connect.

Scheduled Run Policy

RunPolicy for scheduled jobs.

Scheduler Multi-Tenant

Per-user isolation for scheduled jobs.