EU reaches historic agreement