from vocode.streaming.agent.abstract_factory import AbstractAgentFactory
from vocode.streaming.action.my_action_factory import MyActionFactory
class MyAgentFactory(AbstractAgentFactory):
def __init__(self, action_factory: MyActionFactory):
self.action_factory = action_factory
def create_agent(
self, agent_config: AgentConfig, logger: Optional[logging.Logger] = None
) -> BaseAgent:
if agent_config.type == "MY_ACTION":
return MyActionAgent(
agent_config=agent_config,
action_factory=self.action_factory
)
elif agent_config.type == "other_agent_type":
...
else:
raise Exception("Invalid agent config")