Skip to main content
Deprecated. The Complexity Router, the complexity_tier routing-rule variable, governance.complexity_analyzer_config in config.json, the Helm complexityAnalyzerConfig value, and the /api/routing/complexity-analyzer-* endpoints will be replaced by Routers in Bifrost v3.0.0. With Routers, you can create multiple routers, each with its own classifier and models, and each tier goes to its own model with no routing rules to write.Your current setup keeps working until then, and v3.0.0 will migrate it to routers. We recommend moving to Routers for both existing and new setups; see Moving from the Complexity Router.

Overview

The Complexity Router assigns each incoming request a Simple, Medium, or Complex tier, using a decision model, semantic reference phrases, or an LLM classifier. The tier is exposed as a flat string variable (complexity_tier) in Bifrost’s CEL routing engine, so you can write routing rules like:
Classification runs only when a routing rule references complexity_tier. If it produces no tier (the classifier is unavailable, times out, or finds no match), the complexity rule does not match and the request continues through normal routing.
Routers do not set complexity_tier. Rules that use it keep reading it from the Complexity Router until you move them. When a request matches such a rule and a router also takes it, the request is classified twice.

Classifiers

The Complexity Router uses the same classifiers and settings as Routers. They are documented on the Routers page:

Configuration

Pick a classifier, then configure it. The decision model needs its provider configured with an enabled key (or keyless). Semantic needs an embedding provider and model with an enabled key. The dashboard warns about missing or broken keys.
Navigate to Models > Complexity Router. On Classifier, choose Decision model, Semantic, or LLM classifier, then select Next. Switching later keeps the other classifier’s saved settings.
Complexity Router classifier step with Decision model selected and Semantic as the alternative
Decision model configuration
Decision model configuration step showing the definition, signals, and examples editors for the Simple, Medium, and Complex tiers
  • Tier guidance: each tier’s card shows its definition, Signals, and Examples, pre-filled with the defaults. Use the pencil icon to edit a definition; type and press Enter to add an entry, or × to remove one. A reset icon appears beside a changed field and restores it.
  • Restore defaults (footer) resets all three tiers.
  • Edit model configuration (header) opens Model configuration: the provider and decision model, Max messages to send (previous_message_count), Classification timeout (ms), and Confidence threshold (min_confidence). If the provider is missing, failing, or has no enabled key, a warning links to the fix and Save stays disabled.
Semantic configuration
Semantic configuration step showing 150 reference phrases across Simple, Medium, and Complex, session-aware routing, and Fallback Tier Guidance
  • Phrase to Tier Mapping: edit each tier’s reference phrases. Restore defaults (footer) restores the 150 shipped phrases.
  • Edit embedding configuration opens provider, model, similarity floor, history, timeout, budgets, and phrase storage. The Classifier ready badge shows warmup state.
  • When no phrase matches confidently (same sheet): choose Decision model or LLM classifier to set up a fallback. None keeps the saved fallback settings for later.
  • Fallback Tier Guidance (main page, decision-model fallback): the same tier guidance as above. Reset all restores the defaults.
  • Fallback Classification Prompt (main page, LLM fallback): Reset to default restores the shipped prompt.
Complexity Router embedding configuration panel showing provider, model, similarity threshold, timeout, storage, and a decision model fallback on Cloudflare clef-flash
Both classifiers
  • Session-aware routing: retains the highest tier reached by each identified session for 24 hours of inactivity. The toggle is off by default.

Classifier status and warmup

GET /api/routing/complexity-analyzer-status and the badge in the page header report Semantic’s warmup state (disabled, warming, ready, or failed), whether an llm block is configured, the shipped LLM fallback prompt (llm_default_prompt), and the shipped tier guidance (decision_defaults). POST /api/routing/complexity-analyzer-status/retry restarts a failed warmup. The decision model has no warmup and is not covered by the status. The states work as they do for routers. See Status and warmup.

Routing with complexity_tier

Once a classifier is ready, use complexity_tier in any CEL routing rule, on its own or combined with headers, request type, scope, or any other condition.
Complexity Router only sets complexity_tier; it does not create rules. Add a rule for each tier you want to route. A router does both in one place.

Available operators

Combining with other rule conditions

For example:

Use case examples

Complex carve-out

Route only frontier-worthy requests to your strongest model and let everything else keep using your existing routing:

Full three-tier ladder

See Example: a three-tier ladder for the three rules and the single router that replaces them.

Observability

When a routing rule references complexity_tier, the request log records complexity_tier, complexity_mechanism (semantic, decision, llm, session, or skipped), and complexity_score (Semantic only). Filter the log explorer by tier and mechanism, or call the logs API:
Requests that never touched a complexity rule carry no complexity fields. complexity_score is shown but not filterable, and old REASONING rows are still filterable. The routing decision log lines, spans, and Prometheus metrics are the same as for routers; see Observability.

Troubleshooting

Rule not matching when complexity_tier is set

First check that the classifier publishes a tier: classification runs only when a routing rule references complexity_tier, and the request needs user text (a system prompt alone is not enough). When classification is unavailable (unsupported input, provider failure, timeout, or a semantic match below min_similarity), the rule does not match and evaluation moves to the next rule, unless session state supplies a tier. For classifier problems (everything skipped, wrong tiers, fallbacks not running), see Troubleshooting on the Routers page. The checks are the same, using GET /api/routing/complexity-analyzer-status for the status.

Latency doubled after adding a router

A request that matches a complexity_tier rule and is then taken by a router is classified twice. Move the rule into the router and turn the rule off. See Moving from the Complexity Router.

Lexical keyword classifier (retired)

Retired. Earlier versions classified requests with weighted keyword lists for four tiers (simple_keywords, code_keywords, technical_keywords, reasoning_keywords). That scorer no longer runs, and tier_boundaries, conversation blending, and Complex overrides no longer apply. Old tier_boundaries are still accepted so existing configurations load.
What this means for existing deployments:
  • Upgrades are safe. Old configurations still load. Until you configure Semantic or a decision model, no tier is published (complexity_mechanism: skipped).
  • Keyword lists became phrase lists. Your entries are kept and mapped to three tiers: Simple stays Simple, Code and Technical become Medium, Reasoning becomes Complex. They are now reference phrases to embed, so short keywords like "debug" or "api" classify poorly; replace them with full example requests.
  • Old logs are unchanged. Historical REASONING rows stay filterable, but update any routing rule that still matches "REASONING".

Next Steps

Routers

The replacement: classify requests and send each tier to its own model

Moving from the Complexity Router

Move your settings and complexity_tier rules to routers

Routing Rules

Full reference for CEL expressions, scope hierarchy, and rule chaining

Provider Routing

Understand how complexity routing fits into the full request routing pipeline