Meta-controller & ensemble

Two orchestration patterns: Meta-controller is a supervisory agent that analyzes tasks and routes them to the best specialist (with load balancing and performance tracking). Ensemble runs multiple agents on the same problem and aggregates their diverse perspectives for better answers.

Meta-controller: smart task routing

Diverse perspectives catch blind spots. One agent might miss something another catches. Aggregating their responses (majority vote, weighted average, or synthesis) produces more reliable answers than any single agent, especially for high-stakes decisions.

patterns/40_meta_controller.py + 42_ensemble.py
python
# Meta-controller (Pattern 40)
class MetaController:
    def process_task(self, task_content):
        task = self.analyze_task(task_content)
        agent = self.select_agent(task)  # Best fit based on capability + load
        agent.current_load += 1
        result = agent.process_task(task)
        agent.current_load -= 1
        if result["confidence"] > 0.7:
            agent.performance_score += 0.05  # Track performance
        return result

# Ensemble (Pattern 42)
class EnsembleSystem:
    def analyze_problem(self, problem):
        analyses = []
        for agent in self.agents:
            analysis = agent.analyze(problem)
            analyses.append(analysis)
        aggregated = self._aggregate_analyses(problem, analyses)
        consensus = self._calculate_consensus(analyses)
        return {"analyses": analyses, "aggregated": aggregated,
                "consensus": consensus}

Meta-controller routes tasks; Ensemble aggregates multiple agent analyses.

Quiz: Quiz

Loading practice…

Ensemble pattern

Matching exercise: Match orchestration concepts

Loading practice…

Flashcards: Flashcards

Loading practice…

Meta-controller and Ensemble are two sides of the orchestration coin. One picks the best specialist, the other harnesses the wisdom of the crowd. Next, we will explore graph memory, which gives agents a structured way to store and traverse knowledge.