Skip to content

Conversation

@Steve-Dusty
Copy link
Contributor

@Steve-Dusty Steve-Dusty commented Nov 20, 2025

  • Added run_async() method to AgentRearrange class for non-blocking task
    execution
  • Fixed SequentialWorkflow initialization test to properly validate required
    agents parameter

Changes

  1. AgentRearrange async execution (swarms/structs/agent_rearrange.py)

Added new run_async() method that enables asynchronous execution of agent
workflows:

  • Uses asyncio.to_thread() to run synchronous run() method in a separate
    thread
  • Supports all parameters from the synchronous run() method (task, img,
    *args, **kwargs)
  • Maintains consistent error handling with existing _catch_error() pattern
  • Enables integration with async/await patterns in applications

Benefits:

  • Non-blocking execution for agent workflows
  • Better integration with async applications
  • Maintains backward compatibility with existing synchronous API
  1. SequentialWorkflow test fixes (tests/structs/test_sequential_workflow.py)

Updated test_sequential_workflow_initialization() to correctly test
validation behavior:

  • Changed test to expect ValueError when initializing without agents
  • Added proper error message matching: "Agents list cannot be None or empty"
  • Removed incorrect assertions about default attributes that don't exist
  • Aligns test with actual SequentialWorkflow implementation requirements

Before: Test incorrectly assumed SequentialWorkflow could initialize without
agents
After: Test properly validates that agents parameter is required

Test Plan

  • ✅ Async execution tests for run_async() method
  • ✅ Sequential workflow initialization validation
  • ✅ Backward compatibility with existing synchronous workflows

📚 Documentation preview 📚: https://swarms--1215.org.readthedocs.build/en/1215/

@kyegomez kyegomez merged commit 3e6d234 into kyegomez:master Nov 21, 2025
7 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants