autogen icon indicating copy to clipboard operation
autogen copied to clipboard

fix: graphflow prematurly completing by adding triggered_activation_groups to the team's state

Open malkaby opened this issue 2 months ago • 2 comments

Consider this simple graph image

Node A has two edges with activation_conditions loopback and next. Node B is a leaf node. Both nodes are autogen agents. Node A always emits a stop message response with a text that activate loopback edge.

  • Current behavior
# create_flow returns a team, which consists of two agents as per depicted pic above
team_one = create_flow()
result_one: TaskResult = await team_one.run(task="Start")

# As expected the graph will terminate due to the `StopMessage`
assert result_one.stop_reason == "Stop message received"

# And if I run team_one again the graph will terminate due to the `StopMessage` (as expected)
result_one: TaskResult = await team_one.run(task="Continue")
assert result_one.stop_reason == "Stop message received"

# Let's export state from one team and loads it into another. 
# Which is useful when we want to stop for human in the loop without a process hanging.
team_two = create_flow()
await team_two.load_state(await team_one.save_state())

# But now the graph stopped due to execution complete instead
result_two: TaskResult = await team_two.run(task="Continue")
assert result_two.stop_reason == "Digraph execution is complete"
  • Expected behavior
# Both graphs must stop due to `StopMessage`
assert result_one.stop_reason == "Stop message received"
assert result_two.stop_reason == "Stop message received"

Why are these changes needed?

Consistent behavior.

Related issue number

Maybe #7043

Checks

malkaby avatar Oct 22 '25 20:10 malkaby

@microsoft-github-policy-service agree

malkaby avatar Oct 22 '25 20:10 malkaby

I analyzed this issue but couldn't identify the affected files. Could you please provide more details about which files need to be modified?

priteesshhh avatar Nov 09 '25 19:11 priteesshhh