Skip to content

[BUG]The crew object cannot be garbage collected when I use annotations, regardless of which version I'm using. #3450

@YDS854394028

Description

@YDS854394028

Description

Image
 for typ in self._monitored_types:
            try:
                count = objgraph.count(typ)
                print(f"  {typ}: {count}")
            except Exception as e:
                print(f"  {typ}: error ({e})")
  CrewBase(Crewai): 1
  WebSocket: 0
  StreamLLM: 1
  CustomAgent: 0
  Crew: 1
  Task: 1
  Agent: 1

Steps to Reproduce

1

Expected behavior

1

Screenshots/Code snippets

    llm=StreamLLM(model="llm")
    
    embedding_config= {
    	"provider": "custom",
    	"config": {
    		"embedder": SentenceTransformerEmbeddingFunction(
    			"../../src/agent/embedding/models/paraphrase-multilingual-MiniLM-L12-v2"),
    		"model": 'paraphrase-multilingual-MiniLM-L12-v2'
    	}
    }
    
    @CrewBase
    class Crewai():
    	searchTool=MyCustomTool()
    	@agent
    	def searcher(self) -> Agent:
    		return Agent(
    			llm=llm,
    			config=self.agents_config['searcher'],
    			verbose=True,
    			tools=[self.searchTool]
    		)
    	@task
    	def searcher_task(self) -> Task:
    		return Task(
    			config=self.tasks_config['searcher_task'],
    			# callback=self.callback_function
    		)
    	@crew
    	def crew(self) -> Crew:
    		return Crew(
    			agents=self.agents,
    			tasks=self.tasks,
    			process=Process.sequential,
    			verbose=False,
    			cache=True,
    			memory=False,
    			embedder=embedding_config,
    			short_term_memory=ShortTermMemory(
    				storage=RAGStorage(
    					embedder_config={
    						"provider": "custom",
    						"config": {
    							"embedder":SentenceTransformerEmbeddingFunction(
    							"../../src/agent/embedding/models/paraphrase-multilingual-MiniLM-L12-v2"),
    							"model": 'paraphrase-multilingual-MiniLM-L12-v2'
    						}
    					},
    					type="short_term",
    					path="./shortterm"
    				)
    			)
    		)
    

Operating System

Ubuntu 20.04

Python Version

3.11

crewAI Version

1.77

crewAI Tools Version

1

Virtual Environment

Venv

Evidence

1

Possible Solution

1

Additional context

1

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions