The core was the alliance between France and Russia formed in 1892 out of fear of Germany. Britain came to an 'understanding' ('Entente') with France in 1904 which dealt with various disputes in Africa.
The defeat of Russia in the Sino-Japanese War of 1904-05 prompted a reappraisal of Russia. What bothered many foreign observers was not so much Russia's defeat but the fact that the Russian media and mant Russian intellectuals publicly applauded ever Russian defeat; moreover, there was an uprising in Russia in 1905. The nearly established British Imperial General Staff concluded that Russia did not have the internal cohesion to fight a major war, and that it was no longer an effective counterweight to Germany. (Incidentally, Britain's view of Russia as a military power didn't change much till 1943).
In the interests of restoring the balance of power, Britain drew much closer to France and, despite Anglo-Russian rivalries in parts of Asia (for example, Persia) it came to a limited agreement with Russia in 1907.