Skip to content

Commit 16d00e1

Browse files
committed
fix: add error metadata to tool execution failure logging
1 parent a96ba38 commit 16d00e1

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

apps/application/flow/step_node/tool_lib_node/impl/base_tool_lib_node.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,8 @@ def tool_exec_record(self, tool_lib, all_params):
275275
maxkb_logger.error(f"Tool execution error: {traceback.format_exc()}")
276276
QuerySet(ToolRecord).filter(id=task_record_id).update(
277277
state=State.FAILURE.value,
278-
run_time=time.time() - start_time
278+
run_time=time.time() - start_time,
279+
meta={'input': all_params, 'output': 'Error: ' + str(e)}
279280
)
280281

281282
def upload_knowledge_file(self, file):

apps/trigger/handler/impl/task/tool_task.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,12 @@ def execute(self, trigger_task, **kwargs):
183183
maxkb_logger.error(f"Tool execution error: {traceback.format_exc()}")
184184
QuerySet(TaskRecord).filter(id=task_record_id).update(
185185
state=State.FAILURE,
186-
run_time=time.time() - start_time
186+
run_time=time.time() - start_time,
187+
meta={'input': parameter_setting, 'output': 'Error: ' + str(e)}
187188
)
188189
QuerySet(ToolRecord).filter(id=task_record_id).update(
189190
state=State.FAILURE,
190-
run_time=time.time() - start_time
191+
run_time=time.time() - start_time,
192+
meta={'input': parameter_setting, 'output': 'Error: ' + str(e)}
191193
)
192194

0 commit comments

Comments
 (0)