Many novel DoD missions, from disaster relief to cyber reconnaissance, require teams of humans and machines with diverse capabilities and intelligence. To succeed, DoD planners organize available personnel and technologies into mission-based teams and organizations. Enabled by next generation of sensors, new ways to access information, increasing capabilities of robotic platforms, and advances in machine learning and artificial intelligence for distributed inference and control applications, the new types of teams are emerging that include autonomous collaborating human and machine agents. Developing models to extract highest potential from human-machine teaming is the defense technology of the future. While many empirical studies have demonstrated the benefits of alternative organizations, such as adaptive networks command and control structures, traditional computational team design solutions have mostly focused on teams of homogeneous agents (such as swarms or social networks), and simple problems (such as cooperative task allocation, geospatial movement, and collaborative decision making). Because machines and humans often have distinct and complementary skills, team members could perform different roles and have changing relations over time. To improve team performance, new solutions are needed to dynamically adapt team structure to better fit the tasks that a team executes. In this paper, we present a continuation of our work on adaptive self-organizing teams. Our model is based on team active inference, the model that describes the approximate inference as an iterative minimization of the free variational energy encoding the task performance and team process complexity. Our model provides the methodology for adapting the structure of heterogeneous organization in distributed manner, where the agents on the team make local decisions to change their roles and relations which are synchronized through explicit collaborative messages. The roles of agents are defined through decomposition of the generalized task types into groups, and assignment of these groups to agents. We obtain decomposition groups using variational clustering on the factor graph, which defines the contribution of the tasks and their dependencies on the team’s objective function. This clustering constructs regions in the factor graph that trade-off independence, work balancing, and the overlap to help optimized organization obtain globally-optimal solutions in distributed manner under communication uncertainties.