Schedules
Scheduled Runs
Schedules let you trigger workflows or events on a cron expression. Hivemind evaluates schedules every minute.
Creating a Schedule
MCP Tool:
hivemind_schedule(action: "create", name: "Daily Status Report", cron_expression: "0 9 * * 1-5", action_type: "emit_event", emit_channel: "reporting", emit_event_type: "schedule.daily-report")
TypeScript SDK:
const { scheduleId } = await client.createSchedule({
name: "Daily Status Report",
cron_expression: "0 9 * * 1-5",
action: {
type: "emit_event",
emitChannel: "reporting",
emitEventType: "schedule.daily-report"
}
});
REST API:
curl -X POST https://your-site.convex.site/v1/schedules \
-H "Authorization: Bearer hm_live_xxx" \
-d '{
"name": "Daily Status Report",
"cron_expression": "0 9 * * 1-5",
"action": {
"type": "emit_event",
"emitChannel": "reporting",
"emitEventType": "schedule.daily-report"
}
}'
To schedule a workflow run:
hivemind_schedule(action: "create", name: "Nightly Pipeline", cron_expression: "0 2 * * *", action_type: "run_workflow", workflow_id: "wf_xxx")
Cron Expression Format
Standard 5-field cron: minute hour day-of-month month day-of-week
| Expression | Meaning |
|---|---|
* * * * * | Every minute |
0 9 * * 1-5 | 9:00 AM UTC weekdays |
*/15 * * * * | Every 15 minutes |
0 0 1 * * | Midnight on the 1st of each month |
Action Types
- emit_event: Publishes an event to a channel
- run_workflow: Starts a workflow run (requires
workflowId)
Managing Schedules
MCP: hivemind_schedule(action: "list"), hivemind_schedule(action: "toggle", schedule_id: "sch_xxx", active: false)
SDK: await client.listSchedules(), await client.updateSchedule("sch_xxx", { active: false })
API Reference
GET /v1/schedules # List all schedules
POST /v1/schedules # Create schedule
PATCH /v1/schedules/:id # Update (toggle active, edit cron)
DELETE /v1/schedules/:id # Delete schedule