Skip to main content

How I Built IRAS: An AI Incident Response Agent That Pauses Before Touching Production

Incident response is one of those engineering workflows where the painful part is not always the fix.

The painful part is the investigation.

An alert fires. Someone opens the dashboard. Then the same loop begins:

Check severity Check affected service Check logs Check metrics Check recent deployments Form a root-cause hypothesis Write an update Create a remediation plan Wait for approval Apply the fix Write the post-mortem

That workflow has a lot of repeated structure.

So I built IRAS — an open-source AI incident response agent designed to automate the investigation and planning layers of incident response while keeping a human in control before any production remediation runs.

The goal is not:

“Let AI blindly fix production.”

The goal is:

“Let AI gather context, reason through the incident, propose a safe plan, and pause for human approval.”

That distinction matters.

What IRAS Does

IRAS is an autonomous incident response workflow built around a graph-based architecture.

At a high level, the workflow looks like this:

Alert → Triage → Context Gathering → Root Cause Analysis → Remediation Plan → Human Approval → Apply or Escalate → Post-mortem

The implementation uses:

FastAPI for alert ingestion and approval APIs LangGraph for workflow orchestration Pydantic AI for structured agent outputs Claude for triage, RCA, and remediation reasoning PostgreSQL for durable checkpointing Slack / PagerDuty / Prometheus / Loki-style integrations Pytest for unit, integration, e2e, and stress tests

The repo currently includes source code, tests, Docker files, compose config, and environment examples.

Why I Did Not Build This as One Big Prompt

A lot of AI automation projects start as:

“Here is an alert. Find the issue and fix it.”

That is not enough for incident response.

Incident response needs state.

It needs branching.

It needs retries.

It needs escalation.

It needs human approval.

It needs rollback behavior.

That is why IRAS is implemented as a graph instead of a single prompt chain.

A simplified version of the workflow is:

Alert → Triage → Context → RCA → Plan → [Human Approval] → Apply → Post-mortem ↑ └── retry if confidence is too low

The actual project describes the system as a 9-node LangGraph state machine where every stage produces a typed Pydantic model instead of raw unstructured text.

That makes the system easier to test, debug, and control.

The Safety Rule: Do Not Trust the Model

The most important design decision in IRAS is simple:

The model can recommend. The system decides what is allowed.

For example, an AI model may produce a remediation plan, but the application still needs hard rules like:

if step.risk_level == "high": plan.requires_human_approval = True

if not step.rollback_command: plan.requires_human_approval = True plan.reversible = False

This is the difference between prompt-level safety and system-level safety.

Prompt-level safety says:

“Please do not do anything dangerous.”

System-level safety says:

“You cannot execute this class of action without approval.”

For production automation, I trust the second one much more.

Human Approval Is a First-Class Node

The approval step is not just a message in Slack.

It is part of the workflow.

IRAS uses LangGraph’s interrupt pattern so the graph can pause, save state, and resume after approval.

Conceptually:

human_decision = interrupt({ "message": "Approve remediation plan?" })

if human_decision["approved"]: return apply_remediation(state)

return escalate(state)

The important part is durability.

The graph pauses. The incident state is stored. The server can restart. The approval can still resume from the same point.

The IRAS README describes this as a durable approval checkpoint backed by PostgreSQL, where the workflow can resume after a server restart or process crash.

That pattern is extremely useful for any production-grade AI agent.

Alert Ingestion

IRAS accepts alert payloads through a FastAPI webhook.

Example:

curl -X POST http://localhost:8000/webhook/alert
-H "Content-Type: application/json"
-d '{ "title": "High error rate on payment-service", "timestamp": "2026-05-03T10:30:00Z", "service": "payment-service", "error_rate": 0.45 }'

The response returns an incident ID:

{ "incident_id": "550e8400-...", "status": "processing" }

From there, the graph begins running.

IRAS supports alert sources such as PagerDuty, Prometheus AlertManager, Datadog/Grafana-style sources, or any JSON webhook.

Context Gathering

The context-gathering stage is where the agent starts behaving like a real incident assistant.

It does not just guess.

It pulls evidence from multiple places:

Logs Metrics Recent deployments Service metadata Previous incident state

The repo describes tool calls for logs from Elasticsearch or Loki, metrics from Prometheus, and deployment data from GitHub Deployments.

That evidence becomes the input for root-cause analysis.

This is important because RCA without evidence is just storytelling.

Root Cause Analysis With Confidence Gates

The RCA node produces a structured hypothesis.

A useful RCA result should include:

Primary cause Contributing factors Evidence Affected services Confidence score

If the confidence is too low, the workflow should not pretend to know the answer.

It should gather more context.

That is why IRAS uses a confidence gate:

If RCA confidence < threshold: gather more context

If max RCA attempts reached: escalate

The project uses a retry path when confidence is below 0.7, and escalates after the configured maximum attempts.

This is one of the most important production patterns for agentic systems:

Uncertainty should create control flow, not fake confidence.

Remediation Planning

Once the system has a root-cause hypothesis, it generates a remediation plan.

A good remediation plan should include:

Step-by-step action Expected impact Risk level Rollback command Estimated duration Required approval

The rollback command is especially important.

If an AI system proposes a production action and cannot explain how to reverse it, that action should be treated as unsafe.

IRAS models remediation as ordered steps with risk levels, estimated durations, and rollback commands.

This gives the human reviewer something concrete to approve or reject.

Escalation Logic

Not every incident should be handled by the agent.

Some incidents should escalate.

IRAS escalates when:

RCA confidence never reaches the threshold Human rejects the plan Approval timeout expires

The README defines severity classes from P0 to P3 and includes escalation behavior through PagerDuty and Slack-style notifications.

This is another key production principle:

A good AI agent must know when to stop being autonomous.

Post-Mortem Generation

After the workflow finishes, IRAS generates a post-mortem.

This is not just a nice extra feature.

Post-mortems are usually the part engineers delay because the incident is already over and everyone wants to move on.

But the system already has the structured timeline:

When the alert started What service was affected What evidence was collected What RCA hypothesis was generated What plan was proposed Whether it was approved or rejected What action was taken Whether remediation succeeded

That makes post-mortem generation a natural final node in the graph.

Even if an incident escalates, IRAS still generates a post-mortem record.

Project Structure

The repo is organized around graph nodes, agents, models, tools, and tests.

A simplified structure:

src/iras/ graph/ nodes/ ingestion.py triage.py context_gathering.py rca.py generate_plan.py approval.py apply_remediation.py escalation.py postmortem.py

agents/ one Pydantic AI agent per stage

models/ TriageResult ContextBundle RootCauseHypothesis RemediationPlan RemediationStep PostMortem

tools/ Elasticsearch Loki Prometheus GitHub Slack PagerDuty

tests/ unit/ integration/ e2e/ stress/

The repository documents these major directories and includes stress tests for adversarial and real-world scenarios.

What I Learned Building It

  1. Agent workflows need hard boundaries

The model should not own the entire workflow.

The system should define what happens when:

confidence is low tools fail approval is rejected rollback is missing execution fails 2. Human-in-the-loop should be durable

A human approval gate is not useful if the workflow loses state during a restart.

For production-grade systems, approval should be part of the state machine.

  1. Structured outputs matter

Raw LLM text is fragile.

Typed outputs make the graph easier to test and safer to automate.

  1. Escalation is a feature, not a failure

An agent that escalates correctly is better than an agent that confidently guesses.

  1. The post-mortem should be generated from state

If the graph stores every decision and transition, the post-mortem becomes much easier to generate accurately.

What IRAS Is Not

IRAS is not a magic production fixer.

It does not guarantee that every incident will be resolved automatically.

It does not remove the need for on-call engineers.

It is better understood as an autonomous incident assistant that handles the repetitive investigation and documentation layers while preserving human control over production changes.

Current limitations include:

RCA quality depends on the available logs and metrics. Alert payloads still need enough useful context. Remediation plans should be reviewed carefully. Real production deployment needs strong auth, secrets management, network security, and approval auditing. Every organization needs custom runbooks and guardrails.

That is intentional.

For incident response, safety is more important than speed.

Quick Start

The repo can be run locally with Docker and Python.

Basic flow:

git clone cd IRAS

docker run -d --name iras-postgres
-e POSTGRES_USER=iras
-e POSTGRES_PASSWORD=secret
-e POSTGRES_DB=iras
-p 5432:5432 postgres:16

python -m venv .venv source .venv/bin/activate

pip install -e ".[dev]"

Then fire a test alert:

curl -X POST http://localhost:8000/webhook/alert
-H "Content-Type: application/json"
-d '{ "title": "High error rate on payment-service", "timestamp": "2026-05-03T10:30:00Z", "service": "payment-service", "error_rate": 0.45 }'

The project README includes a quick-start example with Postgres, local install steps, and a sample alert request.

Final Thought

The future of AI in DevOps is not fully autonomous agents doing whatever they want in production.

The future is controlled autonomy.

AI should help engineers move faster by doing the repetitive work:

triage context gathering RCA planning documentation

But production changes still need guardrails.

That is the philosophy behind IRAS:

Let the agent investigate. Let the system enforce safety. Let the human approve the action.

I open-sourced IRAS so other engineers can inspect the architecture, break it, improve it, and adapt it to their own incident response workflows.

Repo: https://github.com/krishnashakula/IRAS

If you want feedback, contributions, or architecture suggestions, feel free to open an issue or PR. I’m especially interested in ideas around Slack approvals, Datadog integrations, production auth, stronger rollback handling, and long-term incident memory.