Package com.tnsai.coordination.hierarchical


package com.tnsai.coordination.hierarchical
Hierarchical Language Model (HLM) pattern implementation.

This package provides explicit layer separation for complex multi-step tasks following the HLM (Hierarchical Language Model) architectural pattern.

Architecture Layers

 ┌─────────────────────────────────────────────────────────────┐
 │                    STRATEGIC LAYER                          │
 │           (Goal Decomposition, High-level Planning)         │
 │                         ↓                                   │
 ├─────────────────────────────────────────────────────────────┤
 │                    TACTICAL LAYER                           │
 │         (Sub-task Breakdown, Coordination, Dependencies)    │
 │                         ↓                                   │
 ├─────────────────────────────────────────────────────────────┤
 │                   OPERATIONAL LAYER                         │
 │            (Action Execution, Concrete Results)             │
 └─────────────────────────────────────────────────────────────┘
 

Key Components

Usage Example


 // Create orchestrator with specialized agents per layer
 HierarchicalAgentOrchestrator orchestrator = HierarchicalAgentOrchestrator.builder()
     .strategicAgent(plannerAgent)      // High-level goal decomposition
     .tacticalAgent(coordinatorAgent)   // Sub-task breakdown
     .operationalAgents(workerAgents)   // Execution
     .parallelOperations(true)          // Execute operations in parallel
     .build();

 // Execute a complex task
 HierarchicalResult result = orchestrator.execute("Build a web scraper for news sites");

 // Result contains:
 // - Strategic decomposition: crawler, parser, storage components
 // - Tactical planning: implementation order, dependencies
 // - Operational results: code, tests, deployment for each component

 System.out.println("Tasks executed: " + result.totalTaskCount());
 System.out.println("Duration: " + result.durationMillis() + "ms");
 System.out.println(result.result());
 

Benefits

  • Clear separation of concerns between planning and execution
  • Better handling of complex, multi-step tasks
  • Improved error recovery at each level
  • Parallel execution at operational level
  • Traceable task hierarchy for debugging
Since:
0.1.0
See Also: