Hamura was his birth name. He was adopted by Kazuyuki Egi. He graduated from the Law College of the Imperial University of Tokyo in 1897. He joined the Home Ministry and served as sanjikan (councillor) of the Cabinet Legislation Bureau and secretary of the cabinet. He served as the chief secretary of the third Katsura Cabinet, the second Okuma Cabinet and the Takaaki Kato Cabinet. During this period, he participated in the formation of the Kenseikai (Constitutional Association) in 1916 and was selected as a member of the House of Peers by Imperial command. He subsequently served as the Minister of Justice in the Takaaki Kato Cabinet and the first Wakatsuki Cabinet and the Minister of Railways in the Hamaguchi Cabinet. Because of his contribution to the signing of the London Navy Treaty, he stayed in the post in the second Wakatsuki Cabinet. He also served as councillor and the lead director of the Rikken Minsei-to(Constitutional Democratic party).