Summary
Explore and implement a TypeSafe System One routing option for Switchyard. TypeSafe would make a typed Choice over configured target labels, while Switchyard remains responsible for executing the selected target.
Motivation
The existing LLM-classifier path uses a generative model for the routing decision. A small live smoke comparison found that TypeSafe made the same 10/10 clear routing decisions with materially lower observed decision latency:
| Router |
Correct |
Mean |
Median |
Observed p95 |
TypeSafe jev-latest |
10/10 |
281 ms |
278 ms |
375 ms |
azure/openai/gpt-5.6-sol |
10/10 |
1,653 ms |
1,575 ms |
2,576 ms |
This is exploratory evidence, not a production-quality accuracy result. The cases were deliberately separable and each request ran once.
Proposed behavior
- Send normalized request state to TypeSafe as one typed
Choice.
- Define each configured target with a stable label and semantic criterion.
- Route high-confidence choices to the selected target.
- Route low-confidence choices and TypeSafe service failures to a configured capable fallback.
- Load the TypeSafe credential from an environment variable; never place it in TOML or logs.
- Preserve the full returned probability distribution for telemetry and later threshold calibration.
Architecture question
switchyard-libsy is intentionally I/O-free, while TypeSafe is an external HTTP judgment service. The implementation should preserve that boundary. Likely options are a generic external-decision step served by the runner, or a runner-owned classifier provider that returns a routing decision to libsy. Direct HTTP calls from a libsy algorithm would violate the current architecture.
Acceptance criteria
Summary
Explore and implement a TypeSafe System One routing option for Switchyard. TypeSafe would make a typed
Choiceover configured target labels, while Switchyard remains responsible for executing the selected target.Motivation
The existing LLM-classifier path uses a generative model for the routing decision. A small live smoke comparison found that TypeSafe made the same 10/10 clear routing decisions with materially lower observed decision latency:
jev-latestazure/openai/gpt-5.6-solThis is exploratory evidence, not a production-quality accuracy result. The cases were deliberately separable and each request ran once.
Proposed behavior
Choice.Architecture question
switchyard-libsyis intentionally I/O-free, while TypeSafe is an external HTTP judgment service. The implementation should preserve that boundary. Likely options are a generic external-decision step served by the runner, or a runner-owned classifier provider that returns a routing decision to libsy. Direct HTTP calls from a libsy algorithm would violate the current architecture.Acceptance criteria