kyegomez/swarms

[feat][hiearchical_swarm][mid-flight replanning on judge rejection]

Closed

#1,553 opened on Apr 21, 2026

 (2 comments) (0 reactions) (0 assignees)Python (986 forks)github user discovery
FEATenhancementgood first issue

Repository metrics

Stars
 (7,040 stars)
PR merge metrics
 (Avg merge 3d 5h) (17 merged PRs in 30d)

Description

Problem

Today when the judge rejects a director's plan in HierarchicalSwarm, the swarm just loops the same plan. There is no way for the director to adapt — issue new subtasks, reassign failed ones to different workers, or change the decomposition.

Proposed feature

When the judge returns a rejection (or a low score), the director should be able to:

  • Issue brand-new subtasks based on the judge's feedback
  • Reassign specific failed subtasks to different workers
  • Modify the dependency order between existing subtasks

Rather than restarting the whole plan, the director does an incremental replan informed by what went wrong.

Design sketch

  • Judge verdict schema grows a feedback field (already partially present) and a failed_subtasks: List[str] list.
  • On REVISE, the director is called with the original plan, the judge feedback, and the per-subtask results; it returns a ReplanAction (ADD / REASSIGN / REORDER / DROP).
  • The swarm applies the action and re-runs only the affected subtasks.

Files

  • swarms/structs/hiearchical_swarm.py

Why

Closes the feedback loop — the judge verdict currently has no way to actually drive adaptation. This is the biggest quality lift available for hierarchical runs.

Contributor guide