Skip to content

Commit 3b61bd6

Browse files
committed
fix: agent lost mcp after change model
1 parent 4175bf8 commit 3b61bd6

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

AgentCrew/modules/agents/manager.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,13 @@ def update_llm_service(self, llm_service):
314314
# Update the LLM service for the current agent
315315
self.current_agent.update_llm_service(llm_service)
316316

317+
from AgentCrew.modules.mcpclient.manager import MCPSessionManager
318+
319+
# Reinitialize MCP session manager for the current agent
320+
mcp_manager = MCPSessionManager.get_instance()
321+
if mcp_manager.initialized:
322+
mcp_manager.initialize_for_agent(self.current_agent.name)
323+
317324
# Reactivate the agent with the new LLM service
318325
self.current_agent.activate()
319326

0 commit comments

Comments
 (0)