Pact — Hybrid Token-Efficient Routing Agent

Created by team Loom on July 11, 2026
Hybrid Token-Efficient Routing Agent

Pact is a hybrid token-efficient routing agent for Track 1 of the AMD Developer Hackathon ACT II. It minimizes Fireworks token consumption while maintaining high accuracy across eight task categories: factual QA, math, coding, sentiment, summarization, NER, logic, and debugging. Architecture (three tiers, zero wasted tokens): 1. Heuristic Triage (0 tokens). A regex-based classifier determines task domain and difficulty in under 1ms — no model call, no tokens spent. Easy tasks route to the cheapest model (gpt-oss-120b), hard tasks cascade through stronger models. 2. Cascade Execution (cheapest sufficient model). Each task starts on gpt-oss-120b ($0.15/1M tokens). An output quality gate validates every response: checks for emptiness, gibberish, refusals, and domain-specific correctness (math answers must have numbers, coding answers must contain code patterns, Q&A must be prose). If quality fails, the task escalates to kimi-k2p6 ($0.95/1M) and then to deepseek-v4-pro ($1.74/1M). At max tier with bad output, the system returns FAIL — so the scoring harness can distinguish "good answer" from "best effort, bad result." 3. Self-Consistency Verification (0 extra tokens on easy tasks). For medium and hard tasks, the cheap model runs twice. If the two outputs disagree, the task escalates immediately — catching hallucinations before they reach the output. No extra Fireworks calls; the second run is on the same tier, not a stronger one. Tech stack: Python 3.12, OpenAI SDK (Fireworks-compatible), regex-based heuristics, no external ML dependencies. Runs in a lightweight Docker image (python:3.12-slim, ~150MB) without any local model — all inference happens on Fireworks AI. Design philosophy: "Spend on what moves the needle." Heuristics are free. Quality gates prevent wasted escalation. Self-consistency catches cheap-model mistakes before paying for a stronger model. Every token is accounted for.

Category tags: