Yes it works that way. The abjurer's ward is not temporary hit points, it is a shield of sorts. It simply grants a buffer of bonus hit points that get used up first, but that are not "temporary hit points"
Actually yes, double checking - I can confirm that this is, or should be, accurate.
The ward is functionally an independent object with its own HP; things do not hit the ward, they hit you, but the ward takes the damage until it has no hit points left, at which time you take the remaining. The ward isn't meant to be temp HP so it doesn't conflict with any temp hp you may have. Nebuul is also correct that Agathys only requires you to be hit while you have the temp, and doesn't require that those temp actually take damage.
The way the interaction should work here is:
- Player has level 2 Agathys up, and it was their first abjuration spell for the day - so their ward has 12Hp (level 4 x 2, Plus 4 for 18Int, let's say), and they have 10Hp from Agathys.
- They run past two melee goblins, who both swipe and hit; they hit the players, so at this point Agathys
will trigger (individually when each one processes its damage), and the goblins will take 10 damage each, and die.
- First goblin's damage roll is 6 damage, second goblin's damage roll is 7 damage; these are both absorbed by the ward *first*, so only 1 point of damage goes through to Agathys, which is reduced to 9Hp.
- Player casts Mage Armour at 1st level (because they forgot), and the ward gains 2 new hit points.
- Player keeps running and triggers a third opportunity attack - this goblin hits and deals 4 damage; two is absorbed by the ward, and two goes through to Agathys, reducing it to 7 Hit points, while the goblin takes 10 damage and dies.
- At this point, the ward is pretty spent for the day, since it's only going to regenerate small pips of Hp when you use your remaining spell slots, which are limited, but it's done its job.
Edit: What IS worth mentioning here is that natively, Armour of Agathys is NOT on the Wizard spell list, so this utility should be harder to wrangle than it is in BG3.