The dynamics between top management team and the board seems to be similar to the dynamics between functional heads and the top management team. So, can we use the principal agent concept within a firm? Is there any research on this?
Real life problem is normally more complex than that in the theoretical world. In real word, both the board and the top management team are agents of the principal (shareholders).
Besides the well-discussed principal-agent relationship between shareholders and top management, in a typical corporation, the board has members from both the management and the shareholders, therefore there is principal-agent relationship between the shareholders and the board.
Agency problems can be framed at all levels within the organisation, according to the definition of Jensen and Meckling (1976). On p. 309 of their original paper, they explicitly argue on this matter: "Note also that agency costs arise in any situation involving cooperative effort [...] by two or more people, even though there is no clear cut principal-agent relationship".
Yes I think you may consider an agency relationship between the CEO and a functional head of the firm. This.paper may be of some help:
P. Brockman, H S Lee, J M Salas, "Determinants of CEO compensation: generalist-specialist versus insider-outsider attributes", Journal of Corporate Finance, 2016 forthcoming.
I believe the Principal-Agent (PA), or Principal - Principal -Agent (PPA) relationship can be considered when the opportunistic behaviour of someone can exacerbate the conflict, increase the agency costs and destroy firm value.