Hierarchical Agent Design

I read some light material earlier about the possibility of building AI agent trees, which leaf agents optimizing for primitive tasks, while higher level agents optimizing for orchestrating direct descendant agents.

According to my understanding, each agent would have different objective functions, and possible moves.

I wonder if someone could give some insight on how to implement such complex agent, hopefully with an example.