Skip to content

fix: #3459 add opt-in recovery for missing function tools#3461

Open
seratch wants to merge 1 commit into
mainfrom
feat/tool-not-found-recovery
Open

fix: #3459 add opt-in recovery for missing function tools#3461
seratch wants to merge 1 commit into
mainfrom
feat/tool-not-found-recovery

Conversation

@seratch
Copy link
Copy Markdown
Member

@seratch seratch commented May 19, 2026

This pull request resolves #3459 by adding an opt-in RunConfig.tool_not_found_behavior="return_error_to_model" mode for unresolved function tool calls. The default remains raise_error, preserving the current ModelBehaviorError behavior unless callers explicitly opt in.

When enabled, the runner records the unresolved function call, appends a model-visible function_call_output error for the same call_id, and runs the model again so it can recover. The change also extends tool_error_formatter with kind="tool_not_found" for custom model-visible messages, exports the new behavior type, documents the option, and covers direct processing, non-streaming runs, streaming runs, mixed known/missing tool calls, formatter fallback behavior, session persistence, and public constructor compatibility.

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.

Make unknown tool calls recoverable instead of aborting with ModelBehaviorError

1 participant