From 81f7886b24b7739e18eaebdae19abc66aefccea1 Mon Sep 17 00:00:00 2001 From: a2a-cloud Date: Sat, 18 Jul 2026 03:19:01 +0000 Subject: [PATCH] a2a-source-edit: write agent.py --- agent.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/agent.py b/agent.py index b88aff2..036e5c4 100644 --- a/agent.py +++ b/agent.py @@ -403,17 +403,9 @@ def _score_quotes(comparison_id: str, quotes: list[QuoteInput], weights: QuoteWe } ) - scored.sort( - key=lambda item: ( - -item["scores"]["weighted_total"], - item["subtotal"], - item["delivery_days"], - -item["warranty_months"], - item["vendor"].lower(), - ) - ) + scored.sort(key=_score_sort_key) winner = scored[0] - baseline = min(scored, key=lambda item: item["subtotal"]) + baseline = min(scored, key=_subtotal_key) rationale_bits = [ f"{winner['vendor']} has the highest weighted score ({winner['scores']['weighted_total']:.2f}).", f"Its normalized total is {winner['subtotal']:.2f} for {winner['quantity']} units.",