Chile has announced it will hold a referendum on the country's constitution following weeks of anti-government protests.
Protesters are demanding social reforms and a change to the constitution which dates back to the pre-democracy era of the military leader, Augusto Pinochet.
The vote will take place in April.
At least 20 people have died and about 1,000 have been injured in protests that started over a hike in subway fares.
The "Agreement for Peace and a New Constitution" was signed at midnight following long negotiations.
The referendum will ask voters if they want the constitution to be replaced.
It will also ask voters who think it should be replaced to choose between three different bodies to draw up a new constitution. The options are a body of fully elected representatives, political appointees or an equal mix of both.
The current constitution does not currently establish the state's responsibility to provide healthcare and education, which are two demands from the protesters.
Chile has been rocked by unrest over the past month with riots, arson and looting.
The country's independent National Human Rights Institute says it has brought legal action over 179 cases, including alleged murders, sexual violence and torture by the military police.
On Thursday, Chilean singer Mon Laferte bared her breasts in a red carpet protest at the Latin Grammy awards in the US.
She walked the red carpet and uncovered her chest emblazoned with the words "In Chile they torture, rape and kill".
She has been a supporter of the anti-government protests in the country.
Mon Laferte was one of several artists at the Latin Grammys who spoke about the current political climate in Latin American countries.