Stage 7 · Master
Incident Response With AI
Live Incident Summarization
Real-time where are we summaries for a busy incident channel.
The Incident Channel Problem
During an active incident, the Slack channel fills with messages — hypotheses, commands, status updates, side discussions. A new responder joining the channel sees hundreds of messages and spends 20 minutes reading before they can help. A live summarization bot posts periodic updates that capture the current state.
Summarization Approach
def summarize_incident_channel(messages, include_last_n=50):
"""Generate a live summary of an incident channel."""
recent = messages[-include_last_n:]
conversation = "\n".join([
f"{m['user']}: {m['text']}" for m in recent
])
response = openai.ChatCompletion.create(
model="gpt-4-turbo",
temperature=0.2,
messages=[
{
"role": "system",
"content": """Summarize this incident channel into a structured update.
Format:
## Current Status
What is happening right now
## Timeline
Key events in chronological order
## Root Cause (if known)
Current hypothesis
## Actions Taken
What has been tried
## Next Steps
What is being done next
## Open Questions
Unresolved issues
Be concise. Focus on facts, not speculation. Distinguish known facts from hypotheses."""
},
{"role": "user", "content": conversation}
]
)
return response["choices"][0]["message"]["content"]The structured format ensures every summary covers the same key areas, making it easy for new responders to get up to speed.
Real-Time Processing
class IncidentSummarizer:
def __init__(self, channel_id, messages_per_summary=25):
self.channel_id = channel_id
self.messages_per_summary = messages_per_summary
self.message_buffer = []
self.last_summary_ts = None
def on_new_message(self, message):
"""Called for each new message in the incident channel."""
self.message_buffer.append(message)
if len(self.message_buffer) >= self.messages_per_summary:
self.generate_and_post_summary()
def generate_and_post_summary(self):
"""Generate and post a summary to the channel."""
summary = summarize_incident_channel(self.message_buffer)
post_message(
channel=self.channel_id,
text=f":robot_face: **Live Summary Update**\n\n{summary}",
thread_ts=self.last_summary_ts # Post in thread
)
self.last_summary_ts = get_last_message_ts(self.channel_id)
self.message_buffer = []Summarize every 25 messages or every 10 minutes, whichever comes first. This keeps the summary current without overwhelming the channel.
Summary Format
| Summary Type | Audience | Content |
|---|---|---|
| Technical | Responders | Commands, hypotheses, root cause |
| Status page | Customers | Impact, ETA, workaround |
| Executive | Leadership | Business impact, severity, timeline |
| Handoff | Next shift | Current state, open items, decisions needed |
Update Frequency
- During active investigation: every 10 minutes or 25 messages.
- During stabilization: every 30 minutes.
- During monitoring: every hour.
- On status change: immediately when severity or impact changes.
Pin the latest summary to the channel so new responders see it immediately. Update the pinned message with each new summary.
Mark this lesson complete to store local progress and unlock a cleaner resume path the next time you visit.