Libya's rival groups agree to talks