Skip to content

Commit adc746e

Browse files
committed
forward imgs and execution kwargs to the selected agents
1 parent 375d808 commit adc746e

1 file changed

Lines changed: 21 additions & 4 deletions

File tree

swarms/structs/skill_orchestra.py

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,16 @@ def _execute_agents(
580580
selected: List[AgentSelectionResult],
581581
task: str,
582582
img: Optional[str] = None,
583+
imgs: Optional[List[str]] = None,
583584
**kwargs,
584585
) -> List[Dict[str, Any]]:
585-
"""Run selected agents on the task."""
586+
"""Run selected agents on the task.
587+
588+
``imgs`` and any extra ``kwargs`` are forwarded to every selected
589+
agent. They used to stop here: the agents were invoked with only
590+
``task`` and ``img``, so a caller passing multiple images or e.g.
591+
``streaming_callback`` got silence rather than an error.
592+
"""
586593
results = []
587594

588595
if len(selected) == 1:
@@ -597,7 +604,9 @@ def _execute_agents(
597604
f"Executing agent '{sel.agent_name}' on task"
598605
)
599606

600-
response = agent.run(task=agent_task, img=img)
607+
response = agent.run(
608+
task=agent_task, img=img, imgs=imgs, **kwargs
609+
)
601610

602611
self.conversation.add(
603612
role=sel.agent_name, content=str(response)
@@ -621,7 +630,11 @@ def _execute_agents(
621630
)
622631
agent_task = sel.assigned_task or task
623632
future = executor.submit(
624-
agent.run, task=agent_task, img=img
633+
agent.run,
634+
task=agent_task,
635+
img=img,
636+
imgs=imgs,
637+
**kwargs,
625638
)
626639
future_to_agent[future] = sel.agent_name
627640

@@ -859,7 +872,11 @@ def run(
859872

860873
# Step 4: Execute
861874
results = self._execute_agents(
862-
selected, current_task, img=img, **kwargs
875+
selected,
876+
current_task,
877+
img=img,
878+
imgs=imgs,
879+
**kwargs,
863880
)
864881

865882
# Step 5: Learn

0 commit comments

Comments
 (0)