Hasan Agha or Hadım Hassan Ağa, also Hassan the eunuch, was an Italian renegade from Sardinia and effective ruler of the Regency of Algiers from 1533 to 1545. He was the deputy of Hayreddin Barbarossa, who left him in command when he had to leave for Constantinople in 1533.
In 1534 also, Hasan Agha continued to be left in command of Algiers when Barbarossa waged his campaigns in Tunisia. Hasan Agha ruled Algiers until 1545, as Barbarossa continued to be based in Istanbul as Commander-in-Chief of the Ottoman fleet.
Hasan Agha was the commander of Algiers during the Algiers expedition (1541), in which Barbarossa was absent, and which ended with catastrophic results for Charles V.
In 1542, he massacred the tribe of the Zaouaoua, who had supplied Charles V with 2,000 troops.
Upon the retirement of Barbarossa in 1544, the son of Barbarossa Hasan Pasha was appointed Governor of Algiers to replace his father, and thus also replace Hasan Agha in the position of effective ruler.