Automation π‘ BETA
Automation runs BASIC work on a schedule or in response to a system event, using the cron-backed automation feature and the botautomation / botautotask crates.
Automation Fundamentals
SET SCHEDULE registers a recurring job; ON EMAIL and the other ON keywords register event handlers. Scheduled and event work is compiled from .bas scripts in the bot's .gbdialog/ folder.
| Trigger | Keyword | Backing code |
|---|---|---|
| Recurring job | SET SCHEDULE |
cron in the automation feature |
| Incoming email | ON EMAIL |
BASIC keyword tree |
| Table change | ON UPDATE OF |
BASIC keyword tree |
| AI-generated task | task handlers | botautotask |
Scheduling Tasks with SET SCHEDULE
A schedule names the script to run and the interval or cron expression. The registered job compiles the script and executes it in the bot's own scope; see the keyword reference.
Event-Driven Automation
ON handlers run when the matching event occurs in the bot session. They are registered alongside the bot's other compiled scripts.
The System Automations Table
botautomation and botautotask own task state: classification, compilation, execution and approval routes live under /api/autotask/* in botautotask/src/api.rs. Task state is visible through those routes and the Automations app.
Automation Lifecycle Management
- Write the tool or handler in the bot's repository.
- The Drive monitor materialises it into the work directory and compiles it.
- Register the schedule or event with the matching keyword.
- Observe runs through task state and client logs.
Monitoring Automated Tasks
The app logs routes (/api/app-logs*) record execution output. Failures are surfaced through normal task state rather than a separate automation log store.
Security Considerations
Automation runs with the bot's permissions. Scripts in a git-owned bot must be committed to the bot's ALM repository; edits made straight in Drive are archived by the sync pass.
Limits
- No hardcoded schedule interval is documented here; the expression is supplied by the script.
- A tool must be compiled and available before a schedule or event can call it.
- Git-owned scripts cannot be maintained by editing Drive copies.
Related
- Chapter overview - Index of this chapter.
See Also
- SET SCHEDULE Keyword - Scheduling syntax
- Task Workflow - AI-generated tasks
- Automations app - UI surface