From cfce7d7eff2ff306323761f673c542fdabda5738 Mon Sep 17 00:00:00 2001 From: Kye Date: Thu, 13 Jul 2023 13:51:28 -0400 Subject: [PATCH] check for agent Former-commit-id: 63da782f472bca9aae0fe3a7f7f9a372e1bb7800 --- swarms/agents/utils/AgentManager.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/swarms/agents/utils/AgentManager.py b/swarms/agents/utils/AgentManager.py index 211b0d29..7b3fb35d 100644 --- a/swarms/agents/utils/AgentManager.py +++ b/swarms/agents/utils/AgentManager.py @@ -41,6 +41,10 @@ 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() eval_callback.set_parser(builder.get_parser()) @@ -54,7 +58,7 @@ class AgentManager: callback_manager = CallbackManager(callbacks) builder.build_llm(callback_manager, openai_api_key) - + builder.build_global_tools() memory: BaseChatMemory = self.get_or_create_memory(session) @@ -70,7 +74,7 @@ class AgentManager: tool.callback_manager = callback_manager executor = AgentExecutor.from_agent_and_tools( - agent=builder.get_agent(), + agent=agent, tools=tools, memory=memory, callback_manager=callback_manager,