Skip to main content
ThunderLang
← All examples

TwelveFactorAgent

examples/TwelveFactorAgent.thunder

TwelveFactorAgent.thunder
1# A 12-factor-aligned agent intent: deterministic control flow, structured I/O, a human gate,
2# bounded errors, a resumable lifecycle, and event triggers. Score it:
3# intent twelve-factor examples/TwelveFactorAgent.thunder
4mission TriageIncident
5goal "triage an incoming incident and route it deterministically, pausing for a human on high-stakes actions"
6why "on-call engineers need reliable, auditable triage, not an autonomous loop that can spin out"
7
8requires monitoring signal
9requires runbook access
10
11scope
12 include incident severity, service ownership, runbook steps
13 exclude unrelated services, incidents older than 30 days
14
15input
16 severity: Severity
17 service: ServiceId
18 actor: UserId
19
20output
21 routing: RoutingDecision
22
23guarantee every high-severity incident is acknowledged within the SLA
24guarantee no destructive action runs without human approval
25
26decision RouteIncident
27 inputs
28 severity
29 ownerAvailable
30 rule page
31 when severity == "high" and ownerAvailable == true
32 return PageOwner
33 rule escalate
34 when severity == "high" and ownerAvailable == false
35 return EscalateToLead
36 default
37 return FileTicket
38
39approval required from
40 incident-commander
41
42errors
43 RunbookUnavailable
44 DownstreamTimeout
45
46on DownstreamTimeout
47 compensate retry with backoff
48 notify on-call channel
49
50lifecycle IncidentLifecycle
51 state Triaged
52 state Routed
53 state AwaitingApproval
54 state Resolved
55 transition route
56 from Triaged
57 to Routed
58 transition await
59 from Routed
60 to AwaitingApproval
61 transition resolve
62 from AwaitingApproval
63 to Resolved
64 terminal Resolved
65
66event IncidentRaised
67
68demonstrates explains why high-severity incidents pause for human approval
69requires_skill Incident Response, Distributed Systems
Draft syntax. This file is illustrative and does not run yet.