Skip to content

API Reference parrot.registry.routing.models

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot.registry.routing.models

View source

Pydantic v2 data models for the FEAT-111 store-level router.

These models mirror the shape of IntentRouterConfig and friends in parrot.registry.capabilities.models but are scoped to store selection.

Public API (re-exported from parrot.registry.routing)::

from parrot.registry.routing import (
    StoreFallbackPolicy,
    StoreRule,
    StoreRouterConfig,
    StoreScore,
    StoreRoutingDecision,
)

Class StoreFallbackPolicy

What the router does when no store scores above confidence_floor.

Attributes:

Attribute Type Description
FAN_OUT Delegate to the configured MultiSearch-protocol instance's search() (see parrot.models.MultiSearch, typically an ai-parrot-tools MultiStoreSearchToolkit) for parallel fan-out across all configured origins + BM25 reranking; falls back to a direct parallel fan-out across stores when no such instance is configured.
FIRST_AVAILABLE Use the first configured store in insertion order.
EMPTY Return an empty result list without raising.
RAISE Raise NoSuitableStoreError.

Class StoreRouterConfig

Full configuration for StoreRouter.

Shape mirrors IntentRouterConfig from parrot.registry.capabilities.models.

Fields:

Field Type Default Description
margin_threshold float If top-1 - top-2 < margin, engage LLM fallback
confidence_floor float Drop stores scoring below this from the decision
llm_timeout_s float Maximum seconds to wait for the LLM ranking call
top_n int How many top-ranked stores to query in execute()
fallback_policy StoreFallbackPolicy StoreFallbackPolicy.FAN_OUT
cache_size int LRU cache size; 0 disables caching
enable_ontology_signal bool True
custom_rules list[StoreRule] Per-agent YAML overrides merged on top of defaults

Class StoreRoutingDecision

Complete output of StoreRouter.route().

Fields:

Field Type Default Description
rankings list[StoreScore]
fallback_used bool False
cache_hit bool False
ontology_annotations Optional[dict] None
path str fast | llm | cache | fallback
elapsed_ms float 0.0

Class StoreRule

One heuristic rule that maps a query pattern to a preferred store.

Fields:

Field Type Default Description
pattern str Lowercase substring or regex (see regex flag)
store StoreType
weight float Confidence weight (0–1)
regex bool False

Class StoreScore

One ranked store entry within a StoreRoutingDecision.

Fields:

Field Type Default Description
store StoreType
confidence float
reason str ''

Alias StoreType

Re-exported from parrot.models.StoreType.

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally