EU agrees 'historic' deal on regulation of artificial intelligence