Phoenix Router

A general-purpose AI agent that answers eight task categories while spending zero Fireworks tokens.

0 tokens · every task answered · AMD Developer Hackathon ACT II, Track 1
factualmathsentimentsummarization NERcode debuglogiccode gen

The insight

Track 1 ranks submissions that pass an LLM-judged accuracy gate by total Fireworks tokens, ascending. The rules state that local inference inside the container counts fully toward accuracy — and zero toward the token score. So the winning router is the one that never has to leave the box.

0
Fireworks tokens in a normal run
19
hidden evaluation tasks, 8 categories
7.5 / 10 min
we finish in 7.5 — a safe margin under the 10 min hard cap · 4 GB · 2 vCPU

Architecture: local-first cascade

1

Regex task classifier

Maps each prompt to one of 8 capability categories. Deterministic, microseconds, free.

2

Local Qwen3.5-2B on llama.cpp (CPU)

4-bit quantized, 1.3 GB, category-tuned prompts. Answers everything for zero tokens. Logic puzzles get a 3-sample majority vote; generated code executes its own tests before answering.

3

Fireworks safety net

The smallest model in ALLOWED_MODELS, called through FIREWORKS_BASE_URL — only if the local path fails or time runs low. In normal runs it is never touched.

Engineered to never fail the harness

Adaptive budgets

The agent measures real tokens/sec after a warm-up request and sizes every generation so the batch finishes inside the 10-minute cap.

Easy-first ordering

Light categories run first; if time gets tight only the reasoning-heavy tasks see smaller budgets.

Self-testing code

Generated code is executed against separately generated asserts inside the container; failures trigger one corrected retry.

Answer-line guarantee

Math and logic answers always end with a final Answer: line — truncations trigger a compact free retry.

Always valid output

results.json is always written, always valid JSON, and the container always exits 0.

Env-driven config

FIREWORKS_API_KEY, FIREWORKS_BASE_URL, ALLOWED_MODELS — read at runtime, nothing hardcoded.

Run it

docker run --rm --cpus=2 --memory=4g \
  -v "$PWD/input:/input:ro" -v "$PWD/output:/output" \
  ghcr.io/sheetaljatav/phoenix-router:latest

Reads /input/tasks.json, writes /output/results.json. Image is linux/amd64, ~2 GB compressed, rebuilt on every push by GitHub Actions.