[Bug][DebateWithJudge] run() and batched_run() reject img/imgs, while the telemetry decorator declares it captures them
DebateWithJudge.run() and DebateWithJudge.batched_run() accept no images. Every other multi-agent structure does, and this one's own telemetry decorator declares that it captures img and imgs — so the class advertises image support in three places and implements it in none.
Root cause
swarms/structs/debate_with_judge.py:261 (the decorator) and :264 / :456 (the signatures):
@trace_run(
"DebateWithJudge.run",
input_params=("task", "tasks", "img", "imgs"),
)
def run(self, task: str) -> Union[str, List, dict]: def batched_run(self, tasks: List[str]) -> List[str]:
return batched_run(self.run, tasks)trace_run binds by name and skips anything absent (swarms/telemetry/otel.py:846-850, if p in bound.arguments), so the three phantom parameters are silently dropped rather than raising — which is why nothing has surfaced this.
The images never reach the agents either. Agent.run takes img/imgs, and the three self.*_agent.run(...) calls inside the loop pass neither.
execution_utils.batched_run — the helper DebateWithJudge.batched_run delegates to — already knows how to fan images out per task (img= broadcast, imgs= paired by position, swarms/structs/execution_utils.py:18-20). It is only ever called here with two arguments, so that plumbing is unreachable from this structure.
Signatures across the neighbours:
$ python -c "import inspect; ..."
DebateWithJudge.run : (self, task: str) -> Union[str, List, dict]
DebateWithJudge.batched_run: (self, tasks: List[str]) -> List[str]
SequentialWorkflow.run : (self, task: str, img: Optional[str] = None, imgs: Optional[List[str]] = None, *args, **kwargs)
ConcurrentWorkflow.run : (self, task: str, img: Optional[str] = None, imgs: Optional[List[str]] = None, streaming_callback: ...)Reproducer
from swarms.structs.debate_with_judge import DebateWithJudge
d = DebateWithJudge(preset_agents=True, max_loops=1, verbose=False)
print("has img param on run? ",
"img" in DebateWithJudge.run.__wrapped__.__code__.co_varnames)
try:
d.run("Motion: X", img="chart.png")
except TypeError as e:
print("run(task, img=...) ->", type(e).__name__ + ":", e)
try:
d.batched_run(["a"], imgs=["chart.png"])
except TypeError as e:
print("batched_run(tasks, imgs=) ->", type(e).__name__ + ":", e)Output on master @ 444cfc81 (v15.0.1):
has img param on run? False
run(task, img=...) -> TypeError: DebateWithJudge.run() got an unexpected keyword argument 'img'
batched_run(tasks, imgs=) -> TypeError: DebateWithJudge.batched_run() got an unexpected keyword argument 'imgs'So "debate this chart" is not expressible: the only route is to describe the image in the task string and lose it, which is the same defect #1903 describes for HeavySwarm.
Suggested change
def run(
self,
task: str,
img: Optional[str] = None,
imgs: Optional[List[str]] = None,
) -> Union[str, List, dict]:
...
pro_argument = self.pro_agent.run(
task=pro_prompt, img=img, imgs=imgs, messages=...
)and forward them from batched_run:
def batched_run(
self,
tasks: List[str],
img: Optional[str] = None,
imgs: Optional[Sequence[Optional[str]]] = None,
) -> List[str]:
return batched_run(self.run, tasks, img=img, imgs=imgs)Two decisions worth making explicitly rather than by default:
- Whether the judge sees the image. Giving it to the debaters only is defensible — the judge evaluates arguments, not evidence — but then
JUDGE_ROUND_PROMPTshould say the image is not shown to it. Giving it to all three is the simpler contract. I lean to all three, matchingSequentialWorkflow, where every agent in the chain receives the sameimg. tasksin the decorator.input_params=("task", "tasks", "img", "imgs")names atasksparameterrunwill never have —batched_runis a separate method and is not decorated. It should be("task", "img", "imgs")once the two real ones exist.
Acceptance criteria
DebateWithJudge().run(task, img=...)and.run(task, imgs=[...])are accepted and reach the agents.batched_run(tasks, imgs=[...])pairs one image per task, asexecution_utils.batched_runalready implements.trace_run'sinput_paramsnames only parametersrunactually has.
Environment
swarms master @ 444cfc81 (v15.0.1), Python 3.12, macOS.
Source: kyegomez/swarms