Record a tool invocation.
(self, node_id: str, tool_name: str,
success: bool | None = True, tool_result: Any = None,
details: Dict[str, Any] = None,
stage: CallStage = CallStage.AFTER)
| 135 | ) |
| 136 | |
| 137 | def record_tool_call(self, node_id: str, tool_name: str, |
| 138 | success: bool | None = True, tool_result: Any = None, |
| 139 | details: Dict[str, Any] = None, |
| 140 | stage: CallStage = CallStage.AFTER) -> None: |
| 141 | """Record a tool invocation.""" |
| 142 | duration = self.logger.get_timer(f"tool_{node_id}_{tool_name}") |
| 143 | tool_details = { |
| 144 | "result_size": len(str(tool_result)) if tool_result is not None else 0, |
| 145 | **(details or {}) |
| 146 | } |
| 147 | self.logger.record_tool_call(node_id, tool_name, tool_result, duration, success, tool_details, stage) |
| 148 | |
| 149 | def record_thinking_process(self, node_id: str, thinking_mode: str, thinking_result: str, |
| 150 | stage: str, details: Dict[str, Any] = None) -> None: |