Scheduled jobs (crons)
Project admins; built-in jobs for the Architect. Crons (/crons) lists the jobs that run on a schedule: your project's own, and AI Putty's built-in ones.
Your project's crons
Your own crons are declared by a flow, usually the init page, with diesel.cron. For example, to refresh prices at 7:00 on weekdays, Toronto time:
$when diesel.project.on.init {
diesel.cron(name = "morning-prices", schedule = "0 7 * * 1-5", tz = "America/Toronto", msg = "portfolio.refresh")
}
- Schedules: a 5-field cron (
0 7 * * 1-5),every 15m,hourlyordaily 03:15, in UTC unlesstznames a time zone. - Kept in step with the init page: a cron the init page made is removed when the page no longer declares it (after an init that ends well); each cron shows where it came from, and the top of the page when the init page last kept them in step. More: the init page.
- On the page, admins turn a cron on or off, or Run now to try it without waiting.
- Limits: how many crons a project may have, and how often they may run, depend on its plan (Admin → Quotas).
+ New scheduled job
Project admins. + New scheduled job, under the list on Crons, adds a cron without writing a flow by hand. There are two ways.
Ask your agent. Say what should run, and when, in plain words in the Ask your designer box, and pick who gets it: your designer or your assistant. For example: "Every night at 2 AM Toronto time, start a designer for the daily design review." It goes to that agent's chat (the one open beside you if it is that role's, else your newest chat with it), and the agent writes the cron for you.
Or fill in the form:
- Name: lowercase letters, digits and dashes (
daily-design-review). - When: Every day at, Weekdays at, Every week on a day, Every hour, Every few minutes (5, 15 or 30), or Custom in cron syntax (5 fields: minute hour day month weekday). The line beside it shows the schedule it makes.
- Time zone: yours to start with; any time zone name (
America/Toronto,Europe/London). - It: what happens when it runs:
- starts an agent: the Role (designer, manager, tester, ops, guardian, assistant, monitor) and what it starts To do (a start kind such as dailyreview, each a prompt on Hot rules › Start prompts);
- asks your agent to do a job: the Role, then A known job (the jobs that role already knows, from its job skill; edit jobs opens Role jobs) or the job in your own words;
- sends a message to the rules: a message your project's flows handle (
portfolio.refresh).
The preview under the form shows exactly what it will add: the diesel.cron(...) line and, for an agent or a job, the rule it runs. Create writes it into your project's Settings:Init and publishes it; the cron starts with the next run of that page and then shows in the list.
Examples:
- A nightly design review: Every day at 02:00, starts an agent, designer, dailyreview.
- A weekday morning task for your assistant: Weekdays at 07:00, asks your agent to do a job, assistant, your own job from its skill.
Built-in jobs
d2's own jobs: the audit, chatbox and history archives, status sampling, the agents' heartbeat, and the payment and token sweeps. Only the Architect sees them, from any project. They can be switched off or run now, but never removed.
See what a job did
Open a job to see every run of the last 7 days: when it ran, whether on schedule or by whom, how long it took, the result, and what it did (counts, files written, or the error). Older runs are dropped.
- "Did last night's archive run?" Open the history archive job and check the newest run's result.
- "Why are my prices stale?" Open your cron: if its last runs failed, the error is on each run.
When a job fails
A failed run shows in the job's runs and in the audit log. A cron of yours that fails 5 times in a row is switched off, and its owner gets a notice. Fix the flow, then turn the cron back on.
Related
- Role jobs: the jobs each agent role can be asked to do (the page)
- Hot rules and start prompts (the page)
- The init page, Working with AI agents, how agents are started, the audit log