The Belfast Agreement sets out the system of governance for Northern Ireland.
But this agreement was only signed in 1998 and came into force in December 1999.
How was Northern Ireland governed beforehand?
Was it "direct rule" from Westminster?
It was indeed "direct rule" by the Secretary of State for Northern Ireland. The Wikipedia page is sound: https://en.wikipedia.org/wiki/Direct_rule_(Northern_Ireland)
Direct rule (Irish: riail dhíreach) is the term given to the administration of Northern Ireland directly by the Government of the United Kingdom. It was practiced for 26 straight years between 1972 and 1998 during the Troubles, and has since then been temporarily applied during suspensions.