Countries participating in a UN conference in Geneva reached an agreement on autonomous weapons systems after difficult talks.