# Routines
URL: /documentation/plugin/routines



## What it does [#what-it-does]

A routine is a versioned workflow graph: a definition declares action nodes and the edges
between them, a run advances through those actions one at a time, and a receipt records what
each step actually executed. Publishing a definition and starting a run are two separate
decisions — a published routine does not run itself, and nothing here is triggered by a timer or
a file save.

`strata19.automation_run` drives a run: `start`, `get_next_action`, `submit_action_result`,
`pause`, `resume`, `cancel`, `get_receipts`, and more. `strata19.automation_author`
(`list_definitions`, `get_definition`) inspects the live registry of what is available to run —
this page covers running an already-published routine; drafting, validating, and publishing a new
one is [Author routines](/documentation/extensions/routines). `strata19.automation_approvals`
grants the durable, persisted approval a routine's `human_gate` actions require before they can
dispatch — a routine can never grant itself one.

See the [routine catalog](/documentation/reference/routines) for the current bundled list — this
page does not repeat it, so the two cannot drift apart.

## When to use it [#when-to-use-it]

Use `strata19.automation_author` (`list_definitions`/`get_definition`) to see what a routine
actually does — its declared actions and which of them are locally dispatchable — before starting
it. Use `strata19.automation_run` (`start`) once you have decided to run a specific, already
-published `workflowKey` and `version`. Use `strata19.automation_approvals` (`grant`) only when a
human has decided in advance to pre-authorize a gated step, for a driver identity other than the
one that will consume the grant.

Do not assume a routine's action names imply they all dispatch to real work — some report a
typed, honest `unsupported` outcome instead (see Limits). Do not treat a step's own claimed
`status: "success"` as proof — for a dispatcher-bound action, the engine independently
re-derives the real outcome rather than trusting the caller's claim. Do not report a run complete
from a step's return value; read `strata19.automation_run`'s `get_receipts` instead.

## How to use it [#how-to-use-it]

<Steps>
  <Step>
    Inspect what's available before starting anything. A real call against this repository returned
    one representative entry (of the [full catalog](/documentation/reference/routines)):

    ```json title="Call — strata19.automation_author"
    { "action": "list_definitions" }
    ```

    ```json title="Response (one routine, excerpted)"
    {
      "workflowKey": "routine.security-sweep",
      "name": "Security Sweep",
      "description": "Run the native taint-based security detectors and compiler-backed semantic detectors over the project. The periodic trigger surfaces a due reminder every 7 days — it never auto-runs the scan; starting it always remains an explicit action.",
      "autonomyMode": "review",
      "availability": {
        "freeLocal": true,
        "premiumRequired": false,
        "perAction": [
          { "actionKind": "run_native_security_analysis", "minimumTier": "free-local", "locallyExecutable": true }
        ]
      }
    }
    ```

    `availability.perAction` states, per action, whether it dispatches locally at the free tier — the
    honest answer, not an assumption from the routine's name.
  </Step>

  <Step>
    Start a run of a published routine:

    ```json title="Call — strata19.automation_run"
    { "action": "start", "workflowKey": "routine.security-sweep", "version": 1 }
    ```
  </Step>

  <Step>
    Advance it, one pending action at a time:

    ```json title="Call — strata19.automation_run"
    { "action": "get_next_action", "executionKey": "exec-..." }
    ```
  </Step>

  <Step>
    Grant an approval only when a gated step needs one, from a different driver identity than the one
    that will consume it:

    ```json title="Call — strata19.automation_approvals"
    {
      "action": "grant",
      "targetActorId": "driver-b",
      "actionAllowlist": ["create_commit"],
      "scope": { "kind": "branch", "value": "feat/checkout-v2" },
      "riskLevel": "low"
    }
    ```
  </Step>

  <Step>
    Pause before disconnecting, and read receipts rather than trusting a step's own claim:

    ```json title="Calls — strata19.automation_run"
    { "action": "pause", "executionKey": "exec-..." }
    { "action": "get_receipts", "executionKey": "exec-..." }
    ```
  </Step>
</Steps>

## Parameters [#parameters]

<TypeTable
  type="{
  action: {
    description: 'automation_run: start, get, get_next_action, submit_action_result, submit_human_input, pause, resume, cancel, list_resumable, list_history, get_receipts, and more.',
    type: 'string',
    required: true,
  },
  workflowKey: {
    description: 'Identifier of a previously-published routine to start. Supplied together with version; never together with definition.',
    type: 'string',
  },
  version: {
    description: 'The published version of workflowKey to start, looked up from the server-side published-version ledger.',
    type: 'number',
  },
  executionKey: {
    description: 'The run to act on — returned by start, or from list_resumable/list_history.',
    type: 'string',
  },
  input: {
    description: 'Initial input payload for the run, shaped by the workflow’s own declared inputSchema when it has one.',
    type: 'unknown',
  },
}"
/>

`strata19.automation_author` requires `action` (`list_definitions`, `get_definition`, plus the
authoring actions covered on [Author routines](/documentation/extensions/routines)) and, for
`get_definition`, a `workflowKey`. `strata19.automation_approvals` requires `action` (`grant`,
`revoke`, `list_grants`, `list_audit`) and, for `grant`, `targetActorId`, `actionAllowlist`,
`scope`, and `riskLevel` — `targetActorId` can never equal the identity issuing the grant.

## What you get back [#what-you-get-back]

`strata19.automation_author` (`list_definitions`) returns each routine's `workflowKey`, `name`,
`description`, `autonomyMode`, and `availability` (including the per-action dispatch table shown
above). `strata19.automation_run` (`start`) returns an `executionKey` to drive the run with;
`get_next_action` returns the pending step; `get_receipts` returns every receipt recorded for the
run, including a server-computed attestation (tool name, output digest, dispatch id) when the
step's action kind has a real dispatcher binding.

## Limits [#limits]

Not every declared action kind dispatches to real work. `strata19.automation_run` reports a
typed, honest `unsupported` outcome for an action kind with no local binding rather than
fabricating a result or silently no-opping — some of those have a real implementation elsewhere
that this local dispatcher cannot reach (tenant-scoped, needs network/unattended runtime, or
conflicts with the action's own declared contract), and the response's `reasonCode` says which.
A step's claimed `status: "success"` is not trusted for a dispatcher-bound action kind — the
engine re-dispatches the real tool and derives the actual outcome. Publishing a routine with an
agent-supplied approving decision is rejected outright, every time; publication is a human
decision. A periodic trigger declaration is never a background scheduler — it surfaces a due
reminder at an existing touch point (starting a routine, listing resumable runs) and never starts
anything by itself.

## Related [#related]

* [Routine catalog](/documentation/reference/routines) — the bundled definitions, by name
* [Author routines](/documentation/extensions/routines) — draft, validate, dry-run, and publish a routine
* [Work and checkpoints](/documentation/plugin/work-and-checkpoints) — the work items a routine often acts on
* [`strata19.automation_run`](/documentation/reference/tools/automation_run)
* [`strata19.automation_author`](/documentation/reference/tools/automation_author)
* [`strata19.automation_approvals`](/documentation/reference/tools/automation_approvals)
