How scheduled tasks work in Weft
mainScheduled tasks (Daily, Weekly, or Cron) follow a two-stage execution model to ensure safety:
- Trigger: A Durable Object alarm triggers the scheduled time.
- Read-Only Parent Agent: The parent agent runs with read-only tool access. It cannot send emails, create PRs, or modify documents. Its purpose is to analyze data (e.g., scanning an inbox) and call
create_taskto fork child tasks. - Full-Access Child Tasks: Each child task receives its own agent context with full tool access. These tasks run until they complete or require human approval for state-mutating actions.
This architecture allows agents to perform overnight analysis while ensuring that no actual changes (like sending an email) occur without human review.