Skip to content

Commit

Permalink
Added .copy for manager agent and shallow copy for manager llm
Browse files Browse the repository at this point in the history
  • Loading branch information
Vidit-Ostwal committed Mar 3, 2025
1 parent 86825e1 commit 52e0a84
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/crewai/crew.py
Original file line number Diff line number Diff line change
Expand Up @@ -1111,13 +1111,19 @@ def copy(self):
"_short_term_memory",
"_long_term_memory",
"_entity_memory",
"_telemetry",
"agents",
"tasks",
"knowledge_sources",
"knowledge",
"manager_agent",
"manager_llm",

}

cloned_agents = [agent.copy() for agent in self.agents]
manager_agent = self.manager_agent.copy() if self.manager_agent else None
manager_llm = shallow_copy(self.manager_llm) if self.manager_llm else None

task_mapping = {}

Expand Down Expand Up @@ -1150,10 +1156,14 @@ def copy(self):
tasks=cloned_tasks,
knowledge_sources=existing_knowledge_sources,
knowledge=existing_knowledge,
manager_agent=manager_agent,
manager_llm=manager_llm,
)

return copied_crew



def _set_tasks_callbacks(self) -> None:
"""Sets callback for every task suing task_callback"""
for task in self.tasks:
Expand Down

0 comments on commit 52e0a84

Please sign in to comment.