a2a-source-edit: write agent.py

This commit is contained in:
a2a-cloud
2026-07-18 03:19:01 +00:00
parent 8ace1c6318
commit 81f7886b24

View File

@@ -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.",