# Investigate incidents automatically with AI SRE

The AI SRE integration investigates incidents for you. It goes through your logs, metrics, traces, and errors, then posts the likely root cause and next steps to the incident timeline and Slack.

## Investigate every new incident

1. Go to **Incidents** → [Integrations](https://incidents.betterstack.com/team/0/integrations).
2. Click your **AI SRE** integration. Without one, click **Add** next to **AI SRE**.
3. Under **Run AI SRE automatically**, turn on **Investigate new incidents automatically with AI SRE**.
4. Click **Save changes**, or **Create AI SRE integration** for a new one.

AI SRE now starts investigating as soon as an incident opens. Investigations are billed by usage, so this can get expensive if you have many incidents.

To open the investigation, click **View in AI SRE** at the top of the incident and ask follow-up questions in the chat.

## Investigate only some incidents

Add AI SRE to an escalation policy to investigate only the incidents that policy handles, for example only your production services:

1. Go to [Escalation policies](https://incidents.betterstack.com/team/0/policies).
2. Open the policy.
3. In a step's **Who should we alert?**, select your AI SRE integration.
4. Click **Save changes**.

AI SRE starts investigating when the incident reaches that step.

## Tell AI SRE what to do

Pick a pre-made prompt above the **AI SRE prompt** editor:

-   **Investigate root cause** finds what's broken and why, with the evidence and the fastest safe mitigation. This is the default.
-   **Triage and escalate** judges how severe the incident is and escalates it to the escalation policy that fits. Under **Allowed tools**, search for **Escalate incident** and tick it, so it can escalate on its own.
-   **Fix with a pull request** finds the root cause and opens a pull request when the fix is small and safe. Connect [GitHub](https://betterstack.com/docs/ai-sre/integrations/github/), then under **Allowed tools**, search for **Create pull request** and tick it.

Edit the prompt to fit your team. Click a variable under **Variables**, such as `{{cause}}` or `{{monitor_url}}`, to copy it, then paste it into the prompt.

## Choose the tools AI SRE can use

Under **Allowed tools**, tick the tools you approve in advance for investigations AI SRE runs on its own. It uses the others only once a team member writes in the chat.

New integrations start with **All read-only tools**, which is enough for root cause analysis.

## Use different prompts for different incidents

Click **Add another** next to **AI SRE** in [Integrations](https://incidents.betterstack.com/team/0/integrations) to create more integrations, each with its own prompt and tools. Add each one to the escalation policies it should handle, for example **Triage and escalate** for your [alert screening policy](https://betterstack.com/docs/uptime/incidents/screening-alerts/) and **Investigate root cause** for production.

When an incident's escalation policy includes a different AI SRE integration than the one investigating every new incident, the one in the policy investigates it instead.

[info]
#### Which integration runs when someone clicks Use AI SRE?
**Use AI SRE** at the top of an incident investigates with the AI SRE integration in the incident's escalation policy. Without one, the **Primary** integration investigates. Make another integration primary from the `⋯` menu next to it.
[/info]
