← All examples
AlertRouting
examples/AlertRouting.intent
AlertRouting.intent
1mission AlertRouting2use product3use delivery45title "Route incident alerts to on-call and escalate the unacknowledged"6for OnCallEngineer78goal9 Get every incident to someone who can act, and escalate before it is forgotten.1011guarantee a triggered alert is acknowledged or escalated, never silently dropped12 because an unrouted incident is an outage nobody is fixing13 verify escalation-on-timeout test1415never page an engineer for a non-actionable informational event16 verify alert-classification test17never send incident details over an unauthenticated channel18 verify transport-security scan1920outcome FasterAcknowledgement21 "on-call acknowledges high-severity alerts before they escalate"2223metric ack_within_sla_rate24 baseline 68%25 target 90%26 window 30 days after release2728# How an incoming alert is routed. Run it: intent run AlertRouting.intent29# --inputs '{"severity":"high","primaryAvailable":true,"businessHours":false}'30decision RouteAlert31 inputs32 severity33 primaryAvailable34 businessHours35 rule pagePrimary36 when severity == "high" and primaryAvailable == true37 return PagePrimary38 rule escalate39 when severity == "high" and primaryAvailable == false40 return Escalate41 rule emailDaytime42 when severity == "medium" and businessHours == true43 return EmailPrimary44 default45 return QueueForReview4647# The life of an alert. Walk it: intent simulate AlertRouting.intent --events notify,ack,resolve48lifecycle AlertLifecycle49 state Triggered50 state Notified51 state Acknowledged52 state Escalated53 state Resolved54 transition notify55 from Triggered56 to Notified57 transition ack58 from Notified59 to Acknowledged60 transition escalate61 from Notified62 to Escalated63 transition escalatedAck64 from Escalated65 to Acknowledged66 transition resolve67 from Acknowledged68 to Resolved69 terminal Resolved7071# An incident is published to consumers; the payload carries no secrets.72event IncidentRaised73 payload74 incidentId: IncidentId75 severity: Severity76 service: ServiceName77 summary: Text78 publishedBy AlertRouting79 consumedBy OnCallDashboard8081# Paging is a remote call: it must be idempotent and time-bounded, and compensated on failure.82command PageOnCall83 idempotency_key incidentId84 timeout 30 seconds85 retry 3 times86on PageOnCallFailed87 compensate escalate to secondary rotation8889# The commitment, and the delivery result that measures it: intent outcomes AlertRouting.intent90outcome_contract AckSpeed91 outcome FasterAcknowledgement92 metric ack_within_sla_rate93 baseline 68%94 target 90%95 window 30 days after release96 owner ReliabilityLead9798result Q3Acknowledgement99 measures FasterAcknowledgement100 metric ack_within_sla_rate101 value 92%102 baseline 68%103104# The spec proves itself: intent test AlertRouting.intent105test RouteAlert106 case high severity pages primary107 given severity "high", primaryAvailable true, businessHours false108 expect PagePrimary109 case high severity with no primary escalates110 given severity "high", primaryAvailable false, businessHours false111 expect Escalate112 case medium in hours emails113 given severity "medium", primaryAvailable true, businessHours true114 expect EmailPrimary115 case low severity is queued116 given severity "low", primaryAvailable true, businessHours true117 expect QueueForReview118119test AlertLifecycle120 scenario acknowledged directly121 events notify, ack, resolve122 expect Resolved123 valid124 scenario escalated then resolved125 events notify, escalate, escalatedAck, resolve126 expect Resolved127 valid128 scenario cannot resolve before acknowledging129 events notify, resolve130 invalidDraft syntax. This file is illustrative and does not run yet.
More examples
ApiGatewayBillingServiceCalculateRiskScoreCertificationAttemptCertificationCheckoutCertificationEligibilityCertificationStudyPlanCreateInvoiceCreateStudyPlanCustomerDataRequestDuplicateInvoicePreventionGroundedAnswerIngestClickstreamInvoiceCreatedNetworkEgressPolicyPlaceOrderResearchAgentRunResetPasswordStorefrontStyleSubscriptionUpgradeTenantIsolationUploadStudyMaterial