6188617037
Environment Corruption Check / test-python-versions (3.12.8) (push) Failing after 2s
Environment Corruption Check / test-python-versions (3.11.11) (push) Failing after 1s
Pre-commit checks / pre-commit-check (push) Failing after 1s
Environment Corruption Check / test-python-versions (3.13.2) (push) Failing after 4s
31 lines
771 B
Python
31 lines
771 B
Python
from enum import Enum
|
|
from typing import Dict, List, Union
|
|
|
|
from app.agent.base import BaseAgent
|
|
from app.flow.base import BaseFlow
|
|
from app.flow.planning import PlanningFlow
|
|
|
|
|
|
class FlowType(str, Enum):
|
|
PLANNING = "planning"
|
|
|
|
|
|
class FlowFactory:
|
|
"""Factory for creating different types of flows with support for multiple agents"""
|
|
|
|
@staticmethod
|
|
def create_flow(
|
|
flow_type: FlowType,
|
|
agents: Union[BaseAgent, List[BaseAgent], Dict[str, BaseAgent]],
|
|
**kwargs,
|
|
) -> BaseFlow:
|
|
flows = {
|
|
FlowType.PLANNING: PlanningFlow,
|
|
}
|
|
|
|
flow_class = flows.get(flow_type)
|
|
if not flow_class:
|
|
raise ValueError(f"Unknown flow type: {flow_type}")
|
|
|
|
return flow_class(agents, **kwargs)
|