← Lesson
When Not to Swarm
Joeven
Run
Reset
Python loads on first run
def pick_shape(spec): if spec.get("fixed_path"): return "workflow" if spec.get("parallel_items") and spec.get("reduce") and spec.get("priced"): return "swarm" if spec.get("need_split") and spec.get("stable_graph"): return "sequential_roles" if not spec.get("need_split"): return "one_agent" return "one_agent" print(pick_shape({"fixed_path": True})) print(pick_shape({"need_split": False})) print(pick_shape({"need_split": True, "stable_graph": True})) print(pick_shape({"parallel_items": True, "reduce": True, "priced": True})) print(pick_shape({"parallel_items": True, "reduce": False, "priced": True}))
Run to execute this in your browser. Nothing is sent to a server.