Configuration
On this page
All configuration lives in router/config as a tree of dataclasses rooted at RouterConfig. Pass a fully or partially customized RouterConfig to HierarchicalRouter(config=...); any sub-config left as default uses the dataclass field defaults shown below.
from zerda.router import RouterConfig, ScoringConfig, ExecutionConfig, ExecutionMode
config = RouterConfig(
scoring=ScoringConfig(semantic_weight=0.8, keyword_weight=0.2, llm_weight=0.0),
execution=ExecutionConfig(mode=ExecutionMode.SEQUENTIAL),
)
router = HierarchicalRouter(config=config)
RouterConfig
The single entry point aggregating every sub-config, plus top-level LLM fallback and no-match behavior settings.
Presets
Two classmethods construct commonly-used configurations:
RouterConfig.fast() — optimized for latency: scoring.top_k = 1, execution.mode = ExecutionMode.SINGLE, cache.enabled = True.
RouterConfig.accurate() — optimized for accuracy: scoring.top_k = 3, execution.mode = ExecutionMode.PARALLEL, scoring.llm_weight = 0.20, scoring.semantic_weight = 0.60.
router = HierarchicalRouter(config=RouterConfig.fast())
EmbeddingConfig
Controls the embedding model used for semantic scoring.
[!WARNING] Fields not directly read Static analysis of
routing/pipeline.pyshowsEmbeddingProviderhard-codesnormalize_embeddings=Truein its calls toSentenceTransformer.encode, rather than consultingEmbeddingConfig.normalize_embeddings. Likewise, cache usage defaults are controlled by each method's ownuse_cacheparameter, not read fromEmbeddingConfig.cache_embeddings. These fields exist on the dataclass but are not observed to be consumed byEmbeddingProviderin the analyzed source — documented here explicitly rather than assumed to work, per this documentation's no-hallucination policy.
ScoringConfig
Weights and thresholds for the hybrid scorer.
The three weight fields are normalized to sum to 1 inside HybridScorer.__init__ — you don't need to make them sum to 1 yourself, but their ratios to each other determine relative influence.
ExecutionConfig
Controls how matched routes are executed.
[!WARNING] AggregationStrategy.VOTING is declared but not implemented
AggregationStrategy.VOTING = "voting"exists as an enum value, butHierarchicalRouter.__init__'s aggregator-selection logic only checksself._cfg.execution.aggregation.value == "merge"; any other value (including"voting") results inFirstWinsAggregatorbeing used. NoVotingAggregatorclass exists in the analyzed source.
CacheConfig
Controls the route-decision cache (CacheManager).
FeedbackConfig
Controls the adaptive feedback loop (FeedbackEngine).
ObservabilityConfig
Controls logging, tracing, and metrics.
Enumerations
SimilarityMetric
ExecutionMode
AggregationStrategy
ConfidenceLevel
LogLevel
DEBUG, INFO, WARNING, ERROR — maps 1:1 to Python's logging level names via getattr(logging, cfg.log_level.value, logging.INFO).
Next steps
See Advanced Usage for streaming, tool chaining, and feedback-tuning walkthroughs, or the API Reference for exhaustive per-class documentation.