Token Optimization Agent is a general-purpose AI agent built for AMD Developer Hackathon ACT II, Track 1. The project solves the challenge of answering diverse natural-language tasks while spending the fewest possible Fireworks API tokens. It reads a batch of tasks from /input/tasks.json, classifies each prompt into one of the required categories, and routes it through the cheapest reliable path: deterministic local logic where possible, a baked-in local Llama 3.2 3B GGUF model for zero-token answers, or an allowed Fireworks model only when higher accuracy is needed. The agent supports factual questions, math reasoning, sentiment classification, summarisation, named entity recognition, code debugging, logical reasoning, and code generation. It is packaged as a Docker image and follows the judging contract by writing valid /output/results.json for every task and exiting cleanly. The implementation includes timeout protection, adaptive local-to-remote degradation, role-based model selection from ALLOWED_MODELS, reasoning suppression to reduce token waste, and execution-based verification for generated Python code.
Category tags: