From cff6e9c09a1263bb83f1ef04f93ef9ccba947a24 Mon Sep 17 00:00:00 2001 From: a2a-cloud Date: Sat, 18 Jul 2026 04:49:56 +0000 Subject: [PATCH] a2a-source-edit: write agent.py --- agent.py | 9 +++++++++ 1 file changed, 9 insertions(+) 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]] = []