Agent Zero AI framework
Minify parallel tool results
linkliti1615258ef6a6
diff --git a/helpers/parallel_tools.py b/helpers/parallel_tools.pyindex 759d1db32..9e9a4cbc1 100644--- a/helpers/parallel_tools.py+++ b/helpers/parallel_tools.py@@ -364,7 +364,7 @@ def format_started_jobs(jobs: list[ParallelJob]) -> str:"jobs": [_job_snapshot(job, include_result=False) for job in jobs],"instruction": "Use the parallel tool with job_ids to await or cancel these background jobs.",}- return json.dumps(payload, indent=2, ensure_ascii=False)+ return json.dumps(payload, ensure_ascii=False, separators=(",", ":"))def format_parallel_results(results: list[dict[str, Any]]) -> str:@@ -393,7 +393,7 @@ def format_parallel_results(results: list[dict[str, Any]]) -> str:"Some jobs are still running. Call `parallel` with `action: \"await\"` ""and the listed `job_ids` to wait again, or `action: \"cancel\"` to stop them.")- return json.dumps(payload, indent=2, ensure_ascii=False)+ return json.dumps(payload, ensure_ascii=False, separators=(",", ":"))async def _run_parallel_job(parent_context_id: str, job_id: str) -> None:diff --git a/tests/test_parallel_tool.py b/tests/test_parallel_tool.pyindex 7a98da649..dc1a91199 100644--- a/tests/test_parallel_tool.py+++ b/tests/test_parallel_tool.py@@ -1071,3 +1071,11 @@ def test_chats_sidebar_projects_parallel_children_as_indented_accordion() -> Nonassert "left: 2px" in htmlassert "padding-left: 24px" in htmlassert "color: var(--color-text-muted)" in html+++def test_parallel_result_json_is_compact() -> None:+ result = parallel_tools.format_parallel_results(+ [{"job_id": "wait-1", "tool_name": "wait", "state": "success"}]+ )++ assert result == '{"status":"success","jobs":[{"job_id":"wait-1","tool_name":"wait","state":"success"}]}'