Worker Tools
delegate_task
Section titled “delegate_task”Route a task to a cheaper model, or summarize vault files automatically.
# Task delegationdelegate_task( prompt="Explain this regex: ^(?:[a-z0-9]+\.)*[a-z0-9]+$", context="", # optional context to include max_cost_per_request=0, # 0 = free models only model="" # explicit model override)
# Vault file summarizationdelegate_task( project="my-project", section="context", # or use path="..." max_summary_lines=20 # target summary length)Task Delegation
Section titled “Task Delegation”When prompt is provided, tasks are routed through tiers in order:
- Ollama (local) — Free. Best for trivial tasks. Falls through if unavailable.
- OpenRouter free — Free tier models (e.g., Qwen3 Coder 480B). Real code work.
- OpenRouter paid — Only when
max_cost_per_request > 0and monthly budget allows. Model configurable viaHIVE_OPENROUTER_PAID_MODEL. - Reject — Returns error so the host handles the task directly.
Vault Summarization
Section titled “Vault Summarization”When project is provided, reads a vault file:
- Small files (≤50 lines): returned directly with metadata
- Large files (>50 lines): auto-delegated to a worker for summarization. Falls back to raw content if workers are unavailable.
Explicit Model Selection
Section titled “Explicit Model Selection”Skip routing and target a specific provider:
# Force local Ollamadelegate_task(prompt="...", model="ollama:qwen2.5-coder:7b")
# Force OpenRouter freedelegate_task(prompt="...", model="openrouter:qwen/qwen3-coder:free")
# Force OpenRouter paiddelegate_task(prompt="...", model="openrouter:qwen/qwen3-coder", max_cost_per_request=0.01)Response Format
Section titled “Response Format”Each response includes a metadata footer:
[model: qwen2.5-coder:7b | provider: ollama | cost: $0.00 | latency: 2.1s]worker_status
Section titled “worker_status”Show worker health, budget, and available models.
# Full status with model listingworker_status()
# Status without model listingworker_status(include_models=False)Returns:
- Monthly budget remaining (spent / cap)
- Ollama connectivity status
- OpenRouter connectivity status
- Request counts and cost breakdown
- Available models across all providers (when
include_models=True)