Artificial IntelligenceAnthropicProjects

Build an AI Incident Report Generator with Claude API

TT
TopicTrick
Build an AI Incident Report Generator with Claude API

Manual incident reporting is one of IT's most error-prone, time-consuming tasks. Under pressure during an active outage, engineers write inconsistent notes, forget key fields, and delay formal documentation until hours after resolution. That gap means lost data, missed patterns, and failed audits.

What Will You Build?

This project builds a complete incident report generator using Claude's tool use API. Paste in raw incident notes — chaotic, time-pressured engineer text — and receive a fully structured, professional report with severity classification, timeline, root cause analysis, and actionable follow-up steps, ready for your ITSM ticketing system in under five seconds.

Claude can generate a complete, structured incident report from raw notes in under five seconds. It classifies severity, extracts the timeline, identifies root causes, suggests remediation steps, and formats everything to your organisation's template — consistently, every time.

This project builds a complete incident report generator: paste in raw incident notes and receive a professional, structured report ready for your ITSM ticketing system.


Schema and Tool Design

The heart of this system is a structured output tool that forces Claude to produce every required incident field, never leaving a section blank.

python

Why Tool Use for Structured Reports?

Using tool_choice forces Claude to populate every required field, which a free-text prompt cannot guarantee. With tool use, if Claude cannot determine a value, it uses a defined fallback like 'Under investigation' rather than skipping the field entirely. This is essential for audit-trail integrity and ITSM integration where missing fields cause import failures.


    Report Generation Engine

    python

    Pipeline and Demo

    python

    Integrate with Your ITSM Ticketing System

    Most ITSM platforms (Jira Service Management, ServiceNow, PagerDuty, Opsgenie) have REST APIs that accept structured JSON. Export the report dict and POST it directly to your ticketing system to auto-populate all fields, attach it to an existing alert ticket, or create a new post-mortem task — saving engineers 30-60 minutes of manual data entry after every incident.


      Severity Classification Logic

      Claude classifies severity using its reasoning on the notes, but you can reinforce the rules in the system prompt:

      • P1 – Critical: Complete service outage, data breach, or full unavailability of a business-critical system affecting all or most users
      • P2 – High: Major feature unavailable, more than 20% of users affected, significant revenue or compliance impact, or SLA breach imminent
      • P3 – Medium: Partial degradation, workaround available, limited subset of users affected
      • P4 – Low: Cosmetic issue, documentation error, no functional user impact

      Human Review is Mandatory

      This system generates reports as a starting point — a human engineer must review and approve before submitting to leadership or external stakeholders. Claude works from notes; if notes are incomplete or inaccurate, the report will reflect that. The goal is to eliminate blank-page paralysis and ensure no field is forgotten, not to replace engineering judgment.


        Summary

        This incident report generator solves a real operational pain point: turning raw, chaotic incident notes into professional, consistent, structured documentation in under ten seconds.

        • The tool use schema guarantees every required field is populated — no missing root cause, no blank follow-up actions
        • Severity and type classification are handled automatically, removing debate about severity during triage
        • JSON export enables direct integration with Jira, ServiceNow, or any ITSM with a REST API
        • The system is additive, not authoritative — it accelerates reporting, engineers provide oversight

        Next IT pro project: Project: Build a Data Analyst Agent — CSV Insights in Plain English.

        For the underlying concepts behind this project, see Claude Structured Outputs and JSON and Claude Tool Use Explained. To learn how to handle large document attachments (incident logs, postmortem files), see Claude Files API Tutorial.

        External Resources


        This post is part of the Anthropic AI Tutorial Series. Previous post: Project: Build a RAG App with Claude — Query Your Own Documents.