France declared war to Algeria, England did not.
Approaching "peacefully" allowed the fleet to cross safely the most dangerous fireground, and anchor despite strong shore stream.There is a local legend that nobody dare to open fire until too late, because the decision was up to the Dey, who was sleeping.
This gave Exmouth the opportunity to attack Algiers with a fleet three times smaller than estimated by his pairs. Usual compute was 3 guns onboard against 1 on shore, and Algiers had formidable batteries - many of them wrongly oriented once the fleet had passed by "peacefully".
The belated countermeasures of the Dey were not a trap, simply lack of will to "provoke" such a powerfull fleet.
Naval battle was not an option, the most powerfull algerine ships were one or two small frigates.
Effective garrison of Algiers were the 3.000 Janissaries. Semi-effective in fact, they were in life-long duty, badly paid, had to use most of their time to other job instead of training, and were always on the verge of a coup.
The remnant were armed citizens, from town and countries, only agreeing on one subject, to repell attempt of european navies. Tough, but not disciplined or trained fighters.
Algerine state of 1816 was not anymore the powerfull corsair city and slave-state of the 17th, the hundreds of sicilian and sardinian slaves were mostly captured for ransom. Most of the activity was local trade and yearly military expedition to collect taxes from the countryside.
Privateers were not a significant force, they had dropped under 500 men and less than a dozen raids a year during the napoleonic war, neutral shipment being a much more lucrative activity. They started again (on small scale) after the peace, when local mediterranean authorities expelled merchants and confiscated cargo to give this activity back to nationals.
Still, the fight turned quite dangerous for the anglo-dutch, who had 2.000 casualties (an higher rate than Copenhagen). The fleet destroyed the main forts but was almost out of ammunition when the Dey asked for truce.
I have detailed books on the subject, I will send the reference soon.