fix: Append tool results to the ToolException
What does this merge request do and why?
When using the run_command tool, if we encounter an error, often we only see exit status 1, which doesn't allow the agent to meaningfully correct itself, and it makes debugging challenging as well.
This MR appends the both Response of the failed request to the ToolException (alongside the Error part already there); this Response usually contains the actual error.
Without respone:
With response:
How to set up and validate locally
- Create a flow with a
DeterministicStepComponentwith arun_commandexpected to fail
product_group: agent_foundations
version: "v1"
environment: ambient
components:
- name: "command"
type: DeterministicStepComponent
tool_name: "run_command"
inputs:
- from: "cat"
as: "program"
literal: true
- from: "/nonexistent_file"
as: "args"
literal: true
ui_log_events:
- "on_tool_execution_success"
- "on_tool_execution_failed"
routers:
- from: "command"
to: "end"
flow:
entry_point: "command"
- Run the flow and confirm that the tool failure contains all the necessary information
Merge request checklist
-
Tests added for new functionality. If not, please raise an issue to follow up. -
Documentation added/updated, if needed. -
If this change requires executor implementation: verified that issues/MRs exist for both Go executor and Node executor or confirmed that changes are backward-compatible and don't break existing executor functionality.
Relates to #1628
Edited by Andras Herczeg
