Switchyard lets LLM applications route traffic across models and providers while preserving native OpenAI and Anthropic API compatibility - enabling flexible model selection, benchmarking, and cost/performance optimization.
Rust
feat(composite): align defaults with unified routing design (#1245)
ryan-lempkaf3744c82d17b
diff --git a/benchmark/DEEPSWE_V11_COMPOSITE_REPORT.md b/benchmark/DEEPSWE_V11_COMPOSITE_REPORT.mdnew file mode 100644index 000000000..578e8129a--- /dev/null+++ b/benchmark/DEEPSWE_V11_COMPOSITE_REPORT.md@@ -0,0 +1,68 @@+# DeepSWE v1.1 Composite results++Three full 113-task repeats measured Composite with GPT-6 Astra at medium effort,+GPT-6 Luna at max effort, and Luna as the Decision model. The campaign ran from+October 31 to November 1, 2026, using Switchyard revision+`bdd7647b5d55be46b19764136128646edb08692e`, Codex CLI 0.154.0, and Harbor 0.13.2.+They used closed-book execution and a maximum of five concurrent tasks.+These historical results support the routing recipe. They do not measure the+current PR commit.++## Results++Costs use recorded tokens at fixed base rates. Each cost is for a full 113-task run.++| Configuration | Passes by repeat | Task completion | Mean cost per run |+| --- | --- | ---: | ---: |+| Composite CF0/EF0.4 | 79, 79, 82 | 240/339, 70.80% | $269.99 |+| Astra only | 83, 78, 82 | 243/339, 71.68% | $362.19 |++Composite used 25.45% less recorded-token cost, with task completion 0.88 percentage+points lower. All tasks remain in the denominator, including two verifier timeouts+in the second Composite repeat. Three repeats do not establish statistical+equivalence or generalization to other workloads.++The [JSON results](deepswe-v11-composite-results.json) include all six run IDs,+pass counts, token totals, pricing rates, and source hashes.++## Configuration++The [route configuration](routing-profiles/deepswe-v11-composite-astra-luna.toml)+expresses the measured settings using the current configuration schema. Merge it+with deployment bindings for `astra` at medium effort, `luna` at max effort, and+the `classifier` Decision target using Luna. Serving endpoints are deployment-specific.++- One profile selection per session, with `classify_trigger = "new_session"`.+- Decision cutoff `0.92`, with capable-first selected only above the cutoff.+- Efficient-first threshold `0.4`, capable hold `2`, efficient hold `0`.+- Capable-first threshold `0.0`, capable hold `0`, efficient hold `-1`.+- A window of three recent tool results and the capable-first planning prompt.+- No inner judge or handoff notes. The measured configuration used `fail_open = false`.++The current default [Decision instructions](https://github.com/NVIDIA-NeMo/Switchyard/blob/5bde8855556c242d4a994b5d985a2d66947f7665/crates/libsy/src/algorithms/llm_class/decision.rs)+and [Composite planning prompt](https://github.com/NVIDIA-NeMo/Switchyard/blob/5bde8855556c242d4a994b5d985a2d66947f7665/crates/switchyard-runner/src/algorithm.rs)+match the saved recipe, with choice IDs renamed from `capable_first` and+`efficient_first` to `capable` and `efficient`. The route file inherits those+prompts. Interactive `user_turn` selection was not measured in these runs.++## Cost accounting and coverage++The same rates apply to both configurations, in USD per million tokens:++| Model | Input | Cached input | Cache creation | Output |+| --- | ---: | ---: | ---: | ---: |+| GPT-6 Astra | 10.00 | 1.00 | 12.50 | 50.00 |+| GPT-6 Luna | 0.10 | 0.01 | 0.125 | 0.50 |++Prompt-token totals include cached input and cache creation. Subtract both before+pricing ordinary input. Recorded selector tokens are included. Infrastructure and+verifier costs are outside this model-token comparison.++Two interrupted Composite answer calls have missing usage. The Astra baseline has+priced usage for 109, 111, and 111 tasks. Its shared logs also contain unmatched+requests that cannot all be attributed to these runs. Per-request long-context+pricing is unverified. The 25.45% reduction compares incomplete recorded-token+estimates, not complete bills or a guaranteed savings bound.++Tuning and evaluation task overlap has not been independently verified. The live+results above should not be presented as held-out validation.diff --git a/benchmark/deepswe-v11-composite-results.json b/benchmark/deepswe-v11-composite-results.jsonnew file mode 100644index 000000000..8a5152dff--- /dev/null+++ b/benchmark/deepswe-v11-composite-results.json@@ -0,0 +1,208 @@+{+ "benchmark": "DeepSWE v1.1",+ "benchmark_revision": 1,+ "tasks_per_repeat": 113,+ "scoring": "Reward 1 counts as a pass. All 113 tasks remain in every denominator.",+ "cost_basis": "Recorded model tokens at fixed base rates. Incomplete usage and per-request context tiers prevent a complete billed-cost claim.",+ "rates_usd_per_million_tokens": {+ "gpt-6-astra": {+ "input": 10,+ "cached_input": 1,+ "cache_creation": 12.5,+ "output": 50+ },+ "gpt-6-luna": {+ "input": 0.1,+ "cached_input": 0.01,+ "cache_creation": 0.125,+ "output": 0.5+ }+ },+ "campaigns": [+ {+ "name": "Composite CF0/EF0.4",+ "repeats": 3,+ "passed": 240,+ "attempts": 339,+ "accuracy_percent": 70.79646017699115,+ "mean_recorded_token_cost_usd": 269.994194735,+ "runs": [+ {+ "run_id": "bmr_d04a102d53194beaae0b38c323",+ "tasks": 113,+ "passed": 79,+ "recorded_token_cost_usd": 276.633197045,+ "usage_by_model": {+ "gpt-6-astra": {+ "calls": 1992,+ "prompt_tokens": 105554383,+ "completion_tokens": 1734883,+ "cached_tokens": 98884683,+ "cache_creation_tokens": 6663724+ },+ "gpt-6-luna": {+ "calls": 4825,+ "prompt_tokens": 409398780,+ "completion_tokens": 3968251,+ "cached_tokens": 395724617,+ "cache_creation_tokens": 13570643+ }+ },+ "tasks_with_priced_usage": 113,+ "selector_calls_included": 113,+ "answer_calls_missing_usage": 2,+ "initial_profile_split": {+ "CF": 55,+ "EF": 58+ },+ "runtime_errors": 0,+ "recovered_stream_disconnects": 2+ },+ {+ "run_id": "bmr_758ff230283840288fcd852460",+ "tasks": 113,+ "passed": 79,+ "recorded_token_cost_usd": 236.390371345,+ "usage_by_model": {+ "gpt-6-astra": {+ "calls": 1783,+ "prompt_tokens": 82655166,+ "completion_tokens": 1522243,+ "cached_tokens": 76577516,+ "cache_creation_tokens": 6072301+ },+ "gpt-6-luna": {+ "calls": 4853,+ "prompt_tokens": 417582002,+ "completion_tokens": 4037439,+ "cached_tokens": 404090897,+ "cache_creation_tokens": 13388555+ }+ },+ "tasks_with_priced_usage": 113,+ "selector_calls_included": 113,+ "answer_calls_missing_usage": 0,+ "initial_profile_split": {+ "EF": 52,+ "CF": 61+ },+ "runtime_errors": 2,+ "recovered_stream_disconnects": 0+ },+ {+ "run_id": "bmr_31cafdd1d20941839e87d953cd",+ "tasks": 113,+ "passed": 82,+ "recorded_token_cost_usd": 296.959015815,+ "usage_by_model": {+ "gpt-6-astra": {+ "calls": 2082,+ "prompt_tokens": 119407906,+ "completion_tokens": 1822748,+ "cached_tokens": 112515394,+ "cache_creation_tokens": 6886266+ },+ "gpt-6-luna": {+ "calls": 4475,+ "prompt_tokens": 377823990,+ "completion_tokens": 3790902,+ "cached_tokens": 364830234,+ "cache_creation_tokens": 12892315+ }+ },+ "tasks_with_priced_usage": 113,+ "selector_calls_included": 113,+ "answer_calls_missing_usage": 0,+ "initial_profile_split": {+ "EF": 59,+ "CF": 54+ },+ "runtime_errors": 0,+ "recovered_stream_disconnects": 0+ }+ ]+ },+ {+ "name": "GPT-6 Astra baseline",+ "repeats": 3,+ "passed": 243,+ "attempts": 339,+ "accuracy_percent": 71.68141592920354,+ "mean_recorded_token_cost_usd": 362.185674,+ "runs": [+ {+ "run_id": "bmr_d2123a3199d34856992f9d8d3e",+ "tasks": 113,+ "passed": 83,+ "recorded_token_cost_usd": 356.7353245,+ "usage_by_model": {+ "gpt-6-astra": {+ "calls": 4071,+ "prompt_tokens": 170935373,+ "cached_tokens": 164502447,+ "cache_creation_tokens": 6420167,+ "completion_tokens": 2237064+ }+ },+ "tasks_with_priced_usage": 109,+ "unmatched_routing_requests": 214+ },+ {+ "run_id": "bmr_fa6ac56b867b46f4b64fdadcc3",+ "tasks": 113,+ "passed": 78,+ "recorded_token_cost_usd": 366.437225,+ "usage_by_model": {+ "gpt-6-astra": {+ "calls": 4076,+ "prompt_tokens": 171696488,+ "cached_tokens": 164867070,+ "cache_creation_tokens": 6817190,+ "completion_tokens": 2324660+ }+ },+ "tasks_with_priced_usage": 111,+ "unmatched_routing_requests": 182+ },+ {+ "run_id": "bmr_54841b35c74b46c0a1849b3f23",+ "tasks": 113,+ "passed": 82,+ "recorded_token_cost_usd": 363.3844725,+ "usage_by_model": {+ "gpt-6-astra": {+ "calls": 4040,+ "prompt_tokens": 172015485,+ "cached_tokens": 165225160,+ "cache_creation_tokens": 6778205,+ "completion_tokens": 2266211+ }+ },+ "tasks_with_priced_usage": 111,+ "unmatched_routing_requests": 199+ }+ ]+ }+ ],+ "comparison": {+ "accuracy_delta_percentage_points": -0.8849557522123916,+ "recorded_token_cost_reduction_percent": 25.454203709062217+ },+ "provenance": {+ "composite_run_dates_utc": [+ "2026-10-31",+ "2026-11-01"+ ],+ "composite_switchyard_commit": "bdd7647b5d55be46b19764136128646edb08692e",+ "composite_routing_config_sha256": "025ddd73945162602e1d4db86934b5208223e7e3e6c0fbeef24d1252ea881264",+ "composite_source_report_sha256": "5cf5e3411176ece5820beab37283b260484d1421cb1ce1f6ba06eedac69a2bb2",+ "baseline_source_report_sha256": "e47fc2ce598078ea204b55bd6ae072c13ee67046f0407e46bfd319aeec7b7fbf"+ },+ "limitations": [+ "Composite has two interrupted answer calls with missing usage. Recorded selector tokens are included.",+ "Baseline has priced usage for 109, 111, and 111 tasks. Unmatched requests in shared logs cannot all be attributed to these runs.",+ "The comparison uses base token rates, including cache creation at 1.25 times input. Per-request long-context pricing is unverified.",+ "These are historical runs, not a benchmark of the current PR commit.",+ "Tuning and evaluation task overlap has not been independently verified. Three repeats do not establish statistical equivalence or generalization."+ ]+}diff --git a/benchmark/routing-profiles/deepswe-v11-composite-astra-luna.toml b/benchmark/routing-profiles/deepswe-v11-composite-astra-luna.tomlnew file mode 100644index 000000000..80cd16f5f--- /dev/null+++ b/benchmark/routing-profiles/deepswe-v11-composite-astra-luna.toml@@ -0,0 +1,31 @@+# Merge with deployment bindings for Astra medium, Luna max, and a Luna Decision target.+# Uses the default Decision instructions and Composite planning prompt.++[routes.switchyard]+id = "switchyard"+type = "composite"++[routes.switchyard.classifier]+target = "classifier"+classify_trigger = "new_session"+fail_open = false++[routes.switchyard.classifier.decision]+cutoff = 0.92++[routes.switchyard.stage]+capable_target = "astra"+efficient_target = "luna"+recent_turn_window = 3++[routes.switchyard.efficient]+picker = "efficient_first"+confidence_threshold = 0.4+capable_hold_turns = 2+efficient_hold_turns = 0++[routes.switchyard.capable]+picker = "capable_first"+confidence_threshold = 0.0+capable_hold_turns = 0+efficient_hold_turns = -1diff --git a/crates/switchyard-runner/src/algorithm.rs b/crates/switchyard-runner/src/algorithm.rsindex 357797109..e76aafc0e 100644--- a/crates/switchyard-runner/src/algorithm.rs+++ b/crates/switchyard-runner/src/algorithm.rs@@ -12,12 +12,12 @@ use std::sync::Arc;use libsy::{AdvisorGate, AdvisorGateConfig, Algorithm, BreakerConfig, CapabilityJudgeConfig,ClassifierContractConfig, ClassifierResponseFormat, ClassifyTrigger, CompositeJudgeConfig,- CompositeRouter, CompositeRouterConfig, CustomClassifierConfig, CustomClassifierPolicy,- DEFAULT_UNMATCHED_STEPS, DecisionChoice, DecisionJudgeConfig, DirectClassifierConfig,- EscalationJudgeConfig, GateTrigger, HandoffNoteConfig, LlmCapabilityConfig,- LlmClassifierConfig, LlmFallback, LlmTaskClassifier, Noop, Passthrough, PickerMode, Random,- RuntimeModels, StageRouter, StageRouterConfig, SubagentRouter, SubagentRouterConfig,- TaskClassifierConfig, ToolSemantics, Vgr, VgrConfig,+ CompositeRouter, CustomClassifierConfig, CustomClassifierPolicy, DEFAULT_UNMATCHED_STEPS,+ DecisionChoice, DecisionJudgeConfig, DirectClassifierConfig, EscalationJudgeConfig,+ GateTrigger, HandoffNoteConfig, LlmCapabilityConfig, LlmClassifierConfig, LlmFallback,+ LlmTaskClassifier, Noop, Passthrough, PickerMode, Random, RuntimeModels, StageRouter,+ StageRouterConfig, SubagentRouter, SubagentRouterConfig, TaskClassifierConfig, ToolSemantics,+ Vgr, VgrConfig,};use serde::Deserialize;use strum_macros::IntoStaticStr;@@ -635,6 +635,8 @@ pub struct StageClassifierConfig {pub judge_deadline_ms: Option<u64>,}+const COMPOSITE_PLANNING_PROMPT: &str = "You are in the planning phase. Inspect the task and the relevant code, then form a concrete implementation plan before modifying any files. Use read-only tools as needed. Do not make an edit until the plan is complete. After completing the plan, immediately make the first edit in the same task to hand execution off. Do not finish or return a final response with only the plan.";+/// The shared model pair and defaults for composite stage profiles.#[derive(Clone, Debug, Deserialize)]#[serde(deny_unknown_fields)]@@ -707,6 +709,37 @@ impl StageSettingsConfig {}impl StageTierConfig {+ fn profile_config(+ &self,+ profile: &StageProfileConfig,+ picker: PickerMode,+ ) -> StageRouterConfig {+ let threshold = match picker {+ PickerMode::EfficientFirst => self.settings.confidence_threshold.unwrap_or(0.4),+ PickerMode::CapableFirst => self.capable_first_threshold,+ };+ let mode = profile.picker.unwrap_or(picker);+ let capable_first = mode == PickerMode::CapableFirst;+ let mut config = profile+ .settings+ .stage_config(&self.settings, mode, threshold);+ config.recent_window.get_or_insert(3);+ config.capable_hold_turns = profile+ .settings+ .capable_hold_turns+ .or(self.settings.capable_hold_turns)+ .unwrap_or(if capable_first { 0 } else { 2 });+ config+ .efficient_hold_turns+ .get_or_insert(if capable_first { -1 } else { 0 });+ if capable_first {+ config+ .capable_system_prompt+ .get_or_insert_with(|| COMPOSITE_PLANNING_PROMPT.into());+ }+ config+ }+/// Warns when both tiers name one target; see [`warn_identical_tiers`].fn warn_identical_tiers(&self, route_name: &str) {warn_identical_tiers(route_name, &self.capable_target, &self.efficient_target);@@ -714,6 +747,24 @@ impl StageTierConfig {}impl StageClassifierConfig {+ fn composite_judge_config(+ &self,+ route_name: &str,+ capable: &str,+ efficient: &str,+ ) -> AlgorithmResult<CompositeJudgeConfig> {+ if matches!(self.mode, Some(ClassifierMode::Custom)) {+ return Ok(CompositeJudgeConfig::Custom(+ self.custom_classifier_config(route_name)?,+ ));+ }+ let mut config = self.task_classifier_config(route_name, capable, efficient)?;+ if let CapabilityJudgeConfig::Decision(judge) = &mut config.judge {+ judge.cutoff.get_or_insert(0.92);+ }+ Ok(CompositeJudgeConfig::Capability(config))+ }+fn task_classifier_config(&self,route_name: &str,@@ -1922,67 +1973,41 @@ fn build_algorithm(subagents,} => {stage.warn_identical_tiers(route_name);- let judge = if matches!(classifier.mode, Some(ClassifierMode::Custom)) {- CompositeJudgeConfig::Custom(classifier.custom_classifier_config(route_name)?)- } else {- CompositeJudgeConfig::Capability(classifier.task_classifier_config(- route_name,- &stage.capable_target,- &stage.efficient_target,- )?)- };- let shared = &stage.settings;- let algorithm = if efficient.is_some() || capable.is_some() {- let defaults = StageProfileConfig::default();- let profiles = [- (- efficient,- PickerMode::EfficientFirst,- shared.confidence_threshold.unwrap_or(0.5),- ),- (- capable,- PickerMode::CapableFirst,- stage.capable_first_threshold,- ),- ]- .map(|(profile, picker, threshold)| -> AlgorithmResult<_> {- let profile = profile.as_deref().unwrap_or(&defaults);- let mut config = profile.settings.stage_config(- shared,- profile.picker.unwrap_or(picker),- threshold,- );- config.llm_fallback = profile- .classifier- .as_ref()- .map(|classifier| {- classifier.stage_fallback(- route_name,- &stage.capable_target,- &stage.efficient_target,- targets,- )- })- .transpose()?;- Ok(config)- });- let [profile_0, profile_1] = profiles;- CompositeRouter::new_with_profiles(judge, profile_0?, profile_1?)- } else {- let mut config = shared.stage_config(shared, PickerMode::EfficientFirst, 0.5);- config.capable_first_threshold = stage.capable_first_threshold;- CompositeRouter::new(CompositeRouterConfig {- judge,- stage: config,- })- }- .map_err(|error| {- AlgorithmConfigError::with_source(- format!("composite route {route_name}: {error}"),- error,- )- })?;+ let judge = classifier.composite_judge_config(+ route_name,+ &stage.capable_target,+ &stage.efficient_target,+ )?;+ let defaults = StageProfileConfig::default();+ let profiles = [+ (efficient, PickerMode::EfficientFirst),+ (capable, PickerMode::CapableFirst),+ ]+ .map(|(profile, picker)| -> AlgorithmResult<_> {+ let profile = profile.as_deref().unwrap_or(&defaults);+ let mut config = stage.profile_config(profile, picker);+ config.llm_fallback = profile+ .classifier+ .as_ref()+ .map(|classifier| {+ classifier.stage_fallback(+ route_name,+ &stage.capable_target,+ &stage.efficient_target,+ targets,+ )+ })+ .transpose()?;+ Ok(config)+ });+ let [profile_0, profile_1] = profiles;+ let algorithm = CompositeRouter::new_with_profiles(judge, profile_0?, profile_1?)+ .map_err(|error| {+ AlgorithmConfigError::with_source(+ format!("composite route {route_name}: {error}"),+ error,+ )+ })?;let parent: Arc<dyn Algorithm> = Arc::new(algorithm);attach_subagent_router(route_name, parent, subagents.as_ref(), targets)}@@ -2238,6 +2263,110 @@ fn resolve_runtime_models(mod tests {use super::*;+ #[test]+ fn composite_profile_defaults() -> AlgorithmResult<()> {+ let stage: StageTierConfig =+ toml::from_str("capable_target = 'strong'\nefficient_target = 'weak'").unwrap();+ for (picker, threshold, capable_hold, efficient_hold, prompt) in [+ (PickerMode::EfficientFirst, 0.4, 2, 0, None),+ (+ PickerMode::CapableFirst,+ 0.0,+ 0,+ -1,+ Some(COMPOSITE_PLANNING_PROMPT),+ ),+ ] {+ let config = stage.profile_config(&StageProfileConfig::default(), picker);+ assert_eq!(config.mode, picker);+ assert_eq!(config.confidence_threshold, threshold);+ assert_eq!(config.recent_window, Some(3));+ assert_eq!(config.capable_hold_turns, capable_hold);+ assert_eq!(config.efficient_hold_turns, Some(efficient_hold));+ assert_eq!(config.capable_system_prompt.as_deref(), prompt);+ assert!(config.llm_fallback.is_none());+ assert!(config.handoff_notes.is_none());+ }+ let standalone = StageSettingsConfig::default().stage_config(+ &StageSettingsConfig::default(),+ PickerMode::CapableFirst,+ 0.5,+ );+ assert_eq!(standalone.capable_hold_turns, 2);+ assert!(standalone.capable_system_prompt.is_none());+ Ok(())+ }++ #[test]+ fn composite_profile_overrides() {+ let stage: StageTierConfig = toml::from_str(+ r#"+capable_target = "strong"+efficient_target = "weak"+efficient_first_threshold = 0.7+capable_first_threshold = 0.2+recent_turn_window = 5+capable_hold_turns = 4+efficient_hold_turns = 1+capable_system_prompt = "Shared plan"+"#,+ )+ .unwrap();+ let shared = stage.profile_config(&StageProfileConfig::default(), PickerMode::CapableFirst);+ assert_eq!(shared.confidence_threshold, 0.2);+ assert_eq!(shared.recent_window, Some(5));+ assert_eq!(shared.capable_hold_turns, 4);+ assert_eq!(shared.efficient_hold_turns, Some(1));+ assert_eq!(shared.capable_system_prompt.as_deref(), Some("Shared plan"));+ assert_eq!(+ stage+ .profile_config(&StageProfileConfig::default(), PickerMode::EfficientFirst)+ .confidence_threshold,+ 0.7+ );+ let profile: StageProfileConfig = toml::from_str(+ r#"+confidence_threshold = 0.0+recent_turn_window = 2+capable_hold_turns = 0+efficient_hold_turns = 0+capable_system_prompt = ""+"#,+ )+ .unwrap();+ let config = stage.profile_config(&profile, PickerMode::CapableFirst);+ assert_eq!(config.confidence_threshold, 0.0);+ assert_eq!(config.recent_window, Some(2));+ assert_eq!(config.capable_hold_turns, 0);+ assert_eq!(config.efficient_hold_turns, Some(0));+ assert_eq!(config.capable_system_prompt.as_deref(), Some(""));+ }++ #[test]+ fn composite_decision_defaults_and_overrides() -> AlgorithmResult<()> {+ for (settings, cutoff, fail_open) in [+ ("[decision]", 0.92, true),+ ("fail_open = false\n[decision]\ncutoff = 0.7", 0.7, false),+ ] {+ let classifier: StageClassifierConfig = toml::from_str(&format!(+ "target = 'judge'\nclassify_trigger = 'new_session'\n{settings}"+ ))+ .unwrap();+ let CompositeJudgeConfig::Capability(config) =+ classifier.composite_judge_config("route", "strong", "weak")?+ else {+ panic!()+ };+ assert_eq!(config.classify_trigger, ClassifyTrigger::NewSession);+ assert_eq!(config.fail_open, fail_open);+ let CapabilityJudgeConfig::Decision(judge) = config.judge else {+ panic!()+ };+ assert_eq!(judge.cutoff, Some(cutoff));+ }+ Ok(())+ }+#[test]fn restricted_random_preserves_weight_positions() -> AlgorithmResult<()> {let allowed = BTreeSet::from(["private_a", "private_b"]);diff --git a/docs/reference/toml_schema.md b/docs/reference/toml_schema.mdindex 48f8abf26..1f2772ff9 100644--- a/docs/reference/toml_schema.md+++ b/docs/reference/toml_schema.md@@ -575,7 +575,7 @@ confidence threshold. Tool signals still drive escalation and recovery. See| `classifier.threshold_step` | No | `0.0` | Finite, non-negative amount added once for uncertain or unmatched verdicts and twice for unsupported verdicts. `base_threshold + 2 * threshold_step` must be at most `1`. || `classifier.classify_trigger` | Yes | — | `user_turn` re-picks the tier whenever the user speaks, `new_session` picks once and holds it. `every_request` is rejected here: a judge call per tool step is the cost this route exists to avoid. || `classifier.decision` | No | defaults for a decision target | Decision model settings. A classifier target in `decision_targets` uses the defaults when this table is absent. It cannot be combined with the LLM judge keys (`base_threshold`, `threshold_step`, `prompt`, `response_format_type`, `max_output_tokens`). |-| `classifier.decision.cutoff` | No | `0.6` | Select capable when the `apply_cutoff_to` probability is above this value. In `[0, 1]`. |+| `classifier.decision.cutoff` | No | `0.92` | Select capable when the `apply_cutoff_to` probability is above this value. In `[0, 1]`. || `classifier.decision.instructions` | No | built in | Replaces the default question text. Keep the meaning of the choices. || `classifier.decision.choices` | No | `capable`, `efficient` | Array of `{ id, description }` tables sent as the choice options. IDs must be unique. || `classifier.decision.apply_cutoff_to` | No | `capable` | Choice ID whose probability is compared with `cutoff`. |@@ -585,13 +585,13 @@ confidence threshold. Tool signals still drive escalation and recovery. See| `classifier.prompt` | No | packaged prompt | Replaces the classifier judge prompt. The verdict schema is unchanged. || `classifier.response_format_type` | No | `json_schema` | Structured-output mode for the judge. Use `json_object` when the provider does not support JSON Schema. Switchyard adds the schema to the prompt and validates the verdict locally. || `classifier.max_output_tokens` | No | `4096` | Maximum completion tokens for the judge verdict. Must be at least `1`. |-| `classifier.judge_deadline_ms` | No | unset | Bounds the whole judge consultation in milliseconds, the model call and the response drain included. On expiry the judge is treated as unavailable and the route falls back to the capable tier. Must be at least `1`. Unset leaves the consultation unbounded. |+| `classifier.judge_deadline_ms` | No | unset | Bounds the whole judge consultation in milliseconds, the model call and the response drain included. On expiry, error handling follows `classifier.fail_open`. Must be at least `1`. Unset leaves the consultation unbounded. || `stage.capable_target` | Yes | — | Capable tier. || `stage.efficient_target` | Yes | — | Efficient tier. |-| `stage.efficient_first_threshold` | No | `0.5` | Signal confidence required after an Efficient classification. In `[0, 1]`. Also accepts `confidence_threshold`. |+| `stage.efficient_first_threshold` | No | `0.4` | Signal confidence required after an Efficient classification. In `[0, 1]`. Also accepts `confidence_threshold`. || `stage.capable_first_threshold` | No | `0.0` | Signal confidence required after a Capable classification. In `[0, 1]`. || `stage.recent_turn_window` | No | `3` | Trailing tool results the signals are computed over. |-| `stage.capable_hold_turns` | No | `2` | Same capable hold as `stage_router`: `0` disables; `-1` pins after a switch. |+| `stage.capable_hold_turns` | No | CF: `0`, EF: `2` | Same capable hold as `stage_router`: `0` disables; `-1` pins after a switch. || `stage.efficient_hold_turns` | No | CF: `-1`; EF: `0` | Defaults to pinning efficient after a switch when the classifier selected capable-first. Explicit `0` disables; positive values hold that many requests. || `stage.tool_semantics.observe` | No | `[]` | Additional exact ASCII case-insensitive tool names that count as observation. || `stage.tool_semantics.mutate` | No | `[]` | Additional exact ASCII case-insensitive tool names that count as mutation. |@@ -600,6 +600,9 @@ confidence threshold. Tool signals still drive escalation and recovery. See| `stage.handoff_notes` | No | unset | Optional guidance appended to forwarded requests. Uses the same fields and behavior as [stage-router handoff notes](../routing_algorithms/stage_router_routing.md#optional-handoff-notes). || `subagents` | No | unset | Nested policy used only for delegated sub-agent work. |+The capable-first profile uses a planning prompt by default. Shared or profile+`capable_system_prompt` overrides it. An empty string disables it.+Optional `efficient` and `capable` tables provide independent stagesettings and prompts. See [independent stage profiles](../routing_algorithms/composite_routing.md#independent-stage-profiles).diff --git a/docs/routing_algorithms/composite_routing.md b/docs/routing_algorithms/composite_routing.mdindex e67879d31..1729b3693 100644--- a/docs/routing_algorithms/composite_routing.md+++ b/docs/routing_algorithms/composite_routing.md@@ -9,7 +9,7 @@ fit the same route type.One pairing: a classifier selects the stage router's starting policy.By default, an efficient classification selects efficient-first with `efficient_first_threshold`-(default `0.5`).+(default `0.4`).A capable classification defaults to capable-first with `capable_first_threshold`(default `0.0`). Both thresholds are configurable from `0.0` to `1.0`.Tool signals can still change the tier@@ -22,6 +22,11 @@ to efficient, it stays there until the next user-turn reset or session reset. Efdefaults to `0`. Set this field explicitly to override either default. `0`disables the hold, and a positive value holds that many subsequent requests.+The capable-first profile adds a planning prompt and defaults to no capable hold.+The efficient-first profile holds capable for two requests after escalation.+Both profiles use three recent tool results. Explicit shared and profile settings+override these defaults. Set `capable_system_prompt = ""` to disable the planning prompt.+The classifier can use an LLM judge or a decision model. A decisionmodel is configured through a decision client and target, separately from thecapable and efficient completion targets.@@ -45,7 +50,7 @@ classify_trigger = "user_turn"[routes.switchyard.stage]capable_target = "strong"efficient_target = "weak"-efficient_first_threshold = 0.5+efficient_first_threshold = 0.4capable_first_threshold = 0.0[routes.switchyard.stage.tool_semantics]@@ -156,7 +161,7 @@ for OpenAI Decisions configuration.The judge receives the conversation messages and one choice question. Thedefault choices are `capable` (start with the capable model) and `efficient`(start with the efficient model). The classifier selects capable when-`probabilities.capable` is above `cutoff`. The default cutoff is `0.6`.+`probabilities.capable` is above `cutoff`. The Composite default cutoff is `0.92`.Calibrate the cutoff for your tasks and models. Omit LLM-only settings such as`base_threshold`, `threshold_step` and `prompt` when using a decision model.On judge failure, the default is to retain the last classified tier or use