Smart Meter Outage Clustering and Field Ticket Agent Script
Author an event-driven automation script for smart meter last-gasp ingestion, outage clustering, and ticket routing.
Use this template when automating electric utility incident management from AMI telemetry alerts to customer SMS notifications. It provides an end-to-end event-handling agent script with robust deduplication and tiering.
Role: Lead Utility Operations Automation Specialist with deep expertise in Advanced Metering Infrastructure (AMI) and automated incident management.
Context
- Smart Meter Broker URL: {{ami_broker_url}}
- GIS Cluster Radius (km): {{gis_clustering_radius_km}}
- Incident System Endpoint: {{incident_management_endpoint}}
- Outage Alert Confidence Score: {{outage_confidence_threshold}}
- Crew Routing Priority: {{crew_routing_tier}}
- SMS Gateway Identifier: {{sms_gateway_id}}
Task
Generate a resilient Python event-handling script for an autonomous outage triage agent that aggregates smart meter 'last-gasp' power failure signals, performs spatial clustering, validates fault confidence against weather data, generates incident tickets, and queues customer notifications.
Method
- Initialize a real-time message consumer listening on {{ami_broker_url}} for meter power-down broadcasts.
- Ingest geospatial coordinates from meter metadata and assign events into spatial buckets using a {{gis_clustering_radius_km}} radius.
- Aggregate individual meter events into consolidated transformer and feeder-level outage clusters.
- Calculate an outage confidence index based on ping retries and cluster density, comparing against {{outage_confidence_threshold}}.
- Filter out isolated momentary blips or planned maintenance windows.
- Create high-priority incident work orders via {{incident_management_endpoint}} tagged with {{crew_routing_tier}}.
- Generate localized, template-driven customer disruption alerts and forward them to {{sms_gateway_id}}.
- Track restoration telemetry to automatically close work tickets upon verified meter power-up signals.
Constraints
- MUST NOT dispatch emergency crew tickets if the calculated confidence is below {{outage_confidence_threshold}}.
- MUST rate-limit customer SMS notifications through {{sms_gateway_id}} to prevent telecommunication provider throttling.
- Implement a sliding time-window deduplication buffer of at least 300 seconds.
- Use standard logging libraries with redacted customer personally identifiable information (PII).
Output format
Provide a production-ready Python script organized into:
- Event payload schemas and spatial clustering helper functions.
- Core AMI event processor class with confidence evaluation methods.
- Incident management and SMS notification client integrations.
- Simulated mock event stream demonstrating cluster creation and ticket emission.
Self-review
- Ensure spatial clustering math correctly applies {{gis_clustering_radius_km}}.
- Validate that PII scrubbing is applied before sending logs or external webhooks.
- Confirm that meter reconnection packets trigger automated ticket reconciliation.
Explicit role, a named task, and discrete steps the model can follow.
Background, inputs and variables the model needs before it starts.
Hard boundaries — what the model must and must not do.
A named, field-level shape for the response.
Ordered work items that force analysis before an answer.
Length and structure that travel across frontier models.
Signal density — instruction weight without padding.
Documented variables so the scaffold adapts to new inputs.
Quality bar, assumptions and behaviour when inputs are thin.
How much real usage the template has behind it.