The United States, Italy, Britain, and Turkey have agreed to train thousands of Libyan troops to counter the instability caused by the numerous and often opposing militias that remain powerful there more than two years after the overthrow of former dictator Moammar Gadhafi.