[Worker] Template system for worker definitions #59

Closed
opened 2026-03-25 03:23:40 +00:00 by Mark · 1 comment
Owner

Problem

Workers are currently defined with hardcoded parameters. Need a template system for:

  • Reproducible worker configurations
  • Role-based worker variants
  • Easy worker customization
  • Version-controlled worker specs

Current State

# Hardcoded in run.py
worker_definition = {
    "profile": "standard",
    "capabilities": [...],
    "trust_tier": "high",
    # ...
}

Proposed Template System

1. Template Directory Structure

templates/workers/
├── roles/
│   ├── generalist.yaml    # Jack of all trades
│   ├── specialist.yaml    # Deep expertise, narrow scope
│   ├── researcher.yaml    # Exploration, analysis
│   └── executor.yaml      # Fast, reliable execution
├── economics/
│   ├── budget_conscious.yaml   # Low bond, conservative
│   ├── performance.yaml        # High bond, aggressive
│   └── balanced.yaml           # Middle ground
└── compositions/
    ├── edge_node.yaml     # Edge deployment config
    ├── cloud_burst.yaml   # Cloud worker template
    └── gpu_enabled.yaml   # GPU capability bundle

2. Template Schema

template:
  name: specialist
  version: 1.0.0
  
base_profile:
  role: specialist
  max_parallel_intents: 3
  timeout_multiplier: 1.5

capability_weights:
  # Prefer capabilities matching this pattern
  preferred_classes: [muscle]
  preferred_skills: [ai-engineer, coding]
  
economics:
  bond_strategy: conservative
  min_bond: 15
  max_bond: 100
  
selection_criteria:
  # How this worker selects intents
  min_confidence: 0.8
  max_queue_depth: 5
  
resource_limits:
  memory_mb: 512
  cpu_percent: 50

3. Template Application

# worker_factory uses templates
worker_def = apply_template(
    base="specialist",
    economics="performance", 
    composition="gpu_enabled",
    overrides={"max_bond": 200}
)

4. Template Evolution

  • Templates versioned in git
  • A/B testing different templates
  • Championship selects best templates
  • Templates compose (inheritance + mixins)

Use Cases

  1. Edge Workers: Low resource, intermittent connectivity
  2. Cloud Burst: High capacity, higher latency
  3. GPU Workers: Expensive, specialized compute
  4. Research Workers: Exploration, low success rate OK

Implementation

  1. Create runtime/template_registry.py
  2. Update worker_factory to use templates
  3. Add template validation (schema)
  4. Template inheritance and composition
  • worker_factory already resolves skills
  • skill_author creates new skills
  • championship can select best templates
## Problem Workers are currently defined with hardcoded parameters. Need a template system for: - Reproducible worker configurations - Role-based worker variants - Easy worker customization - Version-controlled worker specs ## Current State ```python # Hardcoded in run.py worker_definition = { "profile": "standard", "capabilities": [...], "trust_tier": "high", # ... } ``` ## Proposed Template System ### 1. Template Directory Structure ``` templates/workers/ ├── roles/ │ ├── generalist.yaml # Jack of all trades │ ├── specialist.yaml # Deep expertise, narrow scope │ ├── researcher.yaml # Exploration, analysis │ └── executor.yaml # Fast, reliable execution ├── economics/ │ ├── budget_conscious.yaml # Low bond, conservative │ ├── performance.yaml # High bond, aggressive │ └── balanced.yaml # Middle ground └── compositions/ ├── edge_node.yaml # Edge deployment config ├── cloud_burst.yaml # Cloud worker template └── gpu_enabled.yaml # GPU capability bundle ``` ### 2. Template Schema ```yaml template: name: specialist version: 1.0.0 base_profile: role: specialist max_parallel_intents: 3 timeout_multiplier: 1.5 capability_weights: # Prefer capabilities matching this pattern preferred_classes: [muscle] preferred_skills: [ai-engineer, coding] economics: bond_strategy: conservative min_bond: 15 max_bond: 100 selection_criteria: # How this worker selects intents min_confidence: 0.8 max_queue_depth: 5 resource_limits: memory_mb: 512 cpu_percent: 50 ``` ### 3. Template Application ```python # worker_factory uses templates worker_def = apply_template( base="specialist", economics="performance", composition="gpu_enabled", overrides={"max_bond": 200} ) ``` ### 4. Template Evolution - Templates versioned in git - A/B testing different templates - Championship selects best templates - Templates compose (inheritance + mixins) ## Use Cases 1. **Edge Workers**: Low resource, intermittent connectivity 2. **Cloud Burst**: High capacity, higher latency 3. **GPU Workers**: Expensive, specialized compute 4. **Research Workers**: Exploration, low success rate OK ## Implementation 1. Create `runtime/template_registry.py` 2. Update `worker_factory` to use templates 3. Add template validation (schema) 4. Template inheritance and composition ## Related - worker_factory already resolves skills - skill_author creates new skills - championship can select best templates
Author
Owner

Closed: implementation already shipped on main as 687044b (see commit message). Verified locally: feature is in main.

Closed: implementation already shipped on `main` as `687044b` (see commit message). Verified locally: feature is in `main`.
Mark 2026-07-15 12:08:54 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
Mark/mesh-seed#59
No description provided.