Expand description
schedules + tasks_runs + tasks_logs — the agents tasks {schedule, list, run} storage tier.
Per-schedule payload: an argv vector to invoke on each scheduled
poll, the minimum interval between invocations in seconds, and a
JSON snapshot of the caller’s AgentArguments so the runner can
re-install identity env vars at fire-time.
Schedule rows are NEVER deleted. Versions are separate rows (-- overwrite inserts version = max+1, shadowing the older rows);
run history is one tasks_runs row per firing (written atomically
by claim_pending’s claim query); each item a fired task emits
is one tasks_logs row linked to its run.
Structs§
- Listed
Schedule - One row from
schedulesas surfaced byagents tasks list.commandis decoded from its JSON-string column. - RunRow
- Subset of a schedule row that
agents tasks runneeds to fire one task, plus the id of thetasks_runsrow the claim minted for this firing (the log writer links every emitted item to it).
Functions§
- claim_
pending - Atomically claim every pending schedule in
parent’s subtree (its own AIH or any descendant): ONE statement both selects the eligible rows and inserts theirtasks_runsrows, so each returnedRunRowcarries the freshly-mintedrun_id. Schedules are never updated or deleted by a run — exhaustion is purely “has a run” (oneshots) / “newest run too recent” (recurring), and only the newest version of each (name, aih) is eligible. - insert_
schedule - Insert one schedule row and return its
(id, version). - insert_
task_ log - Append one emitted item to a run’s log.
valueis the serializedtasks::run::ResponseItemexactly as it crossed the wire. - list_
schedules - List
schedulesmatching the supplied filters. Only the newest version of each(name, aih)is visible; readiness derives from each row’s newesttasks_runsentry. Every filter is optional and composes additively — the SQL is one statement that gates each predicate on whether the corresponding bind is active (0 = inactive bool flag,NULL= unset after_id/count).