from pydantic import BaseModel, Field import logging logger = logging.getLogger("pipeline.handoff") # below this, the watchdog treats a "plausible" verdict as implausible anyway - # started at 0.5, got burned by a bunch of low-confidence-but-correct handoffs # in staging, moved it down until the false-halt rate stopped annoying people CONFIDENCE_FLOOR = 0.35 class AccountHistoryPayload(BaseModel): account_id: str subscription_status: str billing_records: list[dict] = Field(default_factory=list) lookup_source: str # which upstream system actually answered - saved us more than once when this was the only clue class HandoffVerdict(BaseModel): is_plausible: bool reason: str confidence: float