Ok, here is some code in Python that tracks the best solution found and terminates the search if there hasn't been an improvement during the last 2 seconds:
routing.CloseModel()
bestCollector=solver.BestValueSolutionCollector(False)
bestCollector.AddObjective(routing.CostVar())
routing.AddSearchMonitor(bestCollector)
bestSolution = dict(score=sys.maxint, clock=0, startTime=time.time())
def enough():
if bestCollector.SolutionCount() > 0 and bestCollector.ObjectiveValue(0) < bestSolution.score:
bestSolution['score'] = bestCollector.ObjectiveValue(0)
bestSolution['clock'] = bestCollector.WallTime(0)
print bestSolution.solution(0) # that's the solution
#stop search?
return bestSolution['score'] < sys.maxint and \
time.time()-bestSolution['startTime'] > \
bestSolution['clock']*0.001+2)
routing.AddSearchMonitor(solver.CustomLimit(enough))
plan = routing.Solve() #run the solver