Skip to content

Python: [Bug]: Tool-failure warning recommends  include_detailed_errors=True  even when already enabled #9439

Closed

Description

Observed Behavior

When a tool raises an exception, Agent Framework logs:

Function 'failing_tool' raised an exception; returning an error result to the model. Set include_detailed_errors=True for the full detail.

The recommendation appears even when function_invocation_configuration["include_detailed_errors"] is explicitly True. This incorrectly suggests that detailed error feedback is disabled or that the configuration was ignored.

Expected Behavior

Preserve the tool-failure warning, but include the recommendation only when include_detailed_errors is disabled.

Steps to Reproduce

  1. Run the minimal reproduction below with agent-framework-core==1.20.0.
  2. Observe the warning with include_detailed_errors=False.
  3. Observe the same recommendation with include_detailed_errors=True, despite the model-bound result correctly including the exception.

Minimal Reproduction

The following isolates the SDK's error-result handler without requiring a model connection:

import logging

from agent_framework import Content
from agent_framework._tools import _function_execution_error_result

logging.basicConfig(level=logging.WARNING)

call = Content.from_function_call(
    call_id="test-call",
    name="failing_tool",
    arguments={},
)

for enabled in (False, True):
    print(f"include_detailed_errors={enabled}", flush=True)
    result = _function_execution_error_result(
        function_call=call,
        tool_name="failing_tool",
        exception=RuntimeError("test failure"),
        config={"include_detailed_errors": enabled},
    )
    print(result.result, flush=True)

Error Messages and Stack Traces

Both configurations emit this warning:


WARNING:agent_framework:Function 'failing_tool' raised an exception; returning an error result to the model. Set include_detailed_errors=True for the full detail.


The model-bound results correctly differ:

| Setting | Model-bound result |
|---|---|
| `False` | `Error: Function failed.` |
| `True` | `Error: Function failed. Exception: test failure` |

Package Versions

agent-framework-core==1.20.0

Python Version

Python 3.14

Operating System

Linux

Regression

No

Additional Context

Reproduced with sensitive-data logging both enabled and disabled.

In _function_execution_error_result, both logging branches include the recommendation unconditionally. The configuration is checked afterward when constructing the model-bound result.

This is a misleading logging message, not a failure of the detailed-error setting.

A search of open and closed issues did not identify a report covering this specific warning bug.

Acknowledgements

  • I searched existing issues and did not find a duplicate.
  • I personally verified this behavior and the reproduction details are authentic.
  • I will wait for explicit maintainer agreement before starting implementation of a non-trivial change.

Activity

  1. added
    pythonUsage: [Issues, PRs], Target: Python
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 16, 2026
  2. added
    reproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow
    on Oct 16, 2026
  3. github-actions commented on Oct 16, 2026

    @github-actions
    Contributor

    🤖 Automated triage reproduction notes (agent-authored — trust but verify)

    Agent analysis

    Repro: python/packages/core/agent_framework/_tools.py::_function_execution_error_result unconditionally includes the recommendation in both warning branches when a tool exception occurs, including with include_detailed_errors=True. Minimal repro: call the helper with a function-call Content, a RuntimeError, and config={"include_detailed_errors": True}, then assert the detailed result is present but the recommendation is absent from captured logs.

    • Failing test: python/packages/core/tests/core/test_function_invocation_logic.py::test_function_execution_error_warning_omits_recommendation_when_detailed_errors_enabled
    • Files examined: python/packages/core/agent_framework/_tools.py, python/packages/core/tests/core/test_function_invocation_logic.py, python/packages/core/pyproject.toml
    • Tests run: test_function_invocation_config_include_detailed_errors_false, test_function_invocation_config_include_detailed_errors_true, test_function_execution_error_warning_omits_recommendation_when_detailed_errors_enabled
    • Reported version: 1.20.0
    • Current version: 1.22.0
  4. added
    agentsUsage: [Issues, PRs], Target: Single agent
    observabilityUsage: [Issues, PRs], Target: observability related features
    and removed
    triageUsage: [Issues], Target: All issues that still need to be triaged
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

agentsUsage: [Issues, PRs], Target: Single agentobservabilityUsage: [Issues, PRs], Target: observability related featurespythonUsage: [Issues, PRs], Target: PythonreproducedUsage: [Issues], Target: all issues that can be reproduced by the triage workflow

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions