QuoxEngine
The task orchestration spine of QuoxCORE. Decomposes objectives into tasks, executes them across specialist agents, recovers from failures, and tracks performance. Ships with every QuoxCORE installation.
Overview
QuoxEngine handles the full lifecycle of an objective: decomposition into a task DAG, agent assignment (with optional learning router override), parallel execution with heartbeat monitoring, failure recovery (guided retry, circuit breaker, fallback routing), and completion with structured results.
It is NOT a workflow engine (that's QuoxFlow). QuoxEngine handles adaptive, AI-driven objectives where the plan is created at runtime by the orchestrator LLM. QuoxFlow handles deterministic, pre-built automation pipelines.
Execution Model
The execution loop runs every 5 seconds:
- Find running objectives — scan
objectivestable forstatus = 'running' - Check dependencies — skip objectives blocked by parent objectives
- Check budget — skip if token/tool-call limits exhausted
- Find ready tasks — tasks with all dependencies met and no pending checkpoints
- Pipeline stage enforcement — for pipeline topology, block tasks whose stage predecessors haven't completed
- Atomic claim —
UPDATE WHERE status = 'pending'prevents double execution - Execute — call collector agent invoke, heartbeat every 15s
- Record performance — success/failure, latency, tokens, quality score
- Check completion — when all tasks are terminal, finalise the objective
scheduler.tick() → findAllReadyTasks() → claimTask() → executeTask() → recordPerformance() → checkObjectiveCompletion()
Topology Modes
Teams define their coordination pattern via the topology field in the manifest:
| Mode | Prompt | Best For |
|---|---|---|
| Star (default) | Independent tasks, one per specialist, parallel | Small teams, MVPs, bug fixes |
| Hierarchical | High-level work packages for sub-orchestrators | Medium-large teams, sprints |
| Pipeline | Sequential stages, each completes before next | CI/CD, spec→design→build→test |
| Mesh | Cross-referencing tasks with final synthesis | Research, brainstorming, reviews |
// Team manifest topology field
{
"topology": {
"type": "hierarchical",
"subOrchestrators": ["system-architect", "qa-lead"],
"maxDepth": 2
}
}Learning Router
After every task, QuoxEngine records the agent's performance (success, latency, tokens, quality). When decomposing future objectives, the epsilon-greedy router can override the LLM's agent assignment with a better-performing candidate.
Composite score: success_rate × 0.35 + speed × 0.20 + cost × 0.20 + quality × 0.25
Quality heuristic: base 50, +20 schema valid, +10 result length, +10 tools used, +10 first attempt
Exploration: 10% of the time, a random agent is selected instead of the best — this allows the router to discover improving agents.
Confidence ramps from 0 to 1 over 30 tasks. Until confident, the LLM's choice is respected.
Recovery & Resilience
- Crash recovery: On startup, scans for tasks stuck in 'running' with stale heartbeats. Marks as failed, triggers orchestrator kickback.
- Orphan reaper: Runs every 60 seconds. Detects tasks with no heartbeat in 2× the expected interval.
- Cancellation guard: All completion UPDATEs include
WHERE status NOT IN ('cancelled', 'skipped'). - In-flight abort: AbortController registry allows external cancellation of running HTTP requests.
- Exponential backoff: 30s, 2m, 10m (configurable per team).
- Guided retry: Orchestrator reviews the failure, rewrites the prompt, tries a different approach.
- Circuit breaker: N consecutive failures → pause objective, escalate to inbox.
- Fallback routing: When retries exhausted, domain-compatible agent substituted automatically.
Policy Configuration
All policies are per-team via the manifest policies object:
| Policy | Default | Description |
|---|---|---|
maxParallelTasks | 3 | Max tasks running simultaneously |
maxTaskDurationMs | 1800000 (30m) | Per-task timeout |
maxTaskRetries | 2 | Max retries before skip/fallback |
retryBackoffSeconds | [30, 120, 600] | Exponential backoff schedule |
circuitBreakerThreshold | 3 | Consecutive failures before pause |
resultTruncationChars | 2000 | Max chars injected into next task |
learningRouterEnabled | true | Enable/disable learning router |
allowOverlap | false | Allow concurrent scheduled runs |