Immutable solution version
Graphflow bug finding next speaker when an agent has tools
Complete solution
@colaso96 Thanks a lot for picking this up! @ekzhu I am pretty sure I know what the issue is but I am completely tied up this week. Use when hitting this exact issue. Not for unrelated errors.
TL;DR
@colaso96 Thanks a lot for picking this up! @ekzhu I am pretty sure I know what the issue is but I am completely tied up this week.
The error
Graphflow bug finding next speaker when an agent has tools[commenter abhinav-aegis]: @colaso96 Thanks a lot for picking this up! @ekzhu I am pretty sure I know what the issue is but I am completely tied up this week. However, I did a quick review and here are my comments and you are right it is to do with the tool message. ### Root Cause GraphFlow was designed to support multiple parallel speakers at each step in the graph. However, BaseGroupChatManager currently only implements a select_speaker method , which allows only one speaker to be selected at a time. As a result, GraphFlow currently returns only one of the possible valid next speakers, based on the assumption that only one agent finishes at a time. But as multiple speakers are allowed in principle by GraphFlow, to identify the agent that just finished execution, GraphFlow inspects the last message in the chat and extracts its source. The problem arises when a tool used by the agent posts a message after the agent has responded , in that case, the last message is not authored by the agent, breaking the current logic. See [this line] for the relevant code.* We look at the last message in the thread of messages and look for the source of this. --- ### 🛠️ Temporar
Context: Issue microsoft/autogen#6523 (closed, 38 comments): ### What happened? Describe the bug Graphflow doesnt seem to work as expected when an agent has access to tools. I get a runtime error mentioning that the agent is unable to find the next speaker even though that edge exists in the graph. To Reproduce I am looking to do something like this: ``` agents: - name: "spockdataset" chatenginemodel: "gpt-4.1-mini" systemmessage: | Your task is to call the "querymusesearch" tool and return 2 possible datasets to use to answer the users question toolsallowlist: ["querymusesearch"] # - name: "spoc
When to use
- You hit this exact issue.
- The symptom matches: Graphflow bug finding next speaker when an agent has tools.
When NOT to use
- A different error or symptom; the cause here is specific to this one.
Compatibility
Per the linked source (mentions 4.1).
Edge cases
- If your error message differs even slightly, this is probably a different issue; search the exact text.
- If the fix does not help, capture the full error output and check the source link for updates.
Evidence
Source: Issue microsoft/autogen#6523 (closed, 38 comments): ### What happened? Describe the bug Graphflow doesnt seem to work as expected when an agent has access to tools. I get a runtime error mentioning that the agent is unable to find the next speaker even though that edge exists in the graph. To Reproduce I am looking to do something like this: ``` agents: - name: "spockdataset" chatenginemodel: "gpt-4.1-mini" systemmessage: | Your task is to call the "querymusesearch" tool and return 2 possible datasets to use to answer the users question toolsallowlist: ["querymusesearch"] # - name: "spoc
Verified resolution: [commenter abhinav-aegis]: @colaso96 Thanks a lot for picking this up! @ekzhu I am pretty sure I know what the issue is but I am completely tied up this week. However, I did a quick review and here are my comments and you are right it is to do with the tool message. ### Root Cause GraphFlow was designed to support multiple parallel speakers at each step in the graph. However, BaseGroupChatManager currently only implements a select_speaker method , which allows only one speaker to be selected at a time. As a result, GraphFlow currently returns only one of the possible valid next speakers, based on the assumption that only one agent finishes at a time. But as multiple speakers are allowed in principle by GraphFlow, to identify the agent that just finished execution, GraphFlow inspects the last message in the chat and extracts its source. The problem arises when a tool used by the agent posts a message after the agent has responded , in that case, the last message is not authored by the agent, breaking the current logic. See [this line] for the relevant code.* We look at the last message in the thread of messages and look for the source of this. --- ### 🛠️ Temporar
Source URL: https://github.com/microsoft/autogen/issues/6523
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_iW7aV6tq6rsqpiZKicMW2w" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Graphflow bug finding next speaker when an agent has tools <span>— Vectle</span></a>