British Prime Minister Rishi Sunak on Thursday hailed an agreement between leading AI developers and governments to test new artificial intelligence models before they are released.

He said the accord on the final day of his two-day AI Safety Summit would help to manage the risks of the rapidly developing technology and protect humanity from the potential threat it poses.

"The late Stephen Hawking once said: 'AI is likely to be the best or worst thing to happen to humanity'. If we can sustain the collaboration that we have fostered over these last two days, I profoundly believe that we can make it the best. Because safely harnessing this technology could eclipse anything we have ever known."

The list of countries that had signed up to the safety testing collaboration did not include China, whose representatives were not included in the second day of talks.

But, the day prior, Sunak secured China's backing of the "Bletchley Declaration" - another international effort to manage the risks of AI.

"It wasn't an easy decision for me to invite China and indeed, lots of people criticised me for it. But I think it was the right long-term decision because any serious conversation about AI safety has to engage the leading AI nations."

Sunak welcomed U.S. Vice President Kamala Harris to the second day of the AI summit, as well as U.N. Secretary-General António Guterres.

A conversation between Sunak and Elon Musk on the tech billionaire's X platform was to mark the final words on AI.

According to two sources at the summit, Musk told fellow attendees on Wednesday that governments should not rush to roll out AI legislation.