All project notes

Engineering

How SalesCandy routed leads

How SalesCandy coordinated routing hours, salesperson availability, assignment, and the records that explained each decision.

A lead can wait overnight, move through several offers in the morning, and eventually reach a salesperson who was away when the queue first opened. Explaining who got that lead requires knowing when it could route, who was eligible at each offer, and what happened to the previous offer.

Routing commands move from CandyMuncher to Carousel. CarouselMatcher reads live state in Redis and sends offers through Presence. A separate queue takes outcomes to RoutingLogger.
Illustrative diagram of the SalesCandy v3 routing flow.

Routing and its records

RoutingHours signalled when scheduled routing opened or closed. Carousel handled routing commands and offer responses. CarouselMatcher matched leads to eligible salespeople and applied rules for sole salespeople and related leads. RoutingLogger consumed queued outcomes, while Carousel Analytics collected analytics on the leads Carousel handled.

Availability and app status

Presence tracked the salesperson app’s connection and availability, delivered offers, and relayed replies. PresenceLogger copied status events into CandyBase. App Status Reports used presence events to report app status.

Three sources of routing data

Source What it supplied
CandyBase Project and team configuration, candidate information, and persisted routing and presence records.
Redis Live lead queues, active offer markers, and current availability shared across services.
CandyMuncher The lead record, commands that started or stopped routing, and updates when a lead was assigned.

The distinction helps explain a streak of offers. Start with the lead and its project rules, check who was available during the window, then follow the offer outcomes. The routing simulator lets you replay how availability, weights, and policy alone can shape the distribution.

What carries forward

A lead offer can sit in flight while the salesperson decides. Carousel and CarouselMatcher shared live queue and offer state in Redis, while RoutingLogger persisted outcomes through a separate queue. Carousel’s 73c51b2 records the removal of Lambda matching when the team moved it to a separate worker. The resulting design used queued events for handoffs and gave the latency-sensitive matching loop a worker of its own. Carousel’s repository evidence.

A modern agent that needs approval before updating a customer record can follow a similar pattern. Save the proposed change and its workflow ID, pause while a reviewer decides, and resume when the approval or rejection arrives. Record which policy was applied, who could override it, and what happened next. A manager can use the equivalent information in the routing simulator to ask whether the rule rewarded the behavior the team wanted. LangGraph on durable approval pauses · Routing and perceived fairness.