diff --git a/swarms/agents/utils/AgentManager.py b/swarms/agents/utils/AgentManager.py index 7b3fb35d..bfeea916 100644 --- a/swarms/agents/utils/AgentManager.py +++ b/swarms/agents/utils/AgentManager.py @@ -41,9 +41,6 @@ class AgentManager: builder = AgentBuilder(self.toolsets) builder.build_parser() - agent = builder.get_agent() - if not agent: - raise ValueError("Agent not created") callbacks = [] eval_callback = EVALCallbackHandler() @@ -55,12 +52,19 @@ class AgentManager: execution_callback.set_parser(builder.get_parser()) callbacks.append(execution_callback) + #llm init callback_manager = CallbackManager(callbacks) - builder.build_llm(callback_manager, openai_api_key) + if builder.llm is None: + raise ValueError('LLM not created') builder.build_global_tools() + #agent init + agent = builder.get_agent() + if not agent: + raise ValueError("Agent not created") + memory: BaseChatMemory = self.get_or_create_memory(session) tools = [ *builder.get_global_tools(),