Coworker mentioned not found

Have configured several agents/task in yaml, verified names/syntax and all. Project Manager is set as crew manager and the first task he needs to do is to initiate a market research, on which he needs to call Market Research Analyst. both of them are in agents/tasks and crew.py. yes still, everytime i crew.kickoff i always get:

Error executing tool. coworker mentioned not found, it must be one of the following options:

  • project manager agent

the logs prior to this error are ususally:

Agent: Project Manager Agent
Using tool: Delegate work to coworker
Tool Input:
“{"task": "Conduct market research …", "coworker": "Market Research Analyst"}”

Latest version of Crew, llm is fireworks_ai/accounts/fireworks/models/llama-v3p1-8b-instruct

First off, welcome, Yury!

I recommend you take a close look at this other thread, where a similar issue was reported and discussed in depth.

If the suggestions there don’t solve your problem, I’d suggest you give us a concrete example in your question. That way, we can better understand what’s going wrong and help you out more effectively.

Hello Max and thatnk you for this, sounds like a gr8 idea!
For now, i’ve swtched to a sequential process, without a team meet. I need this for pov, if/when go to prod will try the team meet.

1 Like

@Max_Moura I also encountered this problem in the Chinese task scene, but I found that it seemed that the Chinese part contained in the tool input was garbled, which caused the task delegation to fail. I want to know how to solve this garbled problem.

@xjtupy,

Hey, one thing to double-check is which LLM you’re using for the Manager. The Manager’s LLM needs to be pretty solid, capable enough to handle tools – since delegation in CrewAI is basically a tool-using process – and it also needs to be good with Chinese.

A quick way to test this out is to temporarily swap in a more powerful LLM for the Manager and see if that helps it handle the delegation better.

If you try a beefier LLM for the Manager and still don’t see any improvement, then the issue might be something like an encoding problem, for example. In that case, I’d suggest opening a Bug Issue on the project’s GitHub. Make sure to include a simplified, complete piece of code that can reproduce the exact error you’re seeing.

@Max_Moura
Hey, The model I used is: deepseek_v3_0324. I changed the model to qwen2.5:32b and this problem still occurred. In addition, I switched the task to English and used llama3.3:70b as the model. Although there was no garbled problem, this error was still reported. Therefore, I guess this error is not caused by the garbled problem. Please help me check it out.

qwen2.5:32b error message

llama3.3:70b error message

Complete code in English

import os
from crewai import Agent
from crewai import Crew, Process
from crewai import Task
from crewai.tools import tool, BaseTool
from pydantic import BaseModel, Field
from typing import Type
import litellm
litellm.set_verbose=False
from crewai import LLM
#key = 'sk-xxxxx'
#llm = LLM(api_key=key, model="deepseek/deepseek-chat", base_url="https://api.deepseek.com")
llm = LLM(
    model="ollama/llama3.3:70b",
    base_url="http://xxxx:11434"
)
class B_search_input(BaseModel):
    """Input parameters of B_search_tool"""
    query: str = Field(..., description="Retrieve the query of database poi")
    lng: str = Field(..., description="Retrieve longitude")
    lat: str = Field(..., description="Retrieve Latitude")
    country_code: str = Field(..., description="Retrieve location")
class B_search_tool(BaseTool):
    name: str = "Retrieve B data"
    description: str = "Retrieve POI information related to the query from the B database"
    args_schema: Type[BaseModel] = B_search_input
    def _run(self, query: str, lng: str, lat: str, country_code: str) -> str:
        return ['xxx']

class A_search_input(BaseModel):
    """Input parameters of A_search_tool"""
    query: str = Field(..., description="Retrieve the query of database poi")
    lng: str = Field(..., description="Retrieve longitude")
    lat: str = Field(..., description="Retrieve Latitude")
    country_code: str = Field(..., description="Retrieve location")

class A_search_tool(BaseTool):
    name: str = "Retrieve A data"
    description: str = "Retrieve POI information related to query from the A database"
    args_schema: Type[BaseModel] = A_search_input
    
    def _run(self, query: str, lng: str, lat: str, country_code: str) -> str:
        return ['xxx']

correlation_analysis_agent = Agent(
    role='correlation_analysis_assistant',
    goal='Find out the set of unrelated queries between user search queries: {search_querys} and click pois: {click_pois}.',
    backstory="You are an expert in the field of POI search, good at analyzing users' search intent and determining the correlation between users' search queries and clicked POIs.",
    llm=llm,
    # verbose=True,
    # allow_delegation=False
)


A_check_agent = Agent(
    role='A_data_verification_assistant',
    goal='According to the irrelevant query set provided by the correlation analysis assistant, search for POI from the A retrieval interface, verify whether there is POI matching the irrelevant query in the A database, and find out the missing query set.',
    backstory="You are an expert in the field of POI search and are good at analyzing the correlation between query and POI.",
    tools=[A_search_tool()],
    llm=llm,
    # verbose=True,
    # allow_delegation=False
)


B_check_agent = Agent(
    role='B_data_verification_assistant',
    goal='According to the missing query set provided by the A data verification assistant, search for POI from the B retrieval interface, verify whether there is a POI matching the missing query in the B database, and find out the missing POI data in the A database to be verified.',
    backstory="You are an expert in POI search, good at analyzing the correlation between query and POI, and finding the POI most relevant to the query from the POI list.",
    tools=[B_search_tool()],
    llm=llm,
    # verbose=True,
    # allow_delegation=False
)

A_check_again_agent = Agent(
    role='A_data_secondary_verification_assistant',
    goal='According to the missing POI data in the A database to be verified provided by the B data verification assistant, search for POI from the A retrieval interface to verify whether the mined missing POI data exists in the A database.',
    backstory="You are an expert in the field of POI data, good at analyzing the correlation between POIs and finding the POIs that are most relevant to the missing POIs from the POI list.",
    tools=[A_search_tool()],
    llm=llm,
    # verbose=True,
    # allow_delegation=False
)

miss_mining_agent = Agent(
    role='missing_mining_assistant',
    goal='Based on user search query: {search_querys} and click POI: {click_pois}, direct team members to find the missing POI data in the A database.',
    backstory="""You are an experienced manager of POI data missing mining tasks, good at managing complex employees with different skills.
                 Your team has the following four members: correlation_analysis_assistant, A_data_verification_assistant, B_data_verification_assistant, A_data_secondary_verification_assistant.
                 The workflow to complete this task is: from correlation_analysis_assistant, to A_data_verification_assistant, to B_data_verification_assistant, and finally to A_data_secondary_verification_assistant.
                 Your main job is to coordinate the work of each member, and decide whether other members work based on the feedback results of each member, and finally you give a satisfactory task processing result""",
    llm=llm,
    verbose=True,
    allow_delegation=True
)

correlation_analysis_task = Task(
    description="""### Task objective\nFind out irrelevant query sets\n\n### Execution method\nBased on the query list searched by the user: {search_querys} and the list of POIs clicked: {click_pois}, analyze the correlation between each query searched by the user and all clicked POIs, and find out irrelevant queries.\n\n### Note:\n1. The query searched by the user may have typos or the expression may not be completely consistent with the POI name, etc., and it is judged as relevant;\n2. If the query searched by the user partially matches the clicked POI, it is judged as relevant;\n3. If the house number is inconsistent, it is judged as irrelevant, for example, 'No. 18, xxx Road is irrelevant to xxx Road'.""",
    expected_output="""Your response consists of two parts: your thought process and your final answer.
                       The thinking process is wrapped in <thinking></thinking>.
                       The final answer is output in the following format: unrelated query set: [{'query':'xxx', 'lng':'xxx', 'lat':'xxx', 'country_code':'xxx'}], and wrapped in <answer></answer>.""",
    agent=correlation_analysis_agent
)


A_check_task = Task(
    description="### Task objective\nFind out the missing query set\n\n### Execution method\nFor each irrelevant query, use the A search interface to search for POI and verify whether there is a POI matching the irrelevant query in the A database. If not, it is a missing query.",
    expected_output="""Your response consists of two parts: your thought process and your final answer.
                       The thinking process is wrapped in <thinking></thinking>.
                       The final answer is output in the following format: missing query set: [{'query':'xxx', 'lng':'xxx', 'lat':'xxx', 'country_code':'xxx'}], and wrapped with <answer></answer>.""",
    agent=A_check_agent
)

B_check_task = Task(
    description="### Task objective\nFind out the missing POI set in the A database to be verified\n\n### Execution method\nFor each missing query, search for POI from the B retrieval interface, verify whether there is a POI matching the missing query in the B database, and find out the missing POI data in the A database to be verified.",
    expected_output="""Your response consists of two parts: your thought process and your final answer.
                       The thinking process is wrapped in <thinking></thinking>.
                       The final answer is output in the following format: missing POI data in the A database to be verified: {'query':'xxx', 'missing POI information to be verified':{'poi_name':'xxx', 'lng':'xxx', 'lat':'xxx', 'country_code':'xxx'}}, and wrapped in <answer></answer>.""",
    agent=B_check_agent
)


A_check_again_task = Task(
    description="### Task objective\nFind out the missing POI set\n\n### Execution method\nFor each missing POI to be verified, search for POI from the A retrieval interface, verify whether the mined missing POI data already exists in the A database, and find out the real missing POI data.",
    expected_output="""Your response consists of two parts: your thought process and your final answer.
                       The thinking process is wrapped in <thinking></thinking>.
                       The final answer is output in the following format: missing poi data in A database: {{'query':'xxx', 'missing poi information':{{'poi_name':'xxx', 'lng':'xxx', 'lat':'xxx'}}}}, and wrapped in <answer></answer>.""",
    agent=A_check_again_agent
)

miss_mining_crew = Crew(
    agents=[correlation_analysis_agent, A_check_agent, B_check_agent, A_check_again_agent],
    tasks=[correlation_analysis_task, A_check_task, B_check_task, A_check_again_task],
    process=Process.hierarchical,
    # process=Process.sequential,
    # manager_llm=[llm],
    output_log_file=False,
    manager_agent=miss_mining_agent
)

user_input = {'search_querys':[{"query": "cultural 512", "lng": "-51.22509179999991", "lat": "-30.04127166", "country_code": "BR"}],
              'click_pois': [{'poi_name': 'Espaço Cultural 512', 'poi_lng': '-51.22509179999991', 'poi_lat': '-30.04127166', 'country_code': 'BR'}]}

result = miss_mining_crew.kickoff(inputs=user_input)

Alright, so I took a crack at your code:

  1. Regarding that IndexError: list index out of range you’re hitting with the Ollama models, it looks like this has already been discussed pretty thoroughly over here.

  2. Then, I gave it a shot with the Gemini 2.5 Flash LLM, and everything ran smoothly (check out the image below for the last few lines of the output). Of course, the output itself isn’t really useful since the tools are just stripped-down versions and not the fully functional ones.

@Max_Moura
If it’s convenient, please send me the code you run. :grinning_face:

Code:
import os
from crewai import LLM, Agent, Task, Crew, Process
from crewai.tools import BaseTool
from pydantic import BaseModel, Field
from typing import Type

os.environ["GEMINI_API_KEY"] = "<YOUR_KEY>"

llm = LLM(
    model="gemini/gemini-2.5-flash-preview-04-17",
    temperature=0.7,
)


class B_search_input(BaseModel):
    """Input parameters of B_search_tool"""

    query: str = Field(..., description="Retrieve the query of database poi")
    lng: str = Field(..., description="Retrieve longitude")
    lat: str = Field(..., description="Retrieve Latitude")
    country_code: str = Field(..., description="Retrieve location")


class B_search_tool(BaseTool):
    name: str = "Retrieve B data"
    description: str = (
        "Retrieve POI information related to the query from the B database"
    )
    args_schema: Type[BaseModel] = B_search_input

    def _run(self, query: str, lng: str, lat: str, country_code: str) -> str:
        return str(["xxx"])


class A_search_input(BaseModel):
    """Input parameters of A_search_tool"""

    query: str = Field(..., description="Retrieve the query of database poi")
    lng: str = Field(..., description="Retrieve longitude")
    lat: str = Field(..., description="Retrieve Latitude")
    country_code: str = Field(..., description="Retrieve location")


class A_search_tool(BaseTool):
    name: str = "Retrieve A data"
    description: str = (
        "Retrieve POI information related to query from the A database"
    )
    args_schema: Type[BaseModel] = A_search_input

    def _run(self, query: str, lng: str, lat: str, country_code: str) -> str:
        return str(["xxx"])


correlation_analysis_agent = Agent(
    role="correlation_analysis_assistant",
    goal=(
        "Find out the set of unrelated queries between user search queries: "
        "{search_querys} and click pois: {click_pois}."
    ),
    backstory=(
        "You are an expert in the field of POI search, good at analyzing "
        "users' search intent and determining the correlation between users' "
        "search queries and clicked POIs."
    ),
    llm=llm,
    verbose=True,
    allow_delegation=False,
)

A_check_agent = Agent(
    role="A_data_verification_assistant",
    goal=(
        "According to the irrelevant query set provided by the correlation "
        "analysis assistant, search for POI from the A retrieval interface, "
        "verify whether there is POI matching the irrelevant query in the A "
        "database, and find out the missing query set."
    ),
    backstory=(
        "You are an expert in the field of POI search and are good at "
        "analyzing the correlation between query and POI."
    ),
    tools=[A_search_tool()],
    llm=llm,
    verbose=True,
    allow_delegation=False,
)

B_check_agent = Agent(
    role="B_data_verification_assistant",
    goal=(
        "According to the missing query set provided by the A data "
        "verification assistant, search for POI from the B retrieval "
        "interface, verify whether there is a POI matching the missing "
        "query in the B database, and find out the missing POI data in the "
        "A database to be verified."
    ),
    backstory=(
        "You are an expert in POI search, good at analyzing the correlation "
        "between query and POI, and finding the POI most relevant to the "
        "query from the POI list."
    ),
    tools=[B_search_tool()],
    llm=llm,
    verbose=True,
    allow_delegation=False,
)

A_check_again_agent = Agent(
    role="A_data_secondary_verification_assistant",
    goal=(
        "According to the missing POI data in the A database to be verified "
        "provided by the B data verification assistant, search for POI from "
        "the A retrieval interface to verify whether the mined missing POI "
        "data exists in the A database."
    ),
    backstory=(
        "You are an expert in the field of POI data, good at analyzing the "
        "correlation between POIs and finding the POIs that are most "
        "relevant to the missing POIs from the POI list."
    ),
    tools=[A_search_tool()],
    llm=llm,
    verbose=True,
    allow_delegation=False,
)

miss_mining_agent = Agent(
    role="missing_mining_assistant",
    goal=(
        "Based on user search query: {search_querys} and click POI: "
        "{click_pois}, direct team members to find the missing POI data in "
        "the A database."
    ),
    backstory=(
        "You are an experienced manager of POI data missing mining tasks, "
        "good at managing complex employees with different skills.\n"
        "Your team has the following four members: "
        "correlation_analysis_assistant, A_data_verification_assistant, "
        "B_data_verification_assistant, "
        "A_data_secondary_verification_assistant.\n"
        "The workflow to complete this task is: from "
        "correlation_analysis_assistant, to "
        "A_data_verification_assistant, to B_data_verification_assistant, "
        "and finally to A_data_secondary_verification_assistant.\n"
        "Your main job is to coordinate the work of each member, and "
        "decide whether other members work based on the feedback results "
        "of each member, and finally you give a satisfactory task "
        "processing result"
    ),
    llm=llm,
    verbose=True,
    allow_delegation=True,
)

correlation_analysis_task = Task(
    description=(
        "### Task objective\n"
        "Find out irrelevant query sets\n\n"
        "### Execution method\n"
        "Based on the query list searched by the user: {search_querys} and "
        "the list of POIs clicked: {click_pois}, analyze the correlation "
        "between each query searched by the user and all clicked POIs, and "
        "find out irrelevant queries.\n\n"
        "### Note:\n"
        "1. The query searched by the user may have typos or the "
        "expression may not be completely consistent with the POI name, "
        "etc., and it is judged as relevant;\n"
        "2. If the query searched by the user partially matches the "
        "clicked POI, it is judged as relevant;\n"
        "3. If the house number is inconsistent, it is judged as "
        "irrelevant, for example, \"No. 18, xxx Road is irrelevant to "
        "xxx Road\"."
    ),
    expected_output=(
        "Your response consists of two parts: your thought process and "
        "your final answer.\n"
        "The thinking process is wrapped in <thinking></thinking>.\n"
        "The final answer is output in the following format: "
        "unrelated query set: [{\"query\":\"xxx\", \"lng\":\"xxx\", "
        "\"lat\":\"xxx\", \"country_code\":\"xxx\"}], and wrapped in "
        "<answer></answer>."
    ),
    agent=correlation_analysis_agent,
)

A_check_task = Task(
    description=(
        "### Task objective\n"
        "Find out the missing query set\n\n"
        "### Execution method\n"
        "For each irrelevant query, use the A search interface to search "
        "for POI and verify whether there is a POI matching the "
        "irrelevant query in the A database. If not, it is a missing "
        "query."
    ),
    expected_output=(
        "Your response consists of two parts: your thought process and "
        "your final answer.\n"
        "The thinking process is wrapped in <thinking></thinking>.\n"
        "The final answer is output in the following format: "
        "missing query set: [{\"query\":\"xxx\", \"lng\":\"xxx\", "
        "\"lat\":\"xxx\", \"country_code\":\"xxx\"}], and wrapped with "
        "<answer></answer>."
    ),
    agent=A_check_agent,
)

B_check_task = Task(
    description=(
        "### Task objective\n"
        "Find out the missing POI set in the A database to be verified\n\n"
        "### Execution method\n"
        "For each missing query, search for POI from the B retrieval "
        "interface, verify whether there is a POI matching the missing "
        "query in the B database, and find out the missing POI data in "
        "the A database to be verified."
    ),
    expected_output=(
        "Your response consists of two parts: your thought process and "
        "your final answer.\n"
        "The thinking process is wrapped in <thinking></thinking>.\n"
        "The final answer is output in the following format: "
        "missing POI data in the A database to be verified: "
        "{\"query\":\"xxx\", \"missing POI information to be verified\":"
        "{\"poi_name\":\"xxx\", \"lng\":\"xxx\", \"lat\":\"xxx\", "
        "\"country_code\":\"xxx\"}}, and wrapped in <answer></answer>."
    ),
    agent=B_check_agent,
)

A_check_again_task = Task(
    description=(
        "### Task objective\n"
        "Find out the missing POI set\n\n"
        "### Execution method\n"
        "For each missing POI to be verified, search for POI from the A "
        "retrieval interface, verify whether the mined missing POI data "
        "already exists in the A database, and find out the real missing "
        "POI data."
    ),
    expected_output=(
        "Your response consists of two parts: your thought process and "
        "your final answer.\n"
        "The thinking process is wrapped in <thinking></thinking>.\n"
        "The final answer is output in the following format: "
        "missing poi data in A database: {{\"query\":\"xxx\", "
        "\"missing poi information\":{{\"poi_name\":\"xxx\", "
        "\"lng\":\"xxx\", \"lat\":\"xxx\"}}}}, and wrapped in "
        "<answer></answer>."
    ),
    agent=A_check_again_agent,
)

miss_mining_crew = Crew(
    agents=[
        correlation_analysis_agent,
        A_check_agent,
        B_check_agent,
        A_check_again_agent,
    ],
    tasks=[
        correlation_analysis_task,
        A_check_task,
        B_check_task,
        A_check_again_task,
    ],
    process=Process.hierarchical,
    output_log_file=False,
    manager_agent=miss_mining_agent,
)

user_input = {
    "search_querys": [
        {
            "query": "cultural 512",
            "lng": "-51.22509179999991",
            "lat": "-30.04127166",
            "country_code": "BR",
        }
    ],
    "click_pois": [
        {
            "poi_name": "Espaço Cultural 512",
            "poi_lng": "-51.22509179999991",
            "poi_lat": "-30.04127166",
            "country_code": "BR",
        }
    ],
}

result = miss_mining_crew.kickoff(
    inputs=user_input
)

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.