crewAI icon indicating copy to clipboard operation
crewAI copied to clipboard

Bug in 0.22.5 with co-worker delegation

Open olafgeibig opened this issue 1 year ago • 3 comments

The agent wants to delegate a task to a co-worker. Although the name is correct, the co-worker is not found. crewAI 0.22.5, MacOS, Python 3.11.7, Ollama running adrienbrault/nous-hermes2pro:Q5_K_M

Output:

Example input:
{
  "tool_name": "delegate work to co-worker",
  "arguments": {
    "coworker": "Senior Research Analyst",
    "task": "Summarize the top 10 AI trends for 2024",
    "context": "Here are the top 10 AI and machine learning trends to prepare for in 2024:\n\n1. Multimodal AI\n2. Small (er) language models and open source advancements\n3. GPU shortages and cloud costs\n4. Customized local models and data pipelines\n5. More powerful virtual agents\n6. Seamless integration of AI into everyday products\n7. Emphasis on ethics, safety, and regulatory compliance\n8. Advancements in explainable AI (XAI)\n9. Quantum computing and AI convergence\n10. Continued growth of generative AI"
  }
}<|im_end|> 

Error executing tool. Co-worker mentioned not found, it must to be one of the following options:
- Senior Research Analyst

The Agent definition:

researcher = Agent(
  role='Senior Research Analyst',
  goal='Uncover cutting-edge developments in AI and data science in',
  backstory="""You are a Senior Research Analyst at a leading tech think tank.
  Your expertise lies in identifying emerging trends and technologies in AI and
  data science. You have a knack for dissecting complex data and presenting
  actionable insights. You ask the human for feedback if the result of a research is relevant for the report.""",
  verbose=True,
  allow_delegation=False,
  tools=[search_tool],
  llm=llm,
  function_calling_llm=llm_func
)

olafgeibig avatar Mar 15 '24 19:03 olafgeibig

I see a lot of this too. From the verbose logs it looks like the Action Input is incorrectly structuring the task, using to co-worker instead of coworker.

For example, this fails:

Action: Ask question to co-worker
Action Input: {
    "co-worker": "Analyzer",
    "question": "Can you provide me a summary?",
    "context": ""
}

But this works:

Action: Ask question to co-worker
Action Input: {
    "coworker": "Analyzer",
    "question": "Can you provide me a summary?",
    "context": ""
}

ryanmac avatar Mar 20 '24 20:03 ryanmac

Interesting. Probably co-worker was a bad choice because there are two correct spellings for it.

olafgeibig avatar Mar 25 '24 12:03 olafgeibig

in which .py to fix it?

WindSmileValley avatar May 22 '24 08:05 WindSmileValley

I've had the same problem when LLM (Mistral 0.3 in my case) return action input key as co-worker instead of required coworker and this caused the same misleading error about absent agent. I fixed it in this PR. Already tested in my fork - it works fine.

madmag77 avatar May 30 '24 07:05 madmag77

I'm using your fork (@madmag77) with Ollama and llama 3 and it's still failing with:

"Thought: I need to break down this complex task into manageable blah blah.. Action Input: {.. "coworker": "architect <-- Thought output truncates here?
Error executing tool. coworker mentioned not found, it must to be one of the following options:

  • architect

imars avatar May 30 '24 14:05 imars

@imars

I'm using your fork (@madmag77) with Ollama and llama 3 and it's still failing with:

"Thought: I need to break down this complex task into manageable blah blah.. Action Input: {.. "coworker": "architect <-- Thought output truncates here? Error executing tool. coworker mentioned not found, it must to be one of the following options:

  • architect

Interesting, I'm using it with LM Studio + Phi3 medium or Mistral Instruct 0.3 and it works fine, especially with Mistral (Phi sometimes fails on other steps in my flow, but delegation works perfect). When I tried LM Studio + Llama 3 7B it doesn't work at all - Llama just tries to do everything in one response: delegate work, add observations, add imaginary answer from delegate and finish the work :)

I'll try to install Ollama and try LLama3 again later on though - curios how it would work...

madmag77 avatar May 31 '24 06:05 madmag77

I'm using your fork (@madmag77) with Ollama and llama 3 and it's still failing with:

"Thought: I need to break down this complex task into manageable blah blah.. Action Input: {.. "coworker": "architect <-- Thought output truncates here? Error executing tool. coworker mentioned not found, it must to be one of the following options:

  • architect

@imars I finally tested on Llama 3 with Ollama and LM Studio and made another fix in my fork after that it started working. You may want to try it as well to check

madmag77 avatar Jun 01 '24 14:06 madmag77

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

github-actions[bot] avatar Aug 20 '24 10:08 github-actions[bot]

This issue was closed because it has been stalled for 5 days with no activity.

github-actions[bot] avatar Aug 25 '24 12:08 github-actions[bot]