Files
luandev-ComfyUI-CrewAI/list_agent_node.py
T
2024-06-05 09:00:11 +01:00

24 lines
752 B
Python

class AgentList:
@classmethod
def INPUT_TYPES(cls):
# Generate a dictionary for up to n agents dynamically
inputs = {"required": {"agent-1": ("AGENT",)}}
# for i in range(2, 101): # Adjust the range as needed
# inputs["optional"] = inputs.get("optional", {})
# inputs["optional"][f"agent{i}"] = ("AGENT",)
return inputs
OUTPUT_IS_LIST = (True,)
RETURN_TYPES = ("AGENT",)
FUNCTION = "create_list"
CATEGORY = "📎CrewAi"
def create_list(self, **kwargs):
agents = []
# Collect all agents from kwargs dynamically
for key, value in kwargs.items():
if value is not None:
agents.append(value)
return (agents,)