It was not immediately clear why President Beji Caid Essebsi made a decision to declare the state of emergency on Saturday, or what it would entail.
Essibsi was to address the nation later Saturday, the agency said without giving details.
The measure was adopted because of “the exceptional situation which the country is going through after the latest terrorist attack and the persistent threats which place the country in a special type of war”, he said.
Armed with a Kalashnikov assault rifle, a man identified by authorities as 23-year-old Seifeddine Rezgui, massacred the crowd of tourists at a popular beach resort in a rampage that witnesses say lasted more than 40 minutes.
“Tunisia faces a very serious danger and it should take any possible measures to maintain security and safety”, he said.
Essebsi blamed the poor security in Libya for Tunisia’s problems, and the lack of worldwide resolve in targeting the Islamic State group throughout the region.
Tunisian officials say all three gunmen in those two attacks had been trained at the same time, over the border in jihadist camps in Libya, where a conflict between two rival governments has allowed Islamist militant groups to gain ground.
The North African state, which has seen an exodus of tourists, has admitted its security services were unprepared for the seaside attack in Port El Kantaoui and that police were too slow to respond.
In March, gunmen killed 22 people, again mostly tourists, at The National Bardo Museum outside Tunis.
Tunisia last had a state of emergency during the 2011 uprising against autocrat Zine El-Abidine Ben Ali. It initially included a curfew and a ban on meetings of more than three people.