This project implements a cost-optimized routing agent for Track 1 of the AMD Developer Hackathon. Instead of sending every task to a paid Fireworks AI model, the agent tries three progressively more expensive strategies in order: first, a zero-cost deterministic Python solver handles math word problems with 100% accuracy. Second, a local Ollama model (qwen2.5:3b, 4-bit quantized to fit the 4GB RAM grading environment) attempts every remaining task for free. Third, only if a custom accuracy gate rejects the local answer does the agent escalate to Fireworks AI, automatically selecting the cheapest available model from the ALLOWED_MODELS list based on parameter count. The accuracy gate combines category-specific checks (Python AST parsing to verify code syntax, numeric presence checks for math, hedge-phrase detection) with a self-critique step for high-risk categories like factual and logical reasoning questions, where the local model reviews its own answer before it's accepted. The entire pipeline, including Ollama and the model weights, is baked into the Docker image at build time to meet the 60-second container startup requirement, and the image is built and published automatically via a GitHub Actions CI pipeline.
Category tags: