# Processes

> How an AI agent runs repeatable step-by-step workflows in Klarity: process templates, runs, steps and schedules, such as client onboarding or a monthly close.

Use this for routines with several steps in order: onboarding a client, a monthly close, publishing a post. For a single task that repeats, use `set_task_recurrence` instead (`tasks` guide).

## Templates

- `list_processes` lists templates with their steps and active schedules.
- `create_process` creates one: a `name` and 1 to 50 `steps`. Each step has a `title` and can set `estimated_minutes`, `priority`, `organization_id`, `project_id`, `due_offset_days`, `due_from` (`step_start` or `process_start`) and `acceptance_criteria`.
- Add `schedule.cron_expression` (5-field cron, in the user's zone unless `timezone` is given) to run it on its own, for example `0 9 1 * *` for the 1st of each month at 09:00.
- Nothing runs until `start_process` or the schedule fires.

There is no tool to edit or archive a template. Ask the user to change it in the app.

## Runs

1. `start_process` with `process_id` starts a run and creates the first step's task. The planner schedules it like any task.
2. Completing that task advances the run: either `complete_process_step` with the `run_id`, or `update_task` with `status: done`. The next step's task is created then.
3. `skip_process_step` cancels the active step's task and moves on.
4. `cancel_process_run` stops the run and cancels its open tasks.

Read progress with `list_process_runs` (filter by `status`: `running`, `completed`, `cancelled`) and `get_process_run`, which includes each step's task.

## Pitfalls

- `complete_process_step` fails while the step's task has unchecked acceptance criteria. The tools cannot check them off: ask the user to check them in the app, or skip the step if they agree.
- Steps run one at a time. Do not create the later steps' tasks yourself.
- Give each step an estimate, or the planner books it at 30 minutes.
