Create a routine
routines_createCreate a routine: something you keep doing for the user on a schedule, one turn per run ("every morning, read these forums, add new questions to the Questions table, and post the count in #support"). Each run has full workspace context and your machine where the workspace has machines. Use a routine when nobody but you acts on each run. Use a Task instead (workbench_tasks_create) when a person acts on each item before anything else happens, or the work is a process mapped in Compass. Name in writes the tools each run writes with on its own; other writes wait for approval on every run. A site read_webpage can't get needs routines_set_sites after this. Write the instruction in second person, as a directive to you on a future run. To run a specific built Workbench flow on a schedule, use workbench_flows_schedule instead: a routine runs an instruction, not a flow.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | Short display name. | |
| roomId | No | With delivery "room": the room to post in (rooms_list gives ids). | |
| writes | No | Tools each run writes with on its own, without asking: the ones the job needs every time, like ["napkin_tables_add_records"]. The person approves this list once, with this call. Any other write waits for approval on every run, and emails, invites, shares, publishing, schedules, deletes and starting other work always wait, even when listed. | |
| actsFor | No | Visibility: "workspace" (everyone sees it) or "personal" (just the owner). Default workspace. | |
| delivery | No | Where each run's briefing lands (default notification). "room" posts it in a team room for everyone there; pass roomId. The user must be in the room if it's private, and a "personal" routine can post only in a private room. Use it when the user names a room ("…and post it in #claims") or asks from inside one for the room. | |
| interval | No | Plain cadence. Omit when passing recurrence. | |
| workspace | No | Workspace slug. Personal tokens with no default workspace MUST pass this; tokens with a default can override per call. Ignored for workspace API keys. | |
| approvalId | No | Approval id from a prior needs_confirmation envelope. | |
| recurrence | No | When it runs, like a calendar event repeats; use it for anything beyond a plain hourly/daily/weekly at one time (then omit interval). {"freq":"hourly"|"daily"|"weekly"|"monthly"|"yearly","every":N,"times":["HH:MM"],"weekdays":[0=Sun…6=Sat],"monthDays":[1…31,-1=last],"nthWeekdays":[{"nth":1…5|-1,"weekdays":[…]}],"months":[1…12],"minutes":[…],"hours":{"from","to"},"timezone":"<IANA>","starts","ends","skip":["YYYY-MM-DD"]}. Examples: weekdays at 8 → {"freq":"weekly","weekdays":[1,2,3,4,5],"times":["08:00"],"timezone":"America/Chicago"}; the last business day of the month → {"freq":"monthly","nthWeekdays":[{"nth":-1,"weekdays":[1,2,3,4,5]}],"timezone":"…"}; every other Friday → {"freq":"weekly","every":2,"weekdays":[5],"starts":"<a Friday>","timezone":"…"}. null clears it. | |
| instruction | Yes | What to do on each run, as a directive. | |
| scheduleTime | No | Wall-clock "HH:MM" anchor (default 09:00). | |
| scheduleTimezone | No | IANA timezone for the anchor (default UTC). | |
| scheduleDayOfWeek | No | Weekly only: 0=Sunday … 6=Saturday (default Monday). |