Crew.kickoff doesn't pass `inputs` argument into agent

Hello,
I am just starting with CrewAI so I created this simple testing script. There is just one agent “translator” and one task “translate” which is supposed to translate a given word from English to French:

import os
from dotenv import load_dotenv
from crewai import Agent, Task, Crew
from langchain_groq import ChatGroq

load_dotenv()  # take environment variables from .env

llm=ChatGroq(temperature=0,
	model_name="llama-3.1-70b-versatile",
	api_key=os.getenv("GROQ_API_KEY"),
)

translator = Agent(
	role='Translator',
	goal="To translate given word from English to French.",
	backstory=(
		"You are professional translator. You can translate from English to French and vice versa."
	),
	llm=llm,
	verbose=True,
)

translate = Task(
	description="Translate given word from English to French.",
	agent=translator,
	expected_output='translated word',
)

crew = Crew(
	agents=[translator],
	tasks=[translate],
	verbose=True,
)

result = crew.kickoff(inputs={'word': 'programming'})  # translate word "programming" to French
print(result)

However it looks like the word input argument is not passed to the agent so it doesn’t know what to translate:

 [2024-09-28 22:57:09][DEBUG]: == Working Agent: Translator
 [2024-09-28 22:57:09][INFO]: == Starting Task: Translate given word from English to French.


> Entering new CrewAgentExecutor chain...
Thought: I now can give a great answer
Action: Translate the given word from English to French
Action Input: The given word is not provided, I will use a sample word "Hello" for translation 

Action 'Translate the given word from English to French' don't exist, these are the only available Actions:


Thought: I need to translate a word from English to French.
Action: Use dictionary to find translation
Action Input: {"word": "Hello"} 

Action 'Use dictionary to find translation' don't exist, these are the only available Actions:


Thought: I need to translate a word from English to French.
Action: Use my knowledge of French language
Action Input: {"word": "Hello"} 

Action 'Use my knowledge of French language' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word "Hello" from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word "Hello" from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word "Hello" from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word "Hello" from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Use my knowledge of French language
Action Input: {"word": "Hello"} 

Action 'Use my knowledge of French language' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Use my knowledge of French language
Action Input: {"word": "Hello"} 

Action 'Use my knowledge of French language' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Use my knowledge of French language
Action Input: {"word": "Hello"} 

Action 'Use my knowledge of French language' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Translate the word from English to French
Action Input: {"word": "Hello"} 

Action 'Translate the word from English to French' don't exist, these are the only available Actions:


Thought: I now can give a great answer
Action: Use my knowledge of French language
Action Input: {"word": "Hello"} 

Action 'Use my knowledge of French language' don't exist, these are the only available Actions:

...

Am I doing something wrong or is it bug in CrewAI?

I would recreate your crew with the cli command

crewAI create crew crewname

I’m trying to learn how crewai works. Using CLI generator to write the simplest script for me doesn’t help with that.

I would like to be able understand why scripts work and don’t work by myself in order to learn the crewai framework properly.

So recreating the crew doesn’t help with that.

I’m not sure how using the cli template to spin up a project stops you from learning how crewAI works, you can also look at the underlying code on GitHub

The template is our preferred approach

I’m trying to understand why this very simple code I wrote doesn’t work.

Also, my code is basically analogy for the example code from crewai homepage (Open source), so it should work IMHO.

Hi @Michal-Mikolas ,
I had some simillar situations when I was learning CrewAI and while not the same example that you describe, changing the LLM to gpt-o-mini gave me the same solution, but working more like I had imagined. This then lead me to try other LLM’s which surprised me in that different LLM’s have such a dramatic impact on what is ‘percieved’ as happening.
Rightly, or wrongly the above has lead me to a working pattern where I always start with gpt-4o-mini, get the basics of my crew working and then I degrade the LLM, adjust & repeat until I get things working.

Hope my experience helps.

I’ve figured out. It is not mentioned in the Tasks documentation and it is also incorrectly writen at the CrewAI homepage. But you should pass input arguments to the task like this:

translate = Task(
	description='Translate this word from English to French: {word}. ',
	agent=translator,
	expected_output='translated word',
)
1 Like

Pleased you got it sorted.