(Numbers 13:1–2:) "And the LORD spoke <to Moses, saying>: Send men for yourself, that they may scout the land of Canaan." Thus did Rabbi Tanhuma bar Abba expound. Let our master teach us: What is the law concerning setting sail on the Great Sea (the Mediterranean) within the three days before the Sabbath? Thus have our masters taught: One does not set sail in a ship upon the Great Sea within the three days before the Sabbath, when one wishes to travel to a distant place. But if one seeks to set sail, as for example from Tyre to Sidon, one is permitted to set sail even on the eve of the Sabbath, for it is a known thing that one is able to go while it is still day. And these words apply to agents of permitted (optional) matters; but in the case of agents of a commandment, one is permitted to set sail on whatever day he wishes, because he is an agent of a commandment, and an agent of a commandment overrides the Sabbath.
And so too you find concerning the Sukkah, for we have learned: Agents of a commandment are exempt from the Sukkah. For you have none so beloved before the Holy One, blessed be He, as an agent who is sent to perform a commandment and gives his soul (risks his life) to make it succeed. And you have no man who was sent to perform a commandment and gave his soul to succeed in his mission like those two whom Joshua son of Nun sent, [as it is said: "And he sent…"] "two men as spies secretly, saying" (Joshua 2:1). Who were they? Our masters taught: These were Phinehas and Caleb, and they went and gave their souls and succeeded in their mission.
What is the meaning of "secretly" (heresh)? That they made themselves out to be potters, and they would cry out: "Here are pots! Whoever wishes, let him come and buy"—so that no man would take notice of them. Read it as "earthenware" (heres), so that people would not say that they were spies. "And they went and came into the house of a harlot woman" (ibid.). She arose and received them. The king of Jericho became aware of them and heard that they had come to dig out (explore) the land, as it is said: "And it was said to the king of Jericho [etc.]" (ibid. 2). When they went to seek them, what did Rahab do? She took them to hide them. Phinehas said to her: I am a priest, and the priests are comparable to angels, as it is said: "For the lips of a priest preserve knowledge, and Torah they seek from his mouth, for he is a messenger (angel) of the LORD of Hosts" (Malachi 2:7). And an angel who seeks to be seen is seen, and who seeks not to be seen is not seen.
And from where do we know that the prophets were called angels? As it is said: "And He sent a messenger (angel) and brought us out of Egypt" (Numbers 20:16)—and was it not Moses? From here that the prophets are likened to angels. And from where do we know that she hid only Caleb? As it is said: "And [the woman] took the two men and concealed him" (Joshua 2:4)—to teach you how much these two righteous men gave themselves to perform their mission. But the agents whom Moses sent were wicked, [as we know] from what they read on the matter: "Send men for yourself" (Numbers 13:2).