Lead Routing and Territory Logic: Rules, Models, and Fairness
Overview
Routing decides who works what—and when it is wrong, teams lose trust in automation. This guide balances deterministic rules with light model assistance and clear overrides.
Quick definition
Routing automation assigns records using ordered rule layers: hard constraints, territory tables, load balancing, and optional ML tie-breakers—always auditable.
Definition
Routing assigns records to owners or queues using geography, account attributes, product line, language, and rep capacity. It must be explainable to sales leadership.
Why it matters
Bad routing creates revenue leakage and political conflict. Transparency and logs matter as much as algorithms.
Core framework
Step-by-step model as TypeScript interfaces (machine-readable checkpoints).
Layer rules
/**
* Layer rules
* Start with hard filters: territory and segment. Then skills. Then load balancing among eligible reps.
*/
export interface CoreFrameworkStep1LayerRules {
/** Order in the core framework (0-based) */
readonly stepIndex: 0;
/** Display title for this step */
readonly title: "Layer rules";
/** Narrative checkpoints as published in the guide */
readonly narrative: readonly string[];
}
export const CoreFrameworkStep1LayerRules_NARRATIVE: readonly string[] = [
"Start with hard filters: territory and segment. Then skills. Then load balancing among eligible reps."
] as const;Fallback queues
/**
* Fallback queues
* When no owner matches, route to an escalation queue with SLA—not a silent drop.
*/
export interface CoreFrameworkStep2FallbackQueues {
/** Order in the core framework (0-based) */
readonly stepIndex: 1;
/** Display title for this step */
readonly title: "Fallback queues";
/** Narrative checkpoints as published in the guide */
readonly narrative: readonly string[];
}
export const CoreFrameworkStep2FallbackQueues_NARRATIVE: readonly string[] = [
"When no owner matches, route to an escalation queue with SLA—not a silent drop."
] as const;Detailed breakdown
Logic sections encoded as Python functions with structured narrative payloads.
Model assist
def logic_block_1_model_assist(context: dict) -> dict:
"""Operational logic: Model assist"""
# Narrative steps from the guide (logic section)
paragraphs = ["Use classification for product intent when forms are incomplete—but expose confidence and allow rep reassignment with reason codes."]
return {
"heading": "Model assist",
"paragraphs": paragraphs,
"context_keys": tuple(sorted(context.keys())),
}Technical patterns
Rule precedence
- Evaluate `global.vip` → `region.zip` → `round_robin(pool)` in fixed order.
- Log `matched_rule_id` on assignment for disputes.
Code examples
Layered routing
Explicit precedence avoids “magic” assignment.
export function routeLead(lead, rules) {
for (const r of rules.sort((a, b) => a.priority - b.priority)) {
if (r.when(lead)) return { owner: r.assign(lead), rule: r.id };
}
return { owner: 'unassigned-queue', rule: 'fallback' };
}System architecture
[Lead + context]
→ [Rule engine: ordered predicates]
→ [Owner resolution]
→ [CRM assignment + notify]
→ [Audit: rule + inputs]Real-world example
A multi-office firm combined ZIP-based territories with “overflow” pools during campaigns—preventing hotspots while maintaining audit trails of overrides.
Common mistakes
- Hidden routing tables in code only—ops cannot adjust during reorganizations.
- Ignoring PTO and capacity—SLAs burn out top performers.
Related topics
Need routing you can defend in a QBR? PrimeAxiom implements explainable assignment with CRM logs and manager controls.