Skip to content

Conversation

malkaby
Copy link

@malkaby malkaby commented Oct 22, 2025

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
Copy link
Author

malkaby commented Oct 22, 2025

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant