engine: consider metadata when adding global unit to agents

How's that?