Routing Calibration Loop
DevOps & Securityrouting-calibration-loopRouting Calibration Loop is an Agent Skill for devops & security published in the vllm-project/semantic-router repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.
Calibrates routing changes against a live router endpoint with executable probes, local DSL validation, versioned deploys, and structured failure review. Use when tuning signals, projections, decisions, or maintained route examples against a real apiserver.
QUICK START
How to use this skill
Bring this guide into your coding agent with a prompt tailored to the tool you use.
- Open your project in Codex.
- Copy and paste the prompt below.
- Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/vllm-project/semantic-router/blob/HEAD/tools/agent/skills/maintainer/routing-calibration/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/routing-calibration-loop, but wait for my approval before writing files or running scripts.
Copying this prompt does not install or run the skill. Review third-party files before use.
Routing Calibration Loop
Trigger
- Use when a signal, projection, decision, or maintained routing example needs to be checked against a live router apiserver
- Use when a routing failure must be classified as a bad probe, bad routing policy, or bad validator rule instead of blindly patching the profile
- Use when a maintainer wants the loop
eval -> update -> validate -> deploy -> evalto be run with versioned evidence
Required Surfaces
harness_docs
Conditional Surfaces
harness_execrouter_service_platformrouter_config_contractsignal_runtimedecision_logicalgorithm_selectiondsl_crddocs_examples
Stop Conditions
- No live router base URL is available and no local replacement environment has been chosen
- No probe manifest exists and the task cannot safely infer executable probes from maintained examples
- A deploy would change remote runtime state without capturing the current version or without a rollback path
- Local validation fails for reasons that are not yet understood or recorded
Workflow
- Start from executable probes, not prose examples.
- Prefer a machine-readable manifest.
deploy/recipes/balance.probes.yamlis the default maintained example, not the only supported target. - The manifest should stay profile-generic: point to any owned routing YAML / DSL pair through
routing_assets, and group probes by decision with multiple variants when robustness matters. - Treat each probe as both a test case and a specification fragment.
- Prefer a machine-readable manifest.
- Baseline the live router before editing policy.
- Use
tools/agent/scripts/router_calibration_loop.pyto snapshot/config/routerand/config/router/versions, then run/api/v1/evalacross the probe suite. - Record which decision actually fired, which signals matched, and which signals were expected but absent.
- Use
- Classify every failure under one of three buckets before changing anything.
query_quality: the prompt is not a robust representative of the intended route.routing_design: the signal / projection / decision design is too broad, too narrow, or too brittle.validator_quality: the runtime behavior is reasonable but static validation is over-reporting or under-reporting.
- Edit the canonical authoring surface locally.
- For maintained routing, edit the owned YAML / DSL asset pair instead of patching only the live server.
- Do not add narrow trigger-phrase hacks just to pass one probe.
- Run local validation before deploying.
- Use the runner's
runorvalidatepath to executesr-dsl validateagainst the DSL source, or against a YAML file through decompile-then-validate. - Prefer manifest-owned assets as defaults, but allow explicit YAML / DSL overrides for any other routing profile.
- Keep validation output with the loop artifacts so validator behavior can be reviewed alongside runtime eval output.
- Use the runner's
- Deploy durably and re-evaluate.
- Use
PUT /config/routerfor versioned full-document replacement so the live router exactly matches the canonical YAML being calibrated. - After every config update, wait for
GET /readyto returnready=truebefore trustingevalresults. Do not treat a successful update response as proof that router initialization has finished. - Re-run the same probe suite after deploy and compare before / after success rate and per-probe traces.
- Use
- Close the loop with structured reflection.
0. Query quality: Is the probe semantically representative, or is it a brittle phrase trigger?1. Routing design: Are the signal, projection, and decision boundaries robust, or merely sufficient for this probe set?2. Validator quality: Do warnings or failures reflect real ambiguity, or missing static semantics?
- If a durable architecture gap remains, update the indexed debt entry instead of leaving the mismatch only in chat or the report.
Gotchas
- The calibration loop now deploys with
PUT /config/router, so the calibrated YAML must be a complete router document, not a partial merge fragment. - Do not declare success just because one crafted query passes. Probe quality is part of the task; decision-level robustness should be checked with multiple variants, not just one trigger phrase.
- If runtime eval looks correct and validation still looks wrong, assume validator semantics may need work rather than forcing a worse route design.
- If deploy succeeds but success rate regresses, capture the returned version and use the versions endpoint before continuing.
Must Read
- AGENTS.md
- deploy/amd/README.md
- deploy/recipes/balance.probes.yaml
- tools/agent/scripts/router_calibration_loop.py
Standard Commands
python3 tools/agent/scripts/router_calibration_loop.py eval --router-url http://<router-host>:8080 --probes <profile>.probes.yamlpython3 tools/agent/scripts/router_calibration_loop.py run --router-url http://<router-host>:8080 --probes <profile>.probes.yamlpython3 tools/agent/scripts/router_calibration_loop.py run --router-url http://<router-host>:8080 --probes <profile>.probes.yaml --yaml <routing>.yaml --dsl <routing>.dslpython3 tools/agent/scripts/router_calibration_loop.py deploy --router-url http://<router-host>:8080 --yaml <routing>.yaml --dsl <routing>.dsl --ready-timeout 300make agent-report ENV=amd CHANGED_FILES="deploy/recipes/balance.yaml,deploy/recipes/balance.dsl,deploy/amd/README.md"make agent-ci-gate CHANGED_FILES="tools/agent/skills/maintainer/routing-calibration/SKILL.md,tools/agent/scripts/router_calibration_loop.py,deploy/recipes/balance.probes.yaml"
Acceptance
- Each calibration round produces a probe report with before / after outcomes, live decision traces, and the captured deploy version when a deploy occurs
- Failures are explicitly reviewed under query quality, routing design, and validator quality instead of being patched blindly
- Maintained routing changes are validated locally before deploy and re-evaluated on the live endpoint after deploy
- The loop leaves behind executable probes or maintained examples that are stronger than the ones it started with, ideally by improving decision-level variant coverage instead of adding single-example hacks