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

# Run the incident.io agent

> Hand a task to our agent and use its results in the steps that follow.

> [!NOTE]
>
> **This is a beta feature and details may change.**

**Run the incident.io agent** passes a task to our agent from inside a workflow. The agent can look across your incidents, alerts, catalog, on-call schedules, telemetry and code to answer a question, and also take actions itself, such as updating an incident or escalating to someone. Later steps can use any results it returns.

Use it for jobs that need judgement rather than a fixed rule. For example:

* Summarize what's known about a new incident and post it to the incident channel.
* Check recent deploys for the affected service and report anything suspicious.
* Decide whether an incident looks like a duplicate, and return the result for a **Continue if** step to act on.

## Write a prompt

Tell the agent what to find out or do, and what you want back.

Insert variables from the trigger, such as the incident's name or the alert's title, so the agent starts with the right context. It already knows which incident or alert started the workflow, so it can look up anything else it needs.

![The Run the incident.io agent step with a prompt that includes the incident name as a variable](https://mintcdn.com/incidentio-18bb4170/pzhVxzwXaRwFlaAZ/images/workflows/agent-step/prompt-step.png?fit=max\&auto=format\&n=pzhVxzwXaRwFlaAZ\&q=85\&s=414e898fe09f02d73926fa976e449ab6)

> [!TIP]
>
> Be specific about the output. "Reply with a one-line summary" or "Return a JSON object with a `likely_cause` field"
> gives later steps something reliable to work with.

## Use the result in later steps

The step returns:

* **Answer:** the agent's reply, as formatted text. It's always returned.
* **Data:** JSON, returned when your prompt asks for it. Describe the fields you want, and use an [expression](https://docs.incident.io/workflows/expressions.md) to pick one out, such as `$.likely_cause`.

To use **Answer**, open the variable picker in a later step's message or text field and choose it from the **Steps** section. For example, post it to the incident channel with **Send message to a channel**.

### Use a field from Data

To use a field from **Data**, pull it out with an [expression](https://docs.incident.io/workflows/expressions.md). For example, if your prompt asks the agent to return `{"severity": "..."}`:

**1. Create a Query expression**

In a later step, open the variable picker and click **Add new expression**, then choose **Query**.

![The Create expression dialog with the If... else... and Query options](https://mintcdn.com/incidentio-18bb4170/pzhVxzwXaRwFlaAZ/images/workflows/agent-step/data-query.png?fit=max\&auto=format\&n=pzhVxzwXaRwFlaAZ\&q=85\&s=604fb32cde66a3f75a9468b44420d11c)

**2. Query the agent step's Data**

Under **What would you like to query?**, go to **Steps**, choose your agent step, then choose **Data**.

![The variable picker open on the agent step, with Answer and Data to choose from](https://mintcdn.com/incidentio-18bb4170/pzhVxzwXaRwFlaAZ/images/workflows/agent-step/data-choose-data.png?fit=max\&auto=format\&n=pzhVxzwXaRwFlaAZ\&q=85\&s=988e45c1457cd7cd0475db1e9120b3fc)

**3. Add a Parse operation**

Click **Then...** and choose **Parse**.

![The Then... menu with Continue if, Merge and Parse](https://mintcdn.com/incidentio-18bb4170/pzhVxzwXaRwFlaAZ/images/workflows/agent-step/data-add-parse.png?fit=max\&auto=format\&n=pzhVxzwXaRwFlaAZ\&q=85\&s=b3829f890197b51c94d4519340c4968e)

**4. Pick the field and its type**

Enter the path to the field, such as `$.severity`, and choose the type to parse it into, such as **String**.

![A Parse operation that extracts \$.severity and parses it as a String](https://mintcdn.com/incidentio-18bb4170/pzhVxzwXaRwFlaAZ/images/workflows/agent-step/data-parse-field.png?fit=max\&auto=format\&n=pzhVxzwXaRwFlaAZ\&q=85\&s=37cb1eb4837b49c23ad58dc4606328bf)

**5. Name and save the expression**

Give the expression a name and save it. You can now use it in later steps, for example to post the value to a channel or in a condition.

To act on the agent's decision, ask it to return a field such as `{"is_duplicate": true}` and parse it as a **Bool**. Then add a [Continue if](https://docs.incident.io/workflows/getting-started.md#steps-what-should-happen-when-the-workflow-runs) step that uses the expression. When it's false, the remaining steps are skipped.

## What the agent can do

The agent runs with the same default permissions as other workflow steps. It can:

* Investigate: view incidents, alerts, escalations, catalog entries, on-call schedules, maintenance windows, status pages, telemetry, code analysis and knowledge base documents.
* Update incidents: change the name, summary, severity, type, status, custom fields, timestamps and role assignments, share updates and add attachments.
* Change incident state: decline, merge or cancel incidents.
* Escalate and communicate: create escalations and streams.
* Follow-ups and actions: create and update follow-ups, and create actions.
* Post-incident documents: create, update and export them, and change their status.

Actions take effect straight away, so write prompts that say what the agent should and shouldn't change. To see the full list, open the step and click **View** next to **Workflow agents use default permissions**.

## Running time and test runs

Each agent step runs for up to five minutes. If it hasn't finished by then, the step fails, and the workflow follows its usual setting for failed steps.

When you test a workflow from the editor, the agent step doesn't run the agent. It returns a sample **Answer** and **Data** that match your prompt, so you can check how later steps use them.

## FAQs

> [accordion] Who can use the agent step?
>
> The step is available to organizations with AI features enabled. Admins manage these in [Settings → AI
> governance](https://app.incident.io/~/settings/ai-governance).

> [accordion] Does the agent step work with private incidents?
>
> Only if your organization has opted in to AI features for private incidents and alerts, in [Settings → AI
> governance](https://app.incident.io/~/settings/ai-governance#ai-incident-access). Without that, the step fails on
> private incidents and escalations, and the workflow run shows why.

> [accordion] Can I change which permissions the agent has?
>
> Every agent step uses the default workflow permissions listed in [What the agent can do](#what-the-agent-can-do).
