learning_orchestrator
learning_orchestrator
¶
LearningOrchestrator — coordinate the full trace->learn->eval loop.
Pulls traces from a :class:TraceStore, mines training data via
:class:TrainingDataMiner, evolves agent configs via
:class:AgentConfigEvolver, optionally runs LoRA fine-tuning, and
gates acceptance on an evaluation function.
Classes¶
LearningOrchestrator
¶
LearningOrchestrator(*, trace_store: Any, config_dir: Union[str, Path], eval_fn: Optional[Callable[[], float]] = None, min_improvement: float = 0.02, min_sft_pairs: int = 10, min_quality: float = 0.7, lora_config: Optional[Any] = None, model_name: Optional[str] = None)
Orchestrate a single trace->learn->eval cycle.
| PARAMETER | DESCRIPTION |
|---|---|
trace_store
|
Object with
TYPE:
|
config_dir
|
Directory where agent TOML configs are written / evolved.
TYPE:
|
eval_fn
|
Optional callable returning a float score (higher = better). Called before and after learning to gate acceptance.
TYPE:
|
min_improvement
|
Minimum improvement in eval score required to accept the update.
TYPE:
|
min_sft_pairs
|
Minimum number of SFT pairs required to trigger LoRA training.
TYPE:
|
min_quality
|
Minimum feedback quality threshold for :class:
TYPE:
|
lora_config
|
Optional :class:
TYPE:
|
model_name
|
Model name for LoRA training (passed to :class:
TYPE:
|
Source code in src/openjarvis/learning/learning_orchestrator.py
Functions¶
run
¶
Execute one learning cycle.
| PARAMETER | DESCRIPTION |
|---|---|
agent_id
|
When provided, only traces from this agent are considered.
TYPE:
|
Returns
|
|
Steps
- Mine traces: extract sft_pairs, routing_pairs, agent_pairs
- If no data: return skipped
- Run baseline eval (if eval_fn provided)
- Update routing recommendations
- Evolve agent configs
- Run LoRA training (if lora_config provided AND enough pairs AND torch available)
- Run post-learning eval (if eval_fn provided)
- Accept/reject based on improvement threshold
Source code in src/openjarvis/learning/learning_orchestrator.py
77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | |