hsaest Cursor commited on
Commit
7cca751
Β·
1 Parent(s): fc09751

feat: PythonInterpreter via SandboxFusion, fix parse_tool_call for code tags

Browse files
Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -2963,7 +2963,9 @@ def build_research_agent(
2963
  yield _emit()
2964
  elif tool_name == "PythonInterpreter":
2965
  code = str(tool_args.get("code", "")).strip()
2966
- code_preview = (code[:60] + "…") if len(code) > 60 else code
 
 
2967
  status_lines.append(f"🐍 turn {turn}: running Python β€” `{code_preview}`")
2968
  yield _emit()
2969
  py_result = _call_python_interpreter(code)
 
2963
  yield _emit()
2964
  elif tool_name == "PythonInterpreter":
2965
  code = str(tool_args.get("code", "")).strip()
2966
+ # Show first non-empty line as preview
2967
+ first_line = next((l.strip() for l in code.splitlines() if l.strip()), code)
2968
+ code_preview = (first_line[:120] + "…") if len(first_line) > 120 else first_line
2969
  status_lines.append(f"🐍 turn {turn}: running Python β€” `{code_preview}`")
2970
  yield _emit()
2971
  py_result = _call_python_interpreter(code)