Model Selection
Use model selection to keep client/model choices consistent under explicit constraints.
Core API
ModelSelector: flat selector interface for task/constraint inputs.ModelSelector.select(..., output="decision")returns internalModelSelectionDecisionmetadata.ModelSelector.select(..., output="client_config")returns a plain mapping withprovider,model_id,client_class, and constructorkwargs.ModelSelector.select(..., output="client")(default) returns an instantiated LLM client.
Underlying policy/types
ModelSelector delegates to internal policy components:
ModelSelectionPolicyfor candidate scoring and decisioningModelSelectionIntentfor task/priority intentModelSelectionConstraintsfor local/provider/cost/latency boundsHardwareProfilefor hardware-aware local fit checks
Constraint examples
Local-only selection:
from design_research_agents import ModelSelector
selector = ModelSelector()
decision = selector.select(
task="summarize interview notes",
priority="balanced",
require_local=True,
output="decision",
)
Cost-capped selection:
selector = ModelSelector()
decision = selector.select(task="summarize", max_cost_usd=0.01, output="decision")
Latency-capped selection:
selector = ModelSelector()
decision = selector.select(task="chat", max_latency_ms=1200, output="decision")
Local model fit behavior
ModelSelector evaluates local candidates against available RAM/VRAM hints
and can prefer remote candidates under high system load. This preserves a
local-first posture while avoiding local models likely to overload the current
machine.
See examples
examples/model_selection/local.pyexamples/model_selection/remote.pyexamples/model_selection/README.md