Routing coding agents to the right Bedrock model with NeMo Switchyard
Coding agents like Claude Code and Codex CLI work in tasks, not single calls: one request may trigger a few model calls or dozens, and you pay for every attempt, including ones that never finish. That makes price per token a poor guide to what a task actually costs, since turns, replayed history, and retries all add up. The authors argue routing decisions should instead be judged by cost per solved task — total run cost divided by the number of runs whose tests pass.
Coding agents like Claude Code and Codex CLI work in tasks, not single calls: one request may trigger a few model calls or dozens, and you pay for every attempt, including ones that never finish. That makes price per token a poor guide to what a task actually costs, since turns, replayed history, and retries all add up. The authors argue routing decisions should instead be judged by cost per solved task — total run cost divided by the number of runs whose tests pass.
The post is a deployment walkthrough, not a benchmark study. Using AWS CDK, it stands up LiteLLM — an open-source gateway that speaks the OpenAI API — with NVIDIA's NeMo Switchyard routing plugin in one container on ECS Fargate, in private subnets, calling models on Amazon Bedrock. Clients point at a model group named `switchyard`; the plugin picks the actual model. Two strategies are supported: Stage routing reads recent tool activity and results in the request history and chooses between exactly two candidates (a capable model and a cheaper one), while Random routing splits traffic across a weighted pool for A/B tests. Neither calls a judge model, but Stage requires the agent to send full conversation history. Classifier-based strategies such as Task and Composite routing are not supported here because they need extra model calls. The surrounding plumbing is where most of the detail lives: HTTPS with an ACM certificate, WAF rules for IP reputation, bad inputs, and a per-IP rate limit of 2,000 requests per 5 minutes, a required `allowedCidr` that the stack refuses to synthesize without (and rejects if world-open or IPv6), and a load balancer path allowlist that keeps the LiteLLM admin UI and key-management routes unreachable. The response header `x-litellm-model-name` reveals which model answered. The authors are explicit that this is non-production sample code: `switchyard-server` 0.3.0 is documented by NVIDIA as a demo component, the LiteLLM integration is experimental, and configuration may change between releases. They also warn that a plain-HTTP opt-in sends keys, prompts, and source code unencrypted, and should only be used briefly with non-sensitive code. The sample ships benchmark runners so you can measure cost per solved task for a routed group against single-model baselines on your own tasks — but the post reports no measured results of its own.
If you run coding agents, evaluate model routing on cost per solved task rather than token price, and treat this sample as a starting point to measure on your own workload — not as evidence that routing already saves money.