From 8ace1c6318308d94343b040e3d1c3044f6372ad9 Mon Sep 17 00:00:00 2001 From: a2a-cloud Date: Sat, 18 Jul 2026 03:18:56 +0000 Subject: [PATCH] a2a-source-edit: write agent.py --- agent.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/agent.py b/agent.py index 7554f64..b88aff2 100644 --- a/agent.py +++ b/agent.py @@ -352,6 +352,20 @@ def _clean_comparison_id(value: str) -> str: return cleaned +def _score_sort_key(row: dict[str, Any]) -> tuple[float, float, int, int, str]: + return ( + -float(row["scores"]["weighted_total"]), + float(row["subtotal"]), + int(row["delivery_days"]), + -int(row["warranty_months"]), + str(row["vendor"]).lower(), + ) + + +def _subtotal_key(row: dict[str, Any]) -> float: + return float(row["subtotal"]) + + def _score_quotes(comparison_id: str, quotes: list[QuoteInput], weights: QuoteWeights) -> dict[str, Any]: quote_rows = [quote.model_dump() for quote in quotes] for row in quote_rows: