Deep Analysis Agents for MoE Escalation Handling
Second-tier specialists invoked when first-tier classification is uncertain. These agents perform more expensive but more accurate analysis.
Architecture: Escalation → DeepAnalysisOrchestrator → [DeepAnalysts] → FinalDecision
Deep Analysts: 1. SemanticSimilarityAnalyst - Compare against known exemplars using embeddings 2. ContextualAnalyst - Analyze directory context, sibling files, naming patterns 3. ContentReasoningAnalyst - Deep content analysis with structured reasoning 4. CrossReferenceAnalyst - Check references, links, and relationships
File: deep_analysts.py
Classes
DeepAnalystType
Types of deep analysis agents.
DeepAnalysisVote
Vote from a deep analysis agent.
DeepAnalysisResult
Result from the deep analysis pipeline.
SemanticSimilarityAnalyst
Analyzes document similarity to known exemplars.
ContextualAnalyst
Analyzes document context including directory structure,
ContentReasoningAnalyst
Performs deep content analysis with structured reasoning.
CrossReferenceAnalyst
Analyzes cross-references, links, and relationships to other documents.
DeepAnalysisOrchestrator
Orchestrates deep analysis for escalated documents.
Functions
analyze(doc, original_votes)
Compare document against known exemplar patterns.
analyze(doc, original_votes)
Analyze document context for classification hints.
analyze(doc, original_votes)
Deep content analysis with structured reasoning.
analyze(doc, original_votes)
Analyze document references and relationships.
analyze_escalation(doc, original_result)
Perform deep analysis on an escalated document.
should_escalate_to_human(result)
Determine if document needs human review after deep analysis.
get_analysis_summary(result)
Get a human-readable summary of deep analysis.