Lead Routing Agent
🟠 ScaleRoutes inbound leads with suppression-first logic through customer, opportunity, named-account, territory, and round-robin rules — shadow mode before production
Adam's take
The highest-stakes agent in the launch set. Run it in shadow mode longer than feels necessary; a misrouted lead is annoying, a suppressed customer getting prospected is a fire.
Required tools
Optional tools
Expected value
Speed-to-lead in minutes; SLA discipline; correct ownership without manual triage
Deployable workflow pack
The full pack includes the agent spec, deployment guide, architecture diagrams, n8n workflow skeleton, Clay template, HubSpot properties, JSON schemas, OpenAPI spec, cost and ROI calculators, demo data, QA checklist, and governance notes.
View pack on GitHubHow to deploy this agent
Lead routing looks simple until you actually build it. A lead from an existing customer’s domain shouldn’t create a new deal. A named account should reach its assigned AE, not round-robin. A suppressed contact shouldn’t be routed anywhere at all. This agent runs every inbound lead through those checks in a strict, documented order — and it runs in shadow mode before it ever touches a live queue.
Core signals
Input schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://deploytheagent.com/schemas/agent-008-input.schema.json",
"title": "Agent #008 Lead Routing Agent Input",
"type": "object",
"required": [
"record_id"
],
"properties": {
"record_id": {
"type": "string",
"description": "CRM record ID (company/contact/deal depending on agent)."
},
"domain": {
"type": "string"
},
"config_version": {
"type": "string",
"description": "Versioned config used for this run."
}
},
"additionalProperties": true
}Output schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "https://deploytheagent.com/schemas/agent-008-output.schema.json",
"title": "Agent #008 Lead Routing Agent Output",
"type": "object",
"required": [
"record_id",
"routing_status",
"routing_matched_rule",
"routing_timestamp",
"routing_exception_reason"
],
"properties": {
"record_id": {
"type": "string"
},
"routing_status": {
"type": "string",
"description": "Agent #008 output field."
},
"routing_matched_rule": {
"type": "string",
"description": "Agent #008 output field."
},
"routing_timestamp": {
"type": "string",
"description": "Agent #008 output field."
},
"routing_exception_reason": {
"type": "string",
"description": "Agent #008 output field."
}
},
"additionalProperties": false
}Scoring / classification logic
Anything that fails all six rules, or matches two rules ambiguously (say, an open-opportunity match and a named-account match pointing to different owners), routes to a human-reviewed exception queue instead of a best guess. That design decision — ambiguous is safer slow than wrong fast — is the whole point of this agent.
HubSpot CRM properties
n8n workflow skeleton
The Lead Routing Agent routes every inbound lead through suppression, existing-customer, open-opportunity, named-account, and territory checks before falling back to round-robin — with a documented exception queue for anything that doesn't cleanly resolve. It runs in shadow mode before it ever touches a live queue. Configure every node marked CONFIGURE before enabling the trigger.
- TriggerCONFIGURE: set cadence per agent-spec.md's What It Does section. Leave disabled until Step 6 of deployment-guide.md.
- Load versioned configCONFIGURE: replace with your versioned config built from real data (see deployment-guide.md Step 1).
- Fetch source dataCONFIGURE: {{HUBSPOT_CREDENTIAL}}. Pull the fields listed in agent-spec.md's Inputs table.
- Validate + gate recordsDrops records missing required inputs or failing suppression/gate checks defined in agent-spec.md. Logs every drop.
- Apply workflow logicImplements the Workflow Logic table from agent-spec.md. Writes model/config version alongside every derived value for auditability.
- Write agent-owned CRM fieldsCONFIGURE: {{HUBSPOT_CREDENTIAL}}. Writes only: routing_status, routing_matched_rule, routing_timestamp, routing_exception_reason. Never writes sales-owned fields.
- Route to human review / alertCONFIGURE: {{SLACK_CHANNEL}}. Fires for records requiring human review per agent-spec.md's Governance section.
Cost calculator
Cost Calculator — Agent #008: Lead Routing Agent
Fill in your own volumes and rates — do not use these as benchmark numbers.
| Cost driver | Your volume | Unit cost | Monthly cost |
|---|---|---|---|
| n8n execution (workflow runs) | ___ runs/month | $___ / run | $___ |
| Enrichment/sourcing credits (if applicable) | ___ records/month | $___ / record | $___ |
| LLM API calls (if applicable) | ___ calls/month | $___ / call | $___ |
| Human review time | ___ hrs/month | $___ / hr (loaded) | $___ |
| Total | $___ |
Build cost (one-time)
Estimated build time: 1–3 days. Multiply by your builder's loaded hourly rate for a one-time build-cost estimate.
Notes
Costs scale with the volume of records this agent processes, not with the size of your whole CRM — scope your volume estimate to the specific object/list this agent actually touches (see `agent-spec.md`'s Inputs table).
ROI calculator
ROI Calculator — Agent #008: Lead Routing Agent
| Metric | Before | After | Basis |
|---|---|---|---|
| Time to route a new lead | Minutes to hours, manual | Real-time (seconds) | Rule engine resolves instantly |
| Existing customers misrouted as new logos | Happens regularly without a check | Caught by rule #2 every time | Domain-match check runs first, always |
| Named-account misroutes | Depends on whoever routes noticing | Caught by rule #4 every time | Named-account list checked deterministically |
SLA and misroute-rate improvements are measurable directly from the logged routing decisions; don't claim a revenue number without your own before/after misroute audit.
Your numbers
| Input | Value |
|---|---|
| Records processed per month | ___ |
| Manual time saved per record (before) | ___ min |
| Loaded hourly rate | $___ |
| Monthly time-savings value | $___ (records × minutes saved ÷ 60 × rate) |
Compare this to the cost calculator's monthly total for a net ROI. Do not add a revenue-impact number unless you've measured it against your own baseline — see `agent-spec.md`'s ROI note.
Governance notes
- Shadow mode is mandatory before production: routing decisions are logged and reviewed against real leads for a minimum of two weeks or 100 leads before the toggle is flipped to live.
- Every routing decision logs its matched rule and timestamp, so any routing outcome is fully auditable after the fact.
- Ambiguous or unresolved leads always go to a human exception queue — never a confident best-guess assignment.
- Suppressed contacts are never routed anywhere, checked before any other rule runs.
Failure modes
- Existing customer routed as a new logo: prevented by running the domain-match check unconditionally before round-robin — a QA test asserts a customer-domain lead never reaches the fallback rule.
- Named account routed to the wrong rep: usually caused by a stale named-account list — QA includes a staleness check on the list’s last-updated date.
- An ambiguous lead routed confidently anyway: a QA test deliberately constructs a lead matching two rules and asserts it lands in the exception queue, not auto-routed.
- Shadow mode skipped under launch pressure: the deployment checklist makes shadow-mode sign-off a hard gate before production goes live — not a suggestion.
QA checklist
QA Checklist — Agent #008: Lead Routing Agent
To be completed by a non-builder reviewer before go-live.
Deployment checklist
- ☐ All six routing rule sources connected and current (suppression, customer list, open opps, named accounts, territory, round-robin pool)
- ☐ Four HubSpot lead properties created
- ☐ n8n workflow imported in shadow mode first
- ☐ Shadow-mode accuracy reviewed against real leads (min. two weeks or 100 leads)
- ☐ Ambiguous-lead exception test passes
- ☐ Demo-data run matches `demo-data/sample-output.json`
- ☐ Production go-live explicitly approved by RevOps after shadow-mode review
- ☐ QA checklist completed by a non-builder
- ☐ Rollback tested
Failure-mode verification
- ☐ Verified: Existing customer routed as new logo does not occur (mitigation: Rule #2 runs unconditionally before round-robin; QA test asserts a customer-domain lead never reaches round-robin)
- ☐ Verified: Named account routed to wrong rep does not occur (mitigation: List ownership assigned; QA includes a staleness check on list last-updated date)
- ☐ Verified: Ambiguous lead routed confidently does not occur (mitigation: QA test constructs a deliberately ambiguous lead and asserts it lands in the exception queue, not auto-routed)
- ☐ Verified: Shadow mode skipped, straight to production does not occur (mitigation: Deployment checklist makes shadow-mode sign-off a hard gate before the production toggle is flipped)
Governance verification
- ☐ Agent writes only to its agent-owned fields: `routing_status`, `routing_matched_rule`, `routing_timestamp`, `routing_exception_reason` (lead/contact)
- ☐ No auto-send, auto-close, auto-route, or auto-create action occurs without the human step described in `agent-spec.md`
- ☐ Confidence/model-version is present on every written record where applicable
- ☐ Demo-data run output matches `demo-data/sample-output.json` in structure
Sign-off
Reviewer name: _______________ Date: _______________ Result: Pass / Fail (attach notes)