Skip to content

Conversation

@Nekowaii
Copy link
Contributor

Summary

Expose failure_error_function in Agent.as_tool() and pass it through to @function_tool(...).

Motivation

When an Agent is wrapped via as_tool(), exceptions raised during the nested Runner.run(...) (including failures triggered by hosted tools like Code Interpreter, file/web search, etc.) are currently converted into a generic tool error string by the default function_tool error handler. This makes it difficult to:

  • handle failures programmatically in the caller, and/or
  • report failures via standard exception-based observability.

This change keeps the default behavior unchanged, but allows opting into exception propagation via failure_error_function=None.

@seratch seratch added enhancement New feature or request feature:core labels Dec 14, 2025
@seratch seratch added this to the 0.6.x milestone Dec 14, 2025
This was referenced Dec 15, 2025
@Nekowaii Nekowaii requested a review from seratch December 15, 2025 15:36
@seratch
Copy link
Member

seratch commented Dec 16, 2025

Sorry, can you resolve the conflicts? Your changes here look good to me.

@Nekowaii Nekowaii force-pushed the feat/as-tool-failure-error-function branch from 58ae138 to dea3f43 Compare December 16, 2025 16:02
@Nekowaii
Copy link
Contributor Author

Done. I rebased and fixed the conflicts. Thanks.

@seratch seratch enabled auto-merge (squash) December 17, 2025 01:40
@seratch seratch merged commit 6f2bcb9 into openai:main Dec 17, 2025
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request feature:core

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants