Primary entrypoint for executing an agent's reasoning flow on a task, supporting interactive/autonomous modes, image inputs, streaming, and fallback error handling.
# Source: https://github.com/kyegomez/swarms | License: Apache-2.0 | Copyright You must retain, in the Source form of any Derivative Works
# Provided via justclaw.it.com; keep this notice with the code.
def run(
self,
task: Optional[Union[str, Any]] = None,
img: Optional[str] = None,
imgs: Optional[List[str]] = None,
correct_answer: Optional[str] = None,
streaming_callback: Optional[Callable[[str], None]] = None,
n: int = 1,
*args,
**kwargs,
) -> Any:
"""
Execute the agent's main reasoning/thinking flow (single or multi-step).
This is the primary entrypoint for running an agent on a given task, optionally with one or more images and with support for both interactive and autonomous flows
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key