I think this will need to be recursive to handle Agents that use nested structures, like the HumanTaskAgent, or the DataOutputAgent.