Spaces:
Running on CPU Upgrade
Running on CPU Upgrade
Commit ·
5b27d87
1
Parent(s): 2fc9917
Hide research sub-agent tool_call and tool_output from CLI display
Browse files- agent/main.py +13 -6
agent/main.py
CHANGED
|
@@ -284,12 +284,16 @@ async def event_listener(
|
|
| 284 |
arguments = event.data.get("arguments", {}) if event.data else {}
|
| 285 |
if tool_name:
|
| 286 |
last_tool_name[0] = tool_name
|
| 287 |
-
|
| 288 |
-
|
|
|
|
|
|
|
| 289 |
elif event.event_type == "tool_output":
|
| 290 |
output = event.data.get("output", "") if event.data else ""
|
| 291 |
success = event.data.get("success", False) if event.data else False
|
| 292 |
-
|
|
|
|
|
|
|
| 293 |
should_truncate = last_tool_name[0] != "plan_tool"
|
| 294 |
print_tool_output(output, success, truncate=should_truncate)
|
| 295 |
shimmer.start()
|
|
@@ -931,6 +935,7 @@ async def headless_main(prompt: str, model: str | None = None) -> None:
|
|
| 931 |
console = _create_rich_console()
|
| 932 |
shimmer = _ThinkingShimmer(console)
|
| 933 |
stream_buf = _StreamBuffer(console)
|
|
|
|
| 934 |
shimmer.start()
|
| 935 |
|
| 936 |
while True:
|
|
@@ -954,12 +959,14 @@ async def headless_main(prompt: str, model: str | None = None) -> None:
|
|
| 954 |
tool_name = event.data.get("tool", "") if event.data else ""
|
| 955 |
arguments = event.data.get("arguments", {}) if event.data else {}
|
| 956 |
if tool_name:
|
| 957 |
-
|
| 958 |
-
|
|
|
|
|
|
|
| 959 |
elif event.event_type == "tool_output":
|
| 960 |
output = event.data.get("output", "") if event.data else ""
|
| 961 |
success = event.data.get("success", False) if event.data else False
|
| 962 |
-
if output:
|
| 963 |
print_tool_output(output, success, truncate=True)
|
| 964 |
shimmer.start()
|
| 965 |
elif event.event_type == "tool_log":
|
|
|
|
| 284 |
arguments = event.data.get("arguments", {}) if event.data else {}
|
| 285 |
if tool_name:
|
| 286 |
last_tool_name[0] = tool_name
|
| 287 |
+
# Skip printing research tool_call — the tool_log handler shows it
|
| 288 |
+
if tool_name != "research":
|
| 289 |
+
args_str = json.dumps(arguments)[:80]
|
| 290 |
+
print_tool_call(tool_name, args_str)
|
| 291 |
elif event.event_type == "tool_output":
|
| 292 |
output = event.data.get("output", "") if event.data else ""
|
| 293 |
success = event.data.get("success", False) if event.data else False
|
| 294 |
+
# Skip research output — sub-agent progress shown via tool_log,
|
| 295 |
+
# and the main agent will summarize the findings in its response
|
| 296 |
+
if last_tool_name[0] != "research" and output:
|
| 297 |
should_truncate = last_tool_name[0] != "plan_tool"
|
| 298 |
print_tool_output(output, success, truncate=should_truncate)
|
| 299 |
shimmer.start()
|
|
|
|
| 935 |
console = _create_rich_console()
|
| 936 |
shimmer = _ThinkingShimmer(console)
|
| 937 |
stream_buf = _StreamBuffer(console)
|
| 938 |
+
_hl_last_tool = [None]
|
| 939 |
shimmer.start()
|
| 940 |
|
| 941 |
while True:
|
|
|
|
| 959 |
tool_name = event.data.get("tool", "") if event.data else ""
|
| 960 |
arguments = event.data.get("arguments", {}) if event.data else {}
|
| 961 |
if tool_name:
|
| 962 |
+
_hl_last_tool[0] = tool_name
|
| 963 |
+
if tool_name != "research":
|
| 964 |
+
args_str = json.dumps(arguments)[:80]
|
| 965 |
+
print_tool_call(tool_name, args_str)
|
| 966 |
elif event.event_type == "tool_output":
|
| 967 |
output = event.data.get("output", "") if event.data else ""
|
| 968 |
success = event.data.get("success", False) if event.data else False
|
| 969 |
+
if _hl_last_tool[0] != "research" and output:
|
| 970 |
print_tool_output(output, success, truncate=True)
|
| 971 |
shimmer.start()
|
| 972 |
elif event.event_type == "tool_log":
|