# Training Crew - Generating two pkl files

**URL:** https://community.crewai.com/t/training-crew-generating-two-pkl-files/4445
**Category:** CrewAI Community Support
**Tags:** crewai
**Created:** [March 6, 2025, 8:02pm UTC](https://community.crewai.com/t/training-crew-generating-two-pkl-files/4445 "2025-03-06T20:02:07Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Waltagan\_Lopes](https://sea1.discourse-cdn.com/flex025/user_avatar/community.crewai.com/waltagan_lopes/32/2922_2.png) [@Waltagan\_Lopes](https://community.crewai.com/u/Waltagan_Lopes)
#### Post date: [March 6, 2025, 8:02pm UTC](https://community.crewai.com/t/training-crew-generating-two-pkl-files/4445/1 "2025-03-06T20:02:07Z")

</div>

I’m using the following code to train a specific crew and this code is generating 2 pkl files, one with the filename, i’m calling and other with the name train\_data.pkl.  
I’ve 3 questions on this topic.

1. What might be causing this 2nd file to be created.
2. I’m building a flow where the pkl file should be created, inside the crew or the flow.
3. How can I be sure that my crew is using the feedbacks of the pkl on the answers?

**train.py**  
from produto\_fornecedor.crews.poem\_crew.poem\_crew import TimeClienteProduto

n\_iterations = 1  
inputs = {“cliente”: “Alpagartas”, “materia\_prima”:“Caulim”}  
filename = “treinamento\_time\_ClienteProduto.pkl”

try:  
TimeClienteProduto().crew().train(  
n\_iterations=n\_iterations,  
inputs=inputs,  
filename=filename  
)

except Exception as e:  
raise Exception(f"An error occurred while training the crew: {e}")

**crew.py**

from crewai import Agent, Crew, Process, Task  
from crewai.project import CrewBase, agent, crew, task  
from crewai\_tools import EXASearchTool, FirecrawlScrapeWebsiteTool  
from src.produto\_fornecedor.tools.custom\_tool import FeedbackAgent  
from pydantic import BaseModel  
from typing import List

class Fabricas(BaseModel):  
nome: str  
cidade: str  
estado: str

class ResumoCliente(BaseModel):  
nome\_empresa: str  
segmento: str  
produto\_final: list =   
fabricas: List[Fabricas] =

class CaracteristicasMateriaPrima(BaseModel):  
caracteristicas: str  
valorbase: str

class ResumoMateriaPrima(BaseModel):  
nome\_materia\_prima: str  
descricao\_materia\_prima: str  
caracteristicas: List[CaracteristicasMateriaPrima]  
aplicacoes: list =   
links\_laudos: str

class EtapasProcessoProdutivo(BaseModel):  
etapa: str  
descricao: str  
materia\_prima: list =   
equipamentos: list =

class ResumoProcessoProdutivo(BaseModel):  
resumo\_processo: str  
etapas: List[EtapasProcessoProdutivo]

@CrewBase  
class TimeClienteProduto:  
“”“Poem Crew”“”

```
agents_config = "config/agents.yaml"
tasks_config = "config/tasks.yaml"
fire_api = 'fc-343c4fc4962d49959821d91af963f14e'

##Chamando agentes TimeClienteProduto
@agent
def especialista_cliente(self) -> Agent:
    return Agent(
		config=self.agents_config['especialista_cliente'],
		tools=[
            EXASearchTool(api_key='30b2cb5f-bc5b-42f4-81d5-339921e42100'),
            FirecrawlScrapeWebsiteTool(),
        ],
        verbose=True,
        memory=True,
        cache=True
    )

@agent
def especialista_material(self) -> Agent:
    return Agent(
		config=self.agents_config['especialista_material'],
		tools=[
			EXASearchTool(api_key='30b2cb5f-bc5b-42f4-81d5-339921e42100'),
            FirecrawlScrapeWebsiteTool(),
		],
		verbose=True,
        memory=True,
        cache= True
    )

@agent
def especialista_processo_produtivo(self) -> Agent:
    return Agent(
		config=self.agents_config['especialista_processo_produtivo'],
		tools=[
			EXASearchTool(api_key='30b2cb5f-bc5b-42f4-81d5-339921e42100'),
            FirecrawlScrapeWebsiteTool(),
		],
		verbose=True,
        memory=True,
        cache=True
	)

##Chamando tarefas TimeClienteProduto
@task
def pesquisar_cliente(self) -> Task:
    return Task(
		config=self.tasks_config['pesquisar_cliente'],
        output_pydantic= ResumoCliente
	)

@task
def pesquisar_material(self) -> Task:
    return Task(
		config=self.tasks_config['pesquisar_material'],
		output_pydantic= ResumoMateriaPrima,
        output_file='materia_prima.md'
	)

@task
def pesquisar_processo_produtivo(self) -> Task:
    return Task(
		config=self.tasks_config['pesquisar_processo_produtivo'],
		output_pydantic= ResumoProcessoProdutivo,
        context= [self.pesquisar_cliente(), self.pesquisar_material()],
        output_file='processo_produtivo.md'
	)

@crew
def crew(self) -> Crew:
    """Creates the Research Crew"""
    # To learn how to add knowledge sources to your crew, check out the documentation:
    # https://docs.crewai.com/concepts/knowledge#what-is-knowledge

    return Crew(
        agents=self.agents, # Automatically created by the @agent decorator
        tasks=self.tasks, # Automatically created by the @task decorator
        process=Process.sequential,
        verbose=True,
    )

```
