advanced
ai-ops
technicians
routing

Technician Routes

How AI Ops packages low-battery swaps and rebalance moves into a single VRP-optimized route for each technician — including auto-maintenance and abandon flows.

Levy Fleets TeamMay 18, 20268 min read

Technician Routes

Technician routes are the third capability of AI Ops. The solver takes two kinds of stops — battery swaps and rebalance moves — and packages them into a single ordered route per technician per shift. The technician follows the route inside the operator-app.

This feature is only enabled when the subaccount has ai_ops_tier='enterprise'.

What goes into a route

The route builder runs every 30 minutes during operating hours (06:00-22:00 local). For each technician on shift, it gathers:

  1. Low-battery vehicles below the swap threshold — these become swap stops.
  2. Accepted rebalance recommendations — each turns into a pickup stop and a dropoff stop, paired (the same vehicle must be picked up then dropped off).
  3. The technician's start and end location for the shift.
  4. The shift window (start time, end time).
  5. Van capacity — how many vehicles fit in the tech's vehicle at once.

The solver minimizes total travel time subject to all stops fitting within the shift window, all pickup → dropoff pairs being honored in order, and capacity never exceeding the van limit.

Stop types

TypeWhat it means
swapBattery swap in place. Tech replaces the battery, scoots on. Vehicle remains in the same hex.
pickupTech picks up an over-supplied vehicle, loads it into the van.
dropoffTech drops off a previously-picked-up vehicle at the rebalance destination.

A route alternates between pickups and dropoffs as the van fills and empties. Swap stops can happen anywhere in the sequence.

Solvers

Levy AI Ops ships with three solver implementations and picks at runtime:

  • OR-Tools — Google's open-source vehicle routing solver, exposed as a FastAPI microservice. Honors pickup/delivery pairs, time windows, capacity, and uses the GUIDED_LOCAL_SEARCH metaheuristic with a 5-second time limit. Used by default if ORTOOLS_SOLVER_ENDPOINT is configured.
  • Routific — paid API, higher-quality solutions for larger routes. Used when ROUTIFIC_API_TOKEN is set. Best for routes with 30+ stops.
  • Local savings solver — a pure-TypeScript Clarke-Wright + 2-opt fallback that runs in Node. Adequate for routes up to ~30 stops in under 100ms. Used when neither remote solver is configured.

The active solver is recorded in rebalance_routes.solver_version so you can audit which run used which engine.

The auto-maintenance rule

When a route is built, every vehicle attached to a pickup stop is automatically set to maintenance status. This prevents a rider from grabbing the vehicle before the technician arrives.

The vehicle stays in maintenance until one of:

  • The technician completes the pickup stop (vehicle stays in maintenance while in the van, then flips back to available at the dropoff).
  • The route is abandoned (vehicle reverts to available immediately).
  • The tech completes a swap stop (vehicle flips back to available once the swap is logged).

This is the one piece of AI Ops that takes an action without operator review. It is intentional and limited to the pickup window of an active route.

Routes table

A route is stored in rebalance_routes with these key fields:

FieldMeaning
subaccount_idRLS scope
technician_idThe user assigned this route
shift_start / shift_endThe window the solver respected
statusplannedin_progresscompleted / abandoned
solver_versionWhich engine built this route
total_distance_mSolver's total distance estimate
estimated_minutesSolver's total time estimate

Each stop sits in rebalance_route_stops:

FieldMeaning
sequence0-indexed order along the route
stop_typepickup / dropoff / swap
vehicle_uuidThe vehicle this stop acts on
destination_h3For dropoffs, the target hex
etaSolver's estimated arrival time
time_window_endLatest acceptable arrival
completed_atWhen the tech marked it done
completion_noteOptional free-text from the tech

Edge cases

SituationWhat happens
Tech doesn't accept the routeStatus stays planned. Auto-maintenance is not applied until the tech taps Accept.
Tech taps AbandonAuto-maintenance vehicles revert to available. Incomplete recommendations are re-opened.
Too many stops for shift windowSolver returns the longest feasible subset. Surplus stops stay as open recommendations for the next route or the next tech.
No technician on shiftRoutes aren't generated. Recommendations still accumulate in the operator dashboard.
Solver times out (>5s on OR-Tools)System falls back to the local savings solver for that single run. Sentry warning is emitted.

Measuring the win

The academic literature on joint swap + rebalance routing claims roughly 50% travel-distance reduction compared to swap-only and rebalance-only routes run independently. In practice, expect 30-50% depending on fleet density and shift length. The total_distance_m field on each route is the measurement: compare a week of AI Ops routes to a week of manually-planned routes to see the delta.