Description
The example on https://www.crewai.com/open-source does not work. To be clear, the error is just a pydantic error meaning the example is likely out of date and just needs to be updated.
I am not asking how to make this example work, just pointing out that the example provided is broken.
python 3.12.4
crew 0.67.1
Combine this into a single example
from crewai import Agent, Task, Crew, Process
# Agent definition
researcher = Agent(
role='Senior Researcher',
goal='Uncover groundbreaking technologies in AI',
backstory='Driven by curiosity, you explore and share the latest innovations.'
)
# Task definition
research_task = Task(
description='Identify the next big trend in AI with pros and cons.',
expected_output='A 3-paragraph report on emerging AI technologies.'
)
def main():
print("forming crew")
# Forming the crew and kicking off the process
crew = Crew(
agents=[researcher],
tasks=[research_task],
process=Process.sequential
)
print("running crew")
result = crew.kickoff(inputs={'topic': 'AI in healthcare'})
print(result)
if __name__ == "__main__":
main()
and you get an error
pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew
Sequential process error: Agent is missing in the task with the following description: Identify the next big trend in AI with pros and cons. [type=missing_agent_in_task, input_value={'agents': [Agent(role=Se...quential: 'sequential'>}, input_type=dict]
Steps to Reproduce
poetry new testcrew
- set version python = ">=3.10,<3.13"
poetry add crewai
vim testcrew script.py <- add example from description
poetry run python crewtest/script.py
Expected behavior
Expected: It to work
Actual:
Traceback (most recent call last):
File "/Users/lukelalor/projects/crewtest/crewtest/script.py", line 33, in <module>
main()
File "/Users/lukelalor/projects/crewtest/crewtest/script.py", line 22, in main
crew = Crew(
^^^^^
File "/Users/lukelalor/Library/Caches/pypoetry/virtualenvs/crewtest-dgSFKtrv-py3.12/lib/python3.12/site-packages/pydantic/main.py", line 212, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew
Sequential process error: Agent is missing in the task with the following description: Identify the next big trend in AI with pros and cons. [type=missing_agent_in_task, input_value={'agents': [Agent(role=Se...quential: 'sequential'>}, input_type=dict]
Screenshots/Code snippets
from crewai import Agent, Task, Crew, Process
# Agent definition
researcher = Agent(
role='Senior Researcher',
goal='Uncover groundbreaking technologies in AI',
backstory='Driven by curiosity, you explore and share the latest innovations.'
)
# Task definition
research_task = Task(
description='Identify the next big trend in AI with pros and cons.',
expected_output='A 3-paragraph report on emerging AI technologies.'
)
def main():
print("forming crew")
# Forming the crew and kicking off the process
crew = Crew(
agents=[researcher],
tasks=[research_task],
process=Process.sequential
)
print("running crew")
result = crew.kickoff(inputs={'topic': 'AI in healthcare'})
print(result)
if __name__ == "__main__":
main()
Operating System
Sonoma 14.6.1
Python Version
3.12.4
crewAI Version
0.67.1
crewAI Tools Version
n/a
Virtual Environment
Poetry
Evidence
lukelalor@MacBook-Pro crewtest % poetry run python crewtest/script.py
/Users/lukelalor/Library/Caches/pypoetry/virtualenvs/crewtest-dgSFKtrv-py3.12/lib/python3.12/site-packages/pysbd/segmenter.py:66: SyntaxWarning: invalid escape sequence '\s'
for match in re.finditer('{0}\s*'.format(re.escape(sent)), self.original_text):
/Users/lukelalor/Library/Caches/pypoetry/virtualenvs/crewtest-dgSFKtrv-py3.12/lib/python3.12/site-packages/pysbd/lang/arabic.py:29: SyntaxWarning: invalid escape sequence '\.'
txt = re.sub('(?<={0})\.'.format(am), '∯', txt)
/Users/lukelalor/Library/Caches/pypoetry/virtualenvs/crewtest-dgSFKtrv-py3.12/lib/python3.12/site-packages/pysbd/lang/persian.py:29: SyntaxWarning: invalid escape sequence '\.'
txt = re.sub('(?<={0})\.'.format(am), '∯', txt)
loading file
forming crew
Traceback (most recent call last):
File "/Users/lukelalor/projects/crewtest/crewtest/script.py", line 33, in <module>
main()
File "/Users/lukelalor/projects/crewtest/crewtest/script.py", line 22, in main
crew = Crew(
^^^^^
File "/Users/lukelalor/Library/Caches/pypoetry/virtualenvs/crewtest-dgSFKtrv-py3.12/lib/python3.12/site-packages/pydantic/main.py", line 212, in __init__
validated_self = self.__pydantic_validator__.validate_python(data, self_instance=self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew
Sequential process error: Agent is missing in the task with the following description: Identify the next big trend in AI with pros and cons. [type=missing_agent_in_task, input_value={'agents': [Agent(role=Se...quential: 'sequential'>}, input_type=dict]
Possible Solution
update the example with correct contract
Additional context
I am just pointing out that the example on the front page doesn't work, not necessarily trying to get this to work.
Description
The example on https://www.crewai.com/open-source does not work. To be clear, the error is just a pydantic error meaning the example is likely out of date and just needs to be updated.
I am not asking how to make this example work, just pointing out that the example provided is broken.
python 3.12.4
crew 0.67.1
Combine this into a single example
and you get an error
Steps to Reproduce
poetry new testcrewpoetry add crewaivim testcrew script.py<- add example from descriptionpoetry run python crewtest/script.pyExpected behavior
Expected: It to work
Actual:
Screenshots/Code snippets
Operating System
Sonoma 14.6.1
Python Version
3.12.4
crewAI Version
0.67.1
crewAI Tools Version
n/a
Virtual Environment
Poetry
Evidence
Possible Solution
update the example with correct contract
Additional context
I am just pointing out that the example on the front page doesn't work, not necessarily trying to get this to work.