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:

Screenshot_2025-10-31_at_16.47.49

With response:

Screenshot_2025-11-03_at_14.18.11

How to set up and validate locally

  1. Create a flow with a DeterministicStepComponent with a run_command expected 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"
  1. 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

Merge request reports

Loading