Scheduled Tasks
Schedule future tasks via Telegram using the /task admin command. Tasks are stored in SQLite, triggered via Telegram Saved Messages, and executed by the agent with full tool access.
How It Works
Teleton uses Telegram's native scheduled messages to implement task scheduling. There is no cron daemon or config-file scheduler. The flow is:
- A task is created (via
/taskcommand or the agent'stelegram_create_scheduled_tasktool). - A
[TASK:uuid]message is scheduled in your Saved Messages at the target time. - When Telegram delivers the message, the agent intercepts it and executes the task.
- The agent receives full context (description, payload, parent results) and runs with all available tools.
- The task is marked as
doneorfailedin the database, and any dependent tasks are triggered or cancelled.
The /task Command
Admins can create tasks directly from Telegram:
/task Check TON price and alert me if it's above $5
/task In 2 hours, send a summary of today's wallet transactions
/task Review trading performance this weekThe /task command is an agent directive — it sends the description to the agent, which then decides the appropriate schedule time and payload type and calls telegram_create_scheduled_task internally. You describe what you want in natural language; the agent does the scheduling.
Note: /task is the only admin command for tasks. There are no /tasks, /task run, /task pause, or /task resume commands. To view and manage tasks, use the WebUI Tasks page at /tasks.
telegram_create_scheduled_task Tool
The agent (and plugins) can create tasks programmatically using this tool. It accepts the following parameters:
| Parameter | Type | Required | Description |
|---|---|---|---|
description | string | Yes | What the task is about |
scheduleDate | string | * | ISO 8601 date or Unix timestamp. Required unless dependsOn is set |
payload | string | No | JSON payload defining execution mode (see below) |
reason | string | No | Why this task is being created (used as context at execution time) |
priority | number | No | 0-10, higher is more important |
dependsOn | string[] | * | Parent task IDs that must complete first. Required unless scheduleDate is set |
Payload Types
The payload field controls how the task is executed. There are three modes:
1. Simple Reminder (no payload)
When no payload is provided, the agent receives a reminder notification and decides what to do.
{
"description": "Review trading performance this week",
"scheduleDate": "2025-01-05T18:00:00Z",
"reason": "Weekly review"
}2. Tool Call (auto-executed)
A specific tool is called automatically, and the result is fed to the agent for analysis and decision-making.
{
"description": "Check TON price",
"scheduleDate": "2025-01-01T10:00:00Z",
"payload": "{\"type\":\"tool_call\",\"tool\":\"ton_get_price\",\"params\":{},\"condition\":\"price > 5\"}",
"reason": "Monitor for trading opportunity"
}The condition field is optional and passed to the agent as context to guide its decision after seeing the tool result.
3. Agent Task (multi-step)
The agent receives detailed instructions and executes them step-by-step using the full agentic loop.
{
"description": "Trade if conditions are right",
"scheduleDate": "2025-01-01T15:00:00Z",
"payload": "{\"type\":\"agent_task\",\"instructions\":\"1. Check TON price\\n2. If above $5, swap 50 TON to USDT\\n3. Send result to admin\",\"context\":{\"maxAmount\":50}}",
"reason": "Automated trading strategy"
}Task Dependencies
Tasks can depend on other tasks using the dependsOn parameter. When all parent tasks complete successfully, the dependent task is triggered automatically by sending a [TASK:uuid] message to Saved Messages.
// Task A: check the price
{
"description": "Fetch current TON price",
"scheduleDate": "2025-01-01T10:00:00Z",
"payload": "{\"type\":\"tool_call\",\"tool\":\"ton_get_price\",\"params\":{}}"
}
// Returns taskId: "aaa-111"
// Task B: runs after Task A completes
{
"description": "Analyze price and decide on trade",
"dependsOn": ["aaa-111"],
"payload": "{\"type\":\"agent_task\",\"instructions\":\"Review the parent task price result. If TON > $5, swap 50 TON to USDT.\"}"
}When Task B executes, the agent receives the results from Task A as context in a PARENT TASKS COMPLETED section of the prompt.
Failure Cascade
If a parent task fails, all dependent tasks are cancelled by default. You can override this with skipOnParentFailure: false in the payload — this means the dependent task will still run even if its parent failed.
{
"description": "Send daily summary (always)",
"dependsOn": ["aaa-111"],
"payload": "{\"type\":\"agent_task\",\"instructions\":\"Send a summary report.\",\"skipOnParentFailure\":false}"
}Cycle Detection
The system uses BFS to detect circular dependencies. Attempting to create a cycle throws an error.
Task Lifecycle
Each task progresses through these statuses:
| Status | Description |
|---|---|
pending | Created, waiting for schedule time or dependency completion |
in_progress | Currently being executed by the agent |
done | Completed successfully. Result is stored in the database |
failed | Execution failed. Error is stored, dependents are cancelled |
cancelled | Cancelled (manually or due to parent failure) |
Storage
Tasks are stored in the SQLite database in two tables:
- tasks : stores task metadata (id, description, status, priority, payload, reason, timestamps, scheduled_message_id)
- task_dependencies : stores parent-child relationships between tasks (
task_id,depends_on_task_id)
No configuration file is needed. Tasks are created at runtime through the tool or admin command.
WebUI Tasks page: You can view all scheduled tasks, their statuses, and dependency chains at /tasks in the WebUI dashboard. The Tasks page also allows updating task statuses directly.
Security Limits
- Each parent task can have at most
MAX_DEPENDENTS_PER_TASKdependents to prevent DoS via mass dependency chains. - Scheduled messages must be in the future.
- Payloads are validated:
tool_callrequires atoolfield,agent_taskrequiresinstructions(min 5 characters). - Task prompts are truncated at
MAX_TOTAL_PROMPT_CHARSto prevent context overflow. - Dependent tasks are triggered with a delay between each to avoid Telegram rate limits.