Skip to content

feature(graph): Allow cyclic graphs #497

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Aug 11, 2025
Merged

Conversation

mkmeral
Copy link
Contributor

@mkmeral mkmeral commented Jul 18, 2025

Description

This PR removes the cyclic graph validation from the multiagent graph implementation, based on customer feedback. Previously, the graph implementation enforced a Directed Acyclic Graph (DAG) structure, which limited certain use cases. By removing this restriction, we now support cyclic graphs, enabling more flexible agent workflows such as:

  • "Loop until" patterns where agents can continue processing until a specific condition is met
  • Feedback loops where output from later stages can influence earlier stages
  • Recursive agent workflows where an agent can feed back into itself
  • Iterative refinement processes where results are continuously improved

The changes are minimal and focused on removing the cycle detection algorithm while maintaining all other validation checks.

Related Issues

Addresses customer feedback requesting support for cyclic agent graphs

Documentation PR

TODO

Type of Change

New feature

Testing

  • Verified that cyclic graphs can now be created without validation errors
  • Updated existing tests to confirm that cyclic graphs are properly supported
  • Ran full test suite with hatch test and hatch run test-integ to ensure no regressions
  • All tests pass with no new warnings or errors

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature, or no new docs are needed
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@zastrowm zastrowm added the area-multiagent Multi-agent related label Jul 22, 2025
@mkmeral mkmeral enabled auto-merge (squash) July 30, 2025 13:07
@vria vria mentioned this pull request Jul 30, 2025
7 tasks
@vria
Copy link

vria commented Jul 30, 2025

Please concider #571

Co-authored-by: Nick Clegg <[email protected]>
Copy link
Contributor

@JackYPCOnline JackYPCOnline left a comment

Choose a reason for hiding this comment

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

Thanks for addressing my concern.

@mkmeral mkmeral merged commit 99963b6 into strands-agents:main Aug 11, 2025
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-multiagent Multi-agent related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants