Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ async def update_message_thread(self, messages: Sequence[BaseAgentEvent | BaseCh

if self._activation[target][activation_group] == "all":
self._remaining[target][activation_group] -= 1
if self._remaining[target][activation_group] == 0:
if self._remaining[target][activation_group] >= 0:
# If all parents are done, add to the ready queue.
self._ready.append(target)
# Track which activation group was triggered
Expand Down
29 changes: 29 additions & 0 deletions python/packages/autogen-agentchat/tests/test_group_chat_graph.py
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,35 @@ async def test_digraph_group_chat_parallel_join_all(runtime: AgentRuntime | None
assert result.stop_reason is not None


@pytest.mark.asyncio
async def test_digraph_group_chat_multi_source_bypass_max_turns(runtime: AgentRuntime | None) -> None:
agent_p = _EchoAgent("P", description="Echo agent P")
agent_u = _EchoAgent("U", description="Echo agent U")
agent_e = _EchoAgent("E", description="Echo agent E")

graph = DiGraph(
nodes={
"P": DiGraphNode(name="P", edges=[DiGraphEdge(target="U"), DiGraphEdge(target="E")]),
"U": DiGraphNode(name="U", edges=[DiGraphEdge(target="E")]),
"E": DiGraphNode(name="E", edges=[]),
}
)

team = GraphFlow(
participants=[agent_p, agent_u, agent_e],
graph=graph,
runtime=runtime,
max_turns=2,
)

result: TaskResult = await team.run(task="Start")
assert len(result.messages) == 4
assert result.messages[0].source == "user"
assert result.messages[1].source == "P"
assert set(m.source for m in result.messages[2:]) == {"U", "E"}
assert result.stop_reason is not None


@pytest.mark.asyncio
async def test_digraph_group_chat_parallel_join_any(runtime: AgentRuntime | None) -> None:
agent_a = _EchoAgent("A", description="Echo agent A")
Expand Down