Python: Fix workflow not pausing when agent calls declaration-only tool#3757
Open
moonbox3 wants to merge 2 commits intomicrosoft:mainfrom
Open
Python: Fix workflow not pausing when agent calls declaration-only tool#3757moonbox3 wants to merge 2 commits intomicrosoft:mainfrom
moonbox3 wants to merge 2 commits intomicrosoft:mainfrom
Conversation
Member
Python Test Coverage Report •
Python Unit Test Overview
|
||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes a workflow pause/resume gap for declaration-only tools (tools defined with func=None, commonly representing client-side tools). It ensures the workflow pauses and emits request_info when such a tool is called, and that resuming the workflow feeds back a proper tool response message to avoid OpenAI “orphaned tool_calls” 400 errors.
Changes:
- Mark declaration-only
function_callcontents asuser_input_request(and assignid) soAgentExecutorpauses and emitsrequest_info. - Avoid duplicating
function_callitems into the assistant message when handling function-call results. - When resuming from user responses, send back function results with
role="tool"so OpenAI receives valid tool responses. - Adds unit tests and a new sample demonstrating the behavior.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| python/packages/core/agent_framework/_tools.py | Marks declaration-only tool calls as user input requests; avoids re-adding function_call contents into the assistant message. |
| python/packages/core/agent_framework/_workflows/_agent_executor.py | Uses role="tool" when resuming with function परिणाम (function_result) contents. |
| python/packages/core/tests/workflow/test_agent_executor_tool_calls.py | Adds non-streaming, streaming, and parallel tests for declaration-only tool pause/resume behavior. |
| python/samples/getting_started/workflows/human-in-the-loop/agents_with_declaration_only_tools.py | New sample demonstrating declaration-only tool calls pausing the workflow and resuming via responses={...}. |
| python/samples/getting_started/workflows/README.md | Links the new sample in the workflows README table. |
eavanvalkenburg
approved these changes
Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation and Context
declaration_onlytool (for example, a client-side AG-UI tool withfunc=None), the workflow now pauses and emits arequest_infoevent instead of continuing and hitting an OpenAI 400 error_try_execute_function_calls: mark declaration-onlyFunctionCallContentitems withuser_input_request=TruesoAgentExecutordetects them_handle_function_call_results: don't re-addfunction_callitems already present in the response messagehandle_user_input_response: userole="tool"when feeding function results back to the agent so the LLM sees proper tool responsesDescription
Contribution Checklist