@@ -167,40 +167,58 @@ def _render_execution_log(st: Any, execution_log: str | None) -> None:
167167 st .dataframe (rows , width = "stretch" , hide_index = True )
168168 else :
169169 st .write (rows )
170- _render_execution_log_details (st , parsed )
171170
172171
173172def _build_execution_log_rows (entries : list [object ]) -> list [dict [str , object ]]:
174173 rows : list [dict [str , object ]] = []
175174 for index , entry in enumerate (entries , 1 ):
176175 if isinstance (entry , dict ):
177176 step_type = str (entry .get ("type" , "-" ))
177+ tool_name = (
178+ _extract_tool_name (entry ) if _is_tool_call_event (step_type ) else "-"
179+ )
178180 source = str (entry .get ("source" , "-" ))
179181 summary = _summarize_execution_entry (entry )
180182 else :
181183 step_type = type (entry ).__name__
184+ tool_name = "-"
182185 source = "-"
183186 summary = _truncate_text (str (entry ), 200 )
184187 rows .append (
185188 {
186189 "step" : index ,
187190 "type" : step_type ,
191+ "tool" : tool_name ,
188192 "source" : source ,
189193 "summary" : summary ,
190194 }
191195 )
192196 return rows
193197
194198
195- def _render_execution_log_details (st : Any , entries : list [object ]) -> None :
196- if not hasattr (st , "expander" ):
197- return
198- for index , entry in enumerate (entries , 1 ):
199- with st .expander (f"Step { index } details" ):
200- if hasattr (st , "code" ):
201- st .code (json .dumps (entry , indent = 2 , ensure_ascii = True , default = str ))
202- else :
203- st .write (entry )
199+ def _is_tool_call_event (step_type : str ) -> bool :
200+ normalized = step_type .strip ().lower ()
201+ return "toolcall" in normalized or ("tool" in normalized and "call" in normalized )
202+
203+
204+ def _extract_tool_name (entry : dict [str , object ]) -> str :
205+ name = entry .get ("name" )
206+ if isinstance (name , str ) and name .strip ():
207+ return name .strip ()
208+
209+ content = entry .get ("content" )
210+ if isinstance (content , dict ):
211+ content_name = content .get ("name" )
212+ if isinstance (content_name , str ) and content_name .strip ():
213+ return content_name .strip ()
214+ if isinstance (content , list ):
215+ for item in content :
216+ if isinstance (item , dict ):
217+ item_name = item .get ("name" )
218+ if isinstance (item_name , str ) and item_name .strip ():
219+ return item_name .strip ()
220+
221+ return "-"
204222
205223
206224def _summarize_execution_entry (entry : dict [str , object ]) -> str :
0 commit comments