Skip to content

Python: Fix the example of multi-tier handoff workflow with specialist-to-specialist routing#2332

Merged
eavanvalkenburg merged 3 commits intomicrosoft:mainfrom
tsuting:tsuting/fix-the-example-of-handoff-specialist-to-speicalist-routing
Nov 21, 2025
Merged

Python: Fix the example of multi-tier handoff workflow with specialist-to-specialist routing#2332
eavanvalkenburg merged 3 commits intomicrosoft:mainfrom
tsuting:tsuting/fix-the-example-of-handoff-specialist-to-speicalist-routing

Conversation

@tsuting
Copy link
Contributor

@tsuting tsuting commented Nov 19, 2025

Motivation and Context

In the example of multi-tier handoff workflow with specialist-to-specialist routing, the same user inputs are being sent twice. This leads to redundant processing and may cause slight confusion for users. Additionally, the behavior does not align with the comment in the code.

At line 184, the comment states:
"Thank you!", # Final response to trigger termination after billing agent answers

However, the actual workflow terminates one step earlier than described.

Description

Send the same user input once, fix the comment and the expected output, and the number of times to terminate the workflow.

Contribution Checklist

  • The code builds clean without any errors or warnings
  • The PR follows the Contribution Guidelines
  • All unit tests pass, and I have added new tests where possible
  • Is this a breaking change? If yes, add "[BREAKING]" prefix to the title of the PR.

…rsation after trigger the last response as the comment describes
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a bug in the multi-tier handoff workflow example where the same user input was being sent twice, and updates the termination condition and expected output to accurately reflect the workflow behavior.

Key changes:

  • Updated termination condition from > 4 to > 3 user messages
  • Removed duplicate sending of initial user message by using scripted_responses[0] instead of hardcoded string
  • Adjusted response_index to start at 1 instead of 0 to account for the initial message already being sent
  • Updated expected output to match the corrected workflow flow

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@moonbox3 moonbox3 added the workflows Related to Workflows in agent-framework label Nov 21, 2025
@eavanvalkenburg eavanvalkenburg added this pull request to the merge queue Nov 21, 2025
Merged via the queue into microsoft:main with commit 1bf926b Nov 21, 2025
23 checks passed
arisng pushed a commit to arisng/agent-framework that referenced this pull request Feb 2, 2026
…t-to-specialist routing (microsoft#2332)

* Fix the example (1) to send only one initial message (2) to end conversation after trigger the last response as the comment describes

* Apply suggestions from code review

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

* changed the hard-coded user query

---------

Co-authored-by: tsuting.kao <tsu.kao@microsoft.com>
Co-authored-by: Evan Mattson <35585003+moonbox3@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python workflows Related to Workflows in agent-framework

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants