akseljoonas HF Staff commited on
Commit
a6c60ef
·
1 Parent(s): d1b62e5

Revert "Sub-agent log: tool_name → output_preview on one line"

Browse files

This reverts commit f362c920a30671ed78d07fa9ad8ad25f3b313005.

Files changed (1) hide show
  1. agent/tools/research_tool.py +6 -23
agent/tools/research_tool.py CHANGED
@@ -277,34 +277,17 @@ async def research_handler(
277
  continue
278
 
279
  try:
280
- # Brief description for the UI
281
- brief = tool_name
282
- if tool_name == "github_find_examples":
283
- brief = f"github_find_examples({tool_args.get('repo', '')}/{tool_args.get('keyword', '')})"
284
- elif tool_name == "github_read_file":
285
- brief = f"github_read_file({tool_args.get('path', '')})"
286
- elif tool_name == "explore_hf_docs":
287
- brief = f"explore_hf_docs({tool_args.get('endpoint', '')})"
288
- elif tool_name == "fetch_hf_docs":
289
- url = tool_args.get("url", "")
290
- brief = f"fetch_hf_docs(...{url[-50:]})" if len(url) > 50 else f"fetch_hf_docs({url})"
291
- elif tool_name == "hf_inspect_dataset":
292
- brief = f"hf_inspect_dataset({tool_args.get('dataset', '')})"
293
  output, _success = await session.tool_router.call_tool(
294
  tool_name, tool_args, session=session
295
  )
296
- # Log tool name + output preview on one line
297
- preview = output.replace("\n", " ").strip()[:20]
298
- if len(output.strip()) > 20:
299
- preview += "…"
300
- await _log(f"{tool_name} → {preview}")
301
  # Truncate tool output for the research context
302
  if len(output) > 8000:
303
- output = (
304
- output[:4800]
305
- + "\n...(truncated)...\n"
306
- + output[-3200:]
307
- )
308
  except Exception as e:
309
  output = f"Tool error: {e}"
310
 
 
277
  continue
278
 
279
  try:
280
+ import json as _json
281
+
282
+ args_str = _json.dumps(tool_args)[:80]
283
+ await _log(f" {tool_name} {args_str}")
284
+
 
 
 
 
 
 
 
 
285
  output, _success = await session.tool_router.call_tool(
286
  tool_name, tool_args, session=session
287
  )
 
 
 
 
 
288
  # Truncate tool output for the research context
289
  if len(output) > 8000:
290
+ output = output[:4800] + "\n...(truncated)...\n" + output[-3200:]
 
 
 
 
291
  except Exception as e:
292
  output = f"Tool error: {e}"
293