> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sreagent.app/llms.txt
> Use this file to discover all available pages before exploring further.

# Hand work to SRE Agent from a runbook step

> Use runbook steps that ask a model, investigate, request a fix, run another runbook, open a card or wait for one, and learn who each step acts as.

Six runbook step types start work that SRE Agent does itself and wait for it to end, so a fixed runbook can use the specialists without anyone writing glue between them.

Pro plan

They are part of the plan that includes [SRE Agent on cards](https://docs.sreagent.app/guides/fix/sre-agent-on-cards.md), which is Pro and up. Pick the type in **Step Type**. Each has its own fields, and none has a target type or a rollback. For the rest of the runbook builder, see [Write and run runbooks](https://docs.sreagent.app/guides/prevent/runbooks.md) and [Runbook actions and step reference](https://docs.sreagent.app/guides/prevent/runbook-actions.md).

| Step type | What it does | Fields (required first) |
| - | - | - |
| `ask_model` | Asks your organization's model one question and keeps the answer. It may declare the shape of the answer. A run asks the model five times at most. | `prompt`, `max_tokens`, `answer_type`, `choices` |
| `start_investigation` | Investigates an alert and waits for the investigation to end. With no `alert_id` it investigates the alert the run was started for. A run with no alert fails the step. | `alert_id`, `reason` |
| `request_fix` | Requests a fix pull request and waits until the request ends. Always high risk. | `description`, `service`, `repo`, `files`, `card_id` |
| `run_runbook` | Runs another approved runbook of your organization and waits until every run it started ends. Always high risk. A runbook cannot run itself or run again in the chain that started it, and a chain is two runbooks long at most. | `runbook_id` |
| `create_card` | Opens a card on the board and carries on at once. | `title`, `description`, `priority`, `labels`, `team_id` |
| `wait_for_card` | Waits for a card to be done, or with `until: closed`, done or archived. A card that is already done lets the step through at once. | `card`, `until` |

## Waiting

A step that starts work waits for it to end, up to its **Timeout**: 60 seconds to 24 hours, and an hour when a new step does not say. A step whose work does not end in time fails with the time limit sentence.

* While it waits, the run shows the step as "waiting for work to end". It holds no engine, is not a wait for a person, so the approval time limit does not apply, and is not a stuck run.
* The step is recorded as waiting before the work is asked for, under the key the request is made with. If a node is lost in the middle of the request, the next engine asks again with the same key, so the work that was started is found and never started twice. Asking a model again after a lost node is another call, so it counts toward the run's limit.
* The run carries on when the work ends, also after a deploy or a restart.
* Cancelling the run ends the step, not the work. An investigation, a fix request or a nested run already started keeps going.
* With **Continue on failure** the run goes on. Without it the run fails as for any step. A failed step that is retried starts its work again.
* If the runbook is edited so that another step stands where a waiting step was, or the runbook is deleted, the run fails with a sentence when its work ends.
* While SRE Agent is deploying an update, which takes a few minutes, the steps that wait for work (`start_investigation`, `request_fix`, `run_runbook` and `wait_for_card`) refuse to start and fail with a sentence that says so. Run the runbook again afterwards. `ask_model` and `create_card` answer at once and are not held.

## What a later step can use

A step's result is available as `{{step_N.field}}`: a card's `card_id` and `card_key`, an investigation's `investigation_id`, and a model's `answer` and `verdict`. The step's own `output` is a plain sentence.

## What cannot choose a step's target

What a step acts on is written into the runbook. The `alert_id`, `repo`, `service`, `files` and `card_id` of a fix, the `runbook_id` of a nested run, the `card` and `until` of a wait, the `team_id` and `priority` of a card, and the `max_tokens`, `answer_type` and `choices` of a question are one of two things:

* Written into the step.
* One whole reference, `{{step_N.field}}`, to an **earlier** step where a person typed the value in (an `input` step). For the card a step acts on, the reference may instead point to the key or id of a card an earlier `create_card` step opened.

Text from an alert, a model's answer, the output of other work and a command's or a check's output can never choose them. Saving the step refuses a value that is not a literal or one whole reference, a reference to a later step, and a reference to a step that is not an `input` step. **Validate** judges every step again against the runbook as it stands, a runbook cannot be approved while Validate reports an error, and the run checks the stored step once more before it asks for anything.

An input step whose answer a later step uses in one of those fields can be answered only by a person from their own session. The run page refuses the answer from a support session. Free text, such as a description, a question, a title, a reason or labels, may carry alert text, with credentials masked and the length held to the field's limit.

## A model's answer is data

An `ask_model` answer can feed a card's title or description or another prompt. It is never passed to a connector: a command, a check, a rollback or a condition that dispatches through a connector refuses `{{step_N.answer}}`, and Validate reports it as an error. A local condition cannot branch on it either.

To branch on what a model says, give the `ask_model` step an **Answer** type:

* **Yes or no.**
* **One of the words**, with up to eight single words.

The model is told to reply with exactly one of them. Any other reply fails the step, and the one word it matched is the step's `verdict`, the only part of the answer a condition may read, as `{{step_N.verdict}}`. The prompt keeps your instruction as you wrote it and shows what you interpolated, such as `{{alert.title}}` or another step's output, to the model separately, labelled as data it must not obey. Text from delegated work is cleaned of credentials before it is kept.

The question of an `ask_model` step is the purpose **Runbook model steps** under **Settings**, **AI providers**, where you can pin a model for it. One run asks the model five times at most, with a reply of 2,000 tokens at most and a prompt of 8,000 characters at most. Every call counts against your organization's monthly AI budget.

## Who the step acts as

Every way a run starts or continues records who did it, and a step acts as that person, judged at the role they hold when the step runs, and lowered by the credential's ceiling for an MCP token. The same rule applies as for the same action from a card. The person is, in order:

1. The person who approved the step.
2. Otherwise, the person who pressed **Resume from failure**.
3. Otherwise, the person who approved the run.
4. Otherwise, for a run another runbook started, whoever acted for that run.
5. Otherwise, the person who started it.

The **Run** button, **Retry**, **Resume**, the Slack modal and assistant, and MCP `run_runbook` with a personal token each record their person. A person who left or was demoted refuses the step with a sentence. A member who may not request fixes, where your organization lets only administrators, is refused a `request_fix` step. Where the nearest of those people is a support session acting as someone, the step hands nothing to SRE Agent and fails with a sentence until a person approves the run or the step, or presses **Resume**, from their own session.

### A run with nobody behind it

A run with nobody on record, such as an alert or a schedule with approval mode **Nobody**, self-healing, or an API key over MCP, acts as SRE Agent. It is held to what the [alert door](https://docs.sreagent.app/guides/fix/sre-agent-on-alerts.md) holds its own run to.

* `request_fix` and `run_runbook` run only when your organization switched on unattended work for alerts, the matching self-healing entry would run unattended now for the alert's service, a fix names a repository linked to that service, and a nested runbook is one the playbook would match to the alert. Self-healing's own limits apply. With no alert, such as a schedule, neither runs.
* `create_card` is refused to it, because a card for someone else needs a person who started or approved the run.
* Asking a question, investigating and waiting for a card are open to it.
* A fix such a run requests is recorded as asked by a runbook, never as a person's request, so it is not merged automatically for that reason.

**Validate** warns about a `request_fix` or `run_runbook` step in a runbook that runs on a schedule with approval mode **Nobody**, and about a `create_card` step in any runbook that nobody starts or approves, because those steps are refused every time there. The platform's pause and your organization's self-healing pause stop every step. The runbook's approval mode, high-risk steps, deploy freeze hold and rollback rules apply as they do to any step.

## What cannot be undone

A step of these types takes no rollback. A rollback of a failed run undoes the connector steps that have one and leaves what these steps started. A dry run stops before any of them and says what it would do, except `wait_for_card`, which reads the card and carries on.

The runbook suggester never proposes these types.

## Related

* [Write and run runbooks](https://docs.sreagent.app/guides/prevent/runbooks.md): the builder, approvals and triggers.
* [Runbook actions and step reference](https://docs.sreagent.app/guides/prevent/runbook-actions.md): templates, fan-out and verifying a step.
* [Let SRE Agent handle alerts](https://docs.sreagent.app/guides/fix/sre-agent-on-alerts.md): the rules an unattended run keeps.
* [Give a card to SRE Agent](https://docs.sreagent.app/guides/fix/sre-agent-on-cards.md): the cards these steps open.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.