Errors when running default tests

I am following the instructions on github (GitHub - crewAIInc/crewAI: Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.) to install and run crewai. I am running into quite a few problems. Is there a more up-to-date instruction?

Here is the procedure from Github that I used:

===============
uv lock
uv sync
uv venv
pre-commit install
uv run pytest .

Running the tests give me a few issues:

  • It seems to get stuck at crew_test.py.
  • I got around this issue by removing crew_test.py.
  • The test then ended with a lot of errors.

Most of the errors have to do with OpenAI authentication:

============
FAILED tests/agent_test.py::test_custom_llm_temperature_preservation - openai.OpenAIError: The api_key client option must be set either by passing api_key to the client …

FAILED tests/agent_test.py::test_agent_execution - litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AuthenticationError: OpenAIEx…

There are a few other Assertion and Validation errors:

============

FAILED tests/tools/agent_tools/agent_tools_test.py::test_delegate_work - AssertionError: assert ‘Error execut…ment variable’ == ‘I understand…d deployment.’

FAILED tests/tools/agent_tools/agent_tools_test.py::test_delegate_work_with_wrong_co_worker_variable - assert ‘Error execut…ment variable’ == ‘AI agents ar…al downsides.’

FAILED tests/tools/agent_tools/agent_tools_test.py::test_ask_question - AssertionError: assert ‘Error execut…ment variable’ == ‘As an expert…nd AI agents.’

FAILED tests/tools/agent_tools/agent_tools_test.py::test_ask_question_with_wrong_co_worker_variable - assert ‘Error execut…ment variable’ == “I don’t hate… daily lives.”

FAILED tests/tools/agent_tools/agent_tools_test.py::test_delegate_work_withwith_coworker_as_array - AssertionError: assert ‘Error execut…ment variable’ == ‘My perspecti…th AI agents.’

FAILED tests/tools/agent_tools/agent_tools_test.py::test_ask_question_with_coworker_as_array - AssertionError: assert ‘Error execut…ment variable’ == ‘As an expert…e on society.’

FAILED tests/utilities/test_converter.py::test_convert_with_instructions - crewai.utilities.converter.ConverterError: Failed to convert text into a Pydantic model due to err…

FAILED tests/utilities/test_converter.py::test_converter_with_llama3_2_model - crewai.utilities.converter.ConverterError: Failed to convert text into a Pydantic model due to err…

FAILED tests/utilities/test_converter.py::test_converter_with_llama3_1_model - crewai.utilities.converter.ConverterError: Failed to convert text into a Pydantic model due to err…

FAILED tests/utilities/test_converter.py::test_converter_with_nested_model - crewai.utilities.converter.ConverterError: Failed to convert text into a Pydantic model due to err…

ERROR tests/memory/external_memory_test.py::test_crew_with_external_memory_initialization - pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew

ERROR tests/memory/external_memory_test.py::test_crew_external_memory_reset[external] - pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew

ERROR tests/memory/external_memory_test.py::test_crew_external_memory_reset[all] - pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew

ERROR tests/memory/external_memory_test.py::test_crew_external_memory_save_with_memory_flag[search] - pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew

ERROR tests/memory/external_memory_test.py::test_crew_external_memory_save_with_memory_flag[save] - pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew

ERROR tests/memory/external_memory_test.py::test_external_memory_custom_storage - pydantic_core._pydantic_core.ValidationError: 1 validation error for Crew

ERROR tests/memory/short_term_memory_test.py::test_save_and_search - ValueError: Please provide an OpenAI API key. You can get one at https://platform.openai.com/accou

Am I missing some steps?

Thank you very much for your help.

Giving this a bump. Do other people not run into the same problems when running the default tests?

If you’re just looking to install and get started with CrewAI for now, I highly recommend you follow the installation guide.

I’m assuming you want to install CrewAI from source and not via the usual way outlined in the guides.

To install from source you don’t need to run the tests.

uv lock
uv sync
uv venv
uv build
pip install dist/*.tar.gz

These steps should be enough to set you up.

Thank you @Max_Moura @zinyando for your responses.

The reason I want to run the tests is that at some point, I may want to modify the source code to contribute new features or fix issues. In that case, I would want to make sure I can run the existing tests to make sure I haven’t broken anything.

Thank you.

1 Like

I have figured out how to resolve these issues. Just need to make sure the following environment variables are set:

OPENAI_API_KEY
SERPER_API_KEY
CI

Probably a good idea to specify this in the GitHub “Contribution” section.

You can create a PR adding that on GitHub. It might help other people

@zinyando Sure, I’ll do that.