跳到主要内容
Documentation

Decision Tutorials

Overview

版本:最新版

Decision Tutorials

Overview

Latest decision tutorials mirror the boolean-case catalog under config/decision/.

Signals tell the router what it detected. Decisions tell the router what to do with those detections:

  • which route matched
  • which models are candidates
  • whether reasoning is enabled
  • which plugins run after the route is chosen

Key Advantages

  • Keeps route policy readable even when multiple signals must cooperate.
  • Makes boolean logic explicit and reviewable.
  • Separates route matching from deployment bindings, algorithms, and plugins.
  • Maps directly to reusable fragment directories under config/decision/.

What Problem Does It Solve?

Without a decision layer, signal outputs do not tell the router how to react. Teams end up scattering route logic across ad hoc if-statements, model defaults, and plugin wiring.

Decisions solve that by turning named signals into clear route policies with stable priorities and candidate models.

When to Use

Use decision/ when:

  • a route should activate from one or more signals
  • the same model policy should be reused across several signal combinations
  • route priority matters
  • plugins or algorithms should attach to a matched route instead of the whole router

Configuration

In v0.3, decisions live under routing.decisions:

routing:
decisions:
- name: business_route
priority: 110
rules:
operator: AND
conditions:
- type: domain
name: business
modelRefs:
- model: qwen2.5:3b
use_reasoning: false

Decision matching stays separate from:

  • providers.models[], which carries deployment bindings
  • decision.algorithm, which chooses among multiple candidate models
  • decision.plugins, which post-processes a matched route

Use the case-shape catalog below in the same order as the fragment tree:

Decision shapeFragment exampleBest forTutorial
singleconfig/decision/single/domain-business.yamlone decisive signalSingle Condition
andconfig/decision/and/urgent-business.yamlmultiple required signalsAND Decisions
orconfig/decision/or/business-or-law.yamlshared route across alternativesOR Decisions
notconfig/decision/not/exclude-jailbreak.yamlexplicit exclusion or safety guardNOT Decisions
compositeconfig/decision/composite/priority-safe-escalation.yamlnested real-world policiesComposite Decisions

Add Algorithm when modelRefs contains more than one candidate, and add Plugin when the route needs post-selection behavior.