Safeguard Work-Order Agent Ecosystem
Spec · Router
Agent Spec — Router
Status: implemented Source: src/agents/router.mjs Owner interface: route(classification) -> routing
Purpose
Decide *where the work goes* and *how fast it must happen*: the destination queue, crew type, vendor tier, service region, and the SLA clock.
Interface
route(classification) -> {
queue: string // e.g. TRADE_HVAC, GENERAL_QUEUE
crewType: string // e.g. HVAC_TECH, ELECTRICIAN
vendorTier: 'IN_HOUSE_RAPID' | 'STANDARD_VENDOR'
region: Region | 'UNASSIGNED'
slaHours: number
escalated: boolean // P1 gets an escalation flag
reasoning: string
}
Method (deterministic policy — not ML)
Routing is business policy and must stay inspectable and overridable by operations, so it is a table, not a model. See specs/routing-policy.md for the full table and change process.
- Category →
{ queue, crewType, baseSlaHours }. - Priority compresses the SLA clock (
P1→2h,P2→8h;P3/P4keep the
category base). The effective SLA is the *minimum* of the priority cap and the category base.
- Region is resolved from the extracted zone via
ZONE_REGION; unknown →
UNASSIGNED (the validator treats this as needing review).
- Vendor tier:
P1/P2→ in-house rapid response; otherwise standard vendor
pool.
P1setsescalated = true.
Contract
- Routing is a pure function of the classification — no side effects, fully
deterministic, trivially unit-testable.
- An unresolved region never silently proceeds; it surfaces as a routing signal
the validator can act on.
Verified behaviour
| Property | Result |
|---|---|
| Region resolved correctly (where a zone exists) | 100% |
| SLA monotonic in priority | enforced by construction |