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?