Hybrid Token-Efficient Routing Agent

Created by team Muhammad Yaseen on July 11, 2026

Track 1 asks for a general-purpose agent that handles 8 capability categories - factual knowledge, math reasoning, sentiment classification, summarisation, named entity recognition, code debugging, logical reasoning, and code generation - while minimizing scored tokens spent through Fireworks AI. My approach is a 3-tier router. Tier 0 is a deterministic solver that handles pattern-matched arithmetic and percentage word problems in pure Python - zero tokens - and only fires when the pattern is confidently recognized, otherwise falling through safely to Tier 2 rather than risking a wrong guess. Tier 1 is a zero-token heuristic classifier (regex/keyword based) that infers which of the 8 categories a task belongs to, purely to select the right prompt template - it never answers the task itself. Tier 2 calls Fireworks AI with a concise, category-tuned prompt and a capped max_tokens, using the cheapest model available in ALLOWED_MODELS. The container reads /input/tasks.json and writes /output/results.json per the hackathon's I/O contract, is ready within seconds, and completes well under the 10-minute cap. It is built with Python 3.11 and uv, tested with 38 unit tests plus a 24-task local eval harness (16/16 correctness checks passing, all 8 categories covered), and shipped through a full Spec-Driven Development pipeline (Constitution to Specify to Plan to Tasks to Implement) via SpecKit Plus. The published GHCR image was pulled fresh and re-verified against the container I/O contract before submission.

Category tags: