Getting error everytime sending a task request

I am using CrewAI to create an agent. Doing everything as mentioned in documentation. See below for the CrewBase class:

@CrewBase
class EnergyAssitt():
    """EnergyAssitt crew"""

    # Learn more about YAML configuration files here:
    # Agents: https://docs.crewai.com/concepts/agents#yaml-configuration-recommended
    # Tasks: https://docs.crewai.com/concepts/tasks#yaml-configuration-recommended
    agents_config = 'config/agents.yaml'
    tasks_config = 'config/tasks.yaml'

    def __init__(self):
        logger.info(f"__init__")


    # If you would like to add tools to your agents, you can learn more about it here:
    # https://docs.crewai.com/concepts/agents#agent-tools
    @agent
    def assistant(self) -> Agent:
        logger.info(f"assistant")
        return Agent(
            config=self.agents_config['mechanical_assistant'],
            memory=True,
            memory_config=memory_config,
            verbose=True
        )


    # To learn more about structured task outputs,
    # task dependencies, and task callbacks, check out the documentation:
    # https://docs.crewai.com/concepts/tasks#overview-of-a-task
    @task
    def chat_task(self) -> Task:
        logger.info(f"chat_task")
        return Task(
            config=self.tasks_config['chat_task'],
            agent=self.assistant()
        )


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

        logger.info(f"crew")
        return Crew(
            agents=self.agents, # Automatically created by the @agent decorator
            tasks=self.tasks, # Automatically created by the @task decorator
            process=Process.sequential,
            knowledge_sources=[pdf_source],
            verbose=True,
            # process=Process.hierarchical, # In case you wanna use that instead https://docs.crewai.com/how-to/Hierarchical/
        )

However, everytime I give a task request, I get following error:

`2025-03-19 16:46:10,270 - app.services.services - INFO - Task 5a3a8b3a-573f-4b18-9a11-43d079df87fb failed with error: 'mechanical_assistant'`

Any suggestions what is going wrong or how to troubleshoot.

Are you sure mechanical_assistant agent is defined in config/agents.yaml?

Make sure the have the same casing. It might be helpful to past the definition of the agent in yaml, there might be something wrong there.

Thanx for suggestion. It worked.