Image copyright Getty Images

Both sides have had to make concessions to reach this agreement.

But the biggest single concession has probably been made by Boris Johnson, who has had to accept the European Union's (EU) demand that there can be no border checks of any kind for customs or regulations on the island of Ireland.

That means that there will - under this plan - be checks within the United Kingdom between Great Britain and Northern Ireland.

It is something that the Democratic Unionist Party (DUP) continues to oppose, and something Mr Johnson himself had said previously would be unacceptable.

Getty No British Conservative government could or should sign up to any such arrangement

"We would be damaging the fabric of the Union with regulatory checks and even customs controls between Great Britain and Northern Ireland, on top of those extra regulatory checks down the Irish Sea that are already envisaged in the withdrawal agreement," he told the DUP party conference in November 2018.

"Now I have to tell you, no British Conservative government could or should sign up to any such arrangement."

So why has he done it?

Partly because he needed a dramatic gesture to get this deal over the line.

But also because there is compromise on the other side too.

The EU said the text of the withdrawal agreement it concluded with Theresa May could never be reopened. But it has been.

Getty Everyone has to know that the withdrawal agreement will not be reopened.

It said anything that replaced the backstop plan for the Irish border would have to meet the same standard of ruling out the return of a hard border "under all circumstance".

But this new deal does not quite do that.

There is a mechanism that would allow a simple majority in the Northern Ireland Assembly to vote against these proposed new economic arrangements in the future.

If it did so, there would be a two-year notice period to find a new solution. That makes it, if you like, a form of time-limited backstop - although the EU would argue that it is highly unlikely that the Assembly would ever vote to trigger such uncertainty.

Please upgrade your browser Your guide to Brexit jargon Use the list below or select a button

The other big difference though - which is an important point of principle for Mr Johnson - is that Northern Ireland will leave the EU's customs union with the rest of the UK.

Yes, it will continue to apply EU rules on customs, tariffs and regulations under the auspices of the European Court of Justice.

But - through diplomatic manoeuvring - it will remain part of the UK's customs territory.

That means it will be able to take a full part in any future trade deals the UK government negotiates around the world.

But there is no denying that this is not the most elegant of solutions. It is not only the DUP in Northern Ireland that is unhappy. Such is the nature of a negotiated compromise.

Free trade agreement

One other issue is worth highlighting - promises by the UK to stick close to the EU's regulatory system after Brexit have been removed from the legally binding withdrawal agreement text.

They still appear in broad form in the political declaration on future relations - but the EU is well aware that Mr Johnson is looking for a looser economic relationship with the EU than his predecessor was.

That may well cause problems in the future, as several EU countries are concerned that the UK - a major economy on their doorstep - could seek to gain a competitive advantage by undercutting the EU's system of regulation.

The revised text of the political declaration says the aim is to complete a free trade agreement between the EU and the UK in the future.

A high-level meeting will be convened in June 2020 to assess progress towards such a deal, before the end of the post-Brexit transition period.

During trade negotiations, the UK will be treated as a potential competitor as well as a partner.

In that sense - as has been said before - even if this deal passes in the next few weeks (still a big if) it will not "get Brexit done".

Much of the hard work, including negotiating that future trade deal, is still to come, and it will last for many years.

Read more from Reality Check

Send us your questions

Follow us on Twitter