Greek Prime Minister Alexis Tsipras at a meeting of eurozone heads of state at the EU Council building in Brussels on Sunday. AP Photo/Francois Walschaerts Here it is.

Nearly six months after the election of the radical Syriza coalition, after bank closures and the July 5 bailout referendum, Greece seems to finally have a deal.

Belgium's prime minister simply tweeted the word "agreement."

EU Council president Donald Tusk was next out of the gates, saying the deal was unanimous among the European leaders.

At the news conference he called it an "aGreekment," producing groans from social media.

According to Politico's Ryan Heath, "the asset fund plan is €37.5bn for debt payback and €12.5bn for growth initiatives." If true, that would make the total funding going directly to the central government worth €50 billion ($55.83 billion, £35.97 billion), slightly smaller than the amount Greece asked for at the end of last week.

Heath adds that there will be a €25 billion ($27.88 billion, £17.93 billion) bank recapitalisation, which would go straight to the country's shattered financial system.

The immediate structural reforms to Greece's economy will have to be passed by the parliament in Athens by Wednesday. You can take a look at what is being asked here. It includes:

A "significantly scaled up privatisation programme with improved governance."

"Ambitious pension reforms" and measures to make the system more affordable.

General deregulation and liberalisation of Greece's market economy, with areas such as pharmacies being opened up to more competition.

A "rigorous review" of modernising the Greek labour market.

Depoliticising the Greek governing establishment — it's a common criticism that Greece's government is riddled with cronies from whichever administration is in office at the time.

Amending or rolling back some legislation that has been passed in Syriza's first six months in power, much of which ran against previous bailout deals.

Crucially, this section on debt is also included:

The Eurogroup stands ready to consider, if necessary, possible additional measures (possible longer grace and payment periods) aiming at ensuring that gross financing needs remain at a sustainable level. These measures will be conditional upon full implementation of the measures to be agreed in a possible new programme and will be considered after the first positive completion of a review.

The Euro Summit stresses that nominal haircuts on the debt cannot be undertaken.

This is relatively good news from the Greek government's perspective. Though outright debt haircuts are ruled out, moves like lengthening maturities and cutting interest rates will make the burden of repayment easier — though that possibility is tied to Athens' ability to implement the reforms to which it has agreed.

Germany and other eurozone states were pushing for a "timeout" from the currency union, which quickly became referred to as temporary Grexit, or Greek exit from the euro. On Saturday, when the Eurogroup of finance ministers was meeting, it seemed as if a sudden exit was very much possible.

Given the scale of the opposition to a deal similar to the 2010 and 2012 bailouts that Greece negotiated, there were rumours and suggestions that any deal would have to proceed with a bilateral loan to Greece from countries such as France and Italy — but with a unanimous agreement, it seems that's not on the table.

It looks as if neither German nor Greek negotiators got what they wanted, but both have a way to spin it as a minor victory. German politicians can tell voters they presented the exit scenario, and Greek politicians can tell their voters they resisted it.

The marathon session of EU leaders lasted more than 19 hours. That breaks records for the bloc.

The Eurostoxx 50 index bounced, rising by more than 1% as the market opened:

Investing.com

More on this story as it breaks.