diff --git a/agent.py b/agent.py index 1d9c33f..c581fc2 100644 --- a/agent.py +++ b/agent.py @@ -371,6 +371,15 @@ def _build_comparison_result(comparison_id: str, quotes: list[QuoteInput], weigh } +def _quote_sort_key(item: dict[str, Any]) -> tuple[Any, ...]: + return ( + -item["scores"]["weighted_total"], + item["total_price"], + item["delivery_days"], + item["vendor"].lower(), + ) + + def _parse_browser_documents(documents: list[BrowserDocument]) -> dict[str, Any]: quotes: list[QuoteInput] = [] errors: list[dict[str, Any]] = []