1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 hatchling,
8
9 # dependencies
10 appdirs,
11 blinker,
12 chromadb,
13 click,
14 instructor,
15 json-repair,
16 json5,
17 jsonref,
18 litellm,
19 onnxruntime,
20 openai,
21 opentelemetry-api,
22 opentelemetry-exporter-otlp-proto-http,
23 opentelemetry-sdk,
24 openpyxl,
25 pdfplumber,
26 portalocker,
27 pydantic,
28 pyjwt,
29 python-dotenv,
30 pyvis,
31 qdrant-client,
32 regex,
33 tokenizers,
34 tomli,
35 tomli-w,
36 uv,
37
38 # tests
39 pytestCheckHook,
40 pytest-xdist,
41 versionCheckHook,
42 writableTmpDirAsHomeHook,
43}:
44
45buildPythonPackage rec {
46 pname = "crewai";
47 version = "0.186.1";
48 pyproject = true;
49
50 src = fetchFromGitHub {
51 owner = "crewAIInc";
52 repo = "crewAI";
53 tag = version;
54 hash = "sha256-rSVIbRATMq0cfMdgR/+/tNjij0Sk/ErWipy0m8hKvr4=";
55 };
56
57 build-system = [ hatchling ];
58
59 pythonRelaxDeps = [
60 "chromadb"
61 "json-repair"
62 "litellm"
63 "onnxruntime"
64 "portalocker"
65 "pyvis"
66 ];
67
68 dependencies = [
69 appdirs
70 blinker
71 chromadb
72 click
73 instructor
74 json-repair
75 json5
76 jsonref
77 litellm
78 onnxruntime
79 openai
80 opentelemetry-api
81 opentelemetry-exporter-otlp-proto-http
82 opentelemetry-sdk
83 openpyxl
84 pdfplumber
85 portalocker
86 pydantic
87 pyjwt
88 python-dotenv
89 pyvis
90 regex
91 tokenizers
92 tomli
93 tomli-w
94 uv
95 ];
96
97 pythonImportsCheck = [ "crewai" ];
98
99 disabledTestPaths = [
100 # Ignore tests that require {mem0, chromadb, telemetry, security, test_agent}
101 "tests/memory/test_external_memory.py" # require mem0ai
102 "tests/storage/test_mem0_storage.py" # require mem0ai
103 "tests/cli/test_git.py" # require git
104 "tests/memory/test_short_term_memory.py" # require require API keys
105 "tests/test_crew.py" # require require API keys
106 "tests/rag/chromadb/test_client.py" # issue with chromadb
107 "tests/telemetry/test_telemetry.py" # telemetry need network access
108 ];
109
110 disabledTests = [
111 # Tests parser
112 "test_valid_action_parsing_with_special_characters"
113
114 # Tests agent - require API keys (OpenAI, Anthropic, etc)
115 "test_agent_execution_with_tools"
116 "test_llm_call"
117 "test_agent_repeated_tool_usage"
118 "test_agent_execute_task_basic"
119 "test_agent_execution"
120 "test_ensure_first_task_allow_crewai_trigger_context_is_false_does_not_inject"
121 "test_agent_use_specific_tasks_output_as_context"
122 "test_task_allow_crewai_trigger_context"
123 "test_agent_with_only_crewai_knowledge"
124 "test_logging_tool_usage"
125 "test_agent_execute_task_with_context"
126 "test_agent_repeated_tool_usage_check_even_with_disabled_cache"
127 "test_agent_step_callback"
128 "test_handle_context_length_exceeds_limit_cli_no"
129 "test_task_without_allow_crewai_trigger_context"
130 "test_cache_hitting"
131 "test_agent_knowledege_with_crewai_knowledge"
132 "test_agent_execute_task_with_tool"
133 "test_agent_moved_on_after_max_iterations"
134 "test_agent_function_calling_llm"
135 "test_task_allow_crewai_trigger_context_no_payload"
136 "test_disabling_cache_for_agent"
137 "test_do_not_allow_crewai_trigger_context_for_first_task_hierarchical"
138 "test_tool_result_as_answer_is_the_final_answer_for_the_agent"
139 "test_agent_execute_task_with_ollama"
140 "test_agent_with_knowledge_sources"
141 "test_agent_respect_the_max_rpm_set"
142 "test_agent_execution_with_specific_tools"
143 "test_llm_call_with_ollama_llama3"
144 "test_first_task_auto_inject_trigger"
145 "test_agent_respect_the_max_rpm_set_over_crew_rpm"
146 "test_agent_powered_by_new_o_model_family_that_allows_skipping_tool"
147 "test_agent_with_knowledge_with_no_crewai_knowledge"
148 "test_tool_usage_information_is_appended_to_agent"
149 "test_agent_without_max_rpm_respects_crew_rpm"
150 "test_agent_powered_by_new_o_model_family_that_uses_tool"
151 "test_agent_error_on_parsing_tool"
152 "test_agent_custom_max_iterations"
153 "test_agent_remembers_output_format_after_using_tools_too_many_times"
154 "test_llm_call_with_all_attributes"
155 "test_agent_execute_task_with_custom_llm"
156 "test_agent_with_ollama_llama3"
157 "test_custom_llm_with_langchain"
158 "test_custom_llm_temperature_preservation"
159 "test_agent_from_repository_override_attributes"
160 "test_agent_from_repository_with_invalid_tools"
161 "test_get_knowledge_search_query"
162 "test_agent_from_repository"
163
164 # Tests lite agent - require API keys
165 "test_guardrail_is_called_using_callable"
166 "test_lite_agent_created_with_correct_parameters"
167 "test_guardrail_reached_attempt_limit"
168 "test_agent_output_when_guardrail_returns_base_model"
169 "test_lite_agent_with_tools"
170 "test_lite_agent_structured_output"
171 "test_lite_agent_returns_usage_metrics"
172 "test_guardrail_is_called_using_string"
173
174 # Tests evaluation - require API keys
175 "test_evaluate_current_iteration"
176 "test_eval_lite_agent"
177 "test_eval_specific_agents_from_crew"
178 "test_failed_evaluation"
179
180 # Tests knowledge - missing optional dependencies (docling, embedchain, pandas)
181 "test_docling_source"
182 "test_multiple_docling_sources"
183 "test_excel_knowledge_source"
184
185 # Test telemetry
186 "test_telemetry_fails_due_connect_timeout"
187
188 # Tests crew
189 "test_task_tools_override_agent_tools"
190 "test_crew_output_file_end_to_end"
191 "test_conditional_task_last_task_when_conditional_is_true"
192 "test_crew_with_failing_task_guardrails"
193 "test_kickoff_for_each_single_input"
194 "test_hierarchical_verbose_manager_agent"
195 "test_crew_function_calling_llm"
196 "test_replay_interpolates_inputs_properly"
197 "test_manager_agent_delegating_to_all_agents"
198 "test_crew_does_not_interpolate_without_inputs"
199 "test_crew_creation"
200 "test_delegation_is_not_enabled_if_there_are_only_one_agent"
201 "test_tools_with_custom_caching"
202 "test_api_calls_throttling"
203 "test_multimodal_agent_describing_image_successfully"
204 "test_warning_long_term_memory_without_entity_memory"
205 "test_replay_with_context"
206 "test_crew_verbose_output"
207 "test_before_kickoff_callback"
208 "test_hierarchical_verbose_false_manager_agent"
209 "test_task_with_no_arguments"
210 "test_replay_setup_context"
211 "test_kickoff_for_each_multiple_inputs"
212 "test_conditional_task_last_task_when_conditional_is_false"
213 "test_crew_with_delegating_agents"
214 "test_agents_do_not_get_delegation_tools_with_there_is_only_one_agent"
215 "test_multimodal_agent_live_image_analysis"
216 "test_hierarchical_process"
217 "test_crew_kickoff_usage_metrics"
218 "test_disabled_memory_using_contextual_memory"
219 "test_ensure_exchanged_messages_are_propagated_to_external_memory"
220 "test_agent_usage_metrics_are_captured_for_hierarchical_process"
221 "test_crew_log_file_output"
222 "test_before_kickoff_without_inputs"
223 "test_cache_hitting_between_agents"
224 "test_crew_kickoff_streaming_usage_metrics"
225 "test_async_crews_thread_safety"
226 "test_valid_action_parsing_with_unbalanced_quotes"
227 "test_valid_action_parsing_with_angle_brackets"
228 "test_valid_action_parsing_with_mixed_quotes"
229 "test_valid_action_parsing_with_parentheses"
230 "test_parsing_with_whitespace"
231 "test_valid_action_parsing_special_characters"
232 "test_parsing_with_special_characters"
233 "test_valid_action_parsing_with_newlines"
234 "test_valid_action_parsing_with_nested_quotes"
235 "test_valid_action_parsing_with_quotes"
236 "test_valid_action_parsing_with_escaped_characters"
237 "test_create_crew"
238
239 # Tests LLM - require API keys
240 "test_llm_callback_replacement"
241 "test_gemini_models"
242 "test_llm_call_with_message_list"
243 "test_gpt_4_1"
244 "test_o3_mini_reasoning_effort_low"
245 "test_handle_streaming_tool_calls"
246 "test_llm_call_with_string_input"
247 "test_llm_call_with_tool_and_string_input"
248 "test_llm_call_with_string_input_and_callbacks"
249 "test_llm_call_when_stop_is_unsupported"
250 "test_handle_streaming_tool_calls_with_error"
251 "test_o3_mini_reasoning_effort_medium"
252 "test_llm_call_with_tool_and_message_list"
253 "test_gemma3"
254 "test_llm_call_when_stop_is_unsupported_when_additional_drop_params_is_provided"
255 "test_o3_mini_reasoning_effort_high"
256 "test_handle_streaming_tool_calls_no_available_functions"
257 "test_handle_streaming_tool_calls_no_tools"
258
259 # Test main - require git
260 "test_publish_when_not_in_sync"
261
262 # Tests project - require embedchain and API keys
263 "test_before_kickoff_modification"
264 "test_before_kickoff_with_none_input"
265 "test_multiple_before_after_kickoff"
266 "test_after_kickoff_modification"
267 "test_internal_crew_with_mcp"
268
269 # Tests task - require API keys
270 "test_output_json_hierarchical"
271 "test_output_pydantic_sequential"
272 "test_no_inject_date"
273 "test_increment_tool_errors"
274 "test_task_execution_times"
275 "test_custom_converter_cls"
276 "test_save_task_output"
277 "test_inject_date"
278 "test_output_pydantic_hierarchical"
279 "test_json_property_without_output_json"
280 "test_task_interpolation_with_hyphens"
281 "test_increment_delegations_for_hierarchical_process"
282 "test_save_task_json_output"
283 "test_output_pydantic_to_another_task"
284 "test_output_json_dict_sequential"
285 "test_inject_date_custom_format"
286 "test_output_json_sequential"
287 "test_output_json_to_another_task"
288 "test_increment_delegations_for_sequential_process"
289 "test_save_task_pydantic_output"
290 "test_output_json_dict_hierarchical"
291 "test_task_with_max_execution_time"
292 "test_task_with_max_execution_time_exceeded"
293
294 # Tests task guardrails
295 "test_task_guardrail_process_output"
296 "test_guardrail_when_an_error_occurs"
297 "test_guardrail_emits_events"
298
299 # Tests tools
300 "test_delegate_work"
301 "test_delegate_work_with_wrong_co_worker_variable"
302 "test_ask_question_with_wrong_co_worker_variable"
303 "test_ask_question"
304 "test_delegate_work_withwith_coworker_as_array"
305 "test_ask_question_with_coworker_as_array"
306 "test_max_usage_count_is_respected"
307 "test_async_tool_using_within_isolated_crew"
308 "test_async_tool_using_decorator_within_flow"
309 "test_async_tool_using_decorator_within_isolated_crew"
310 "test_async_tool_within_flow"
311 "test_ainvoke"
312
313 # Tests tracing
314 "test_trace_listener_disabled_when_env_false"
315 "test_trace_listener_with_authenticated_user"
316 "test_trace_listener_collects_crew_events"
317 "test_trace_listener_ephemeral_batch"
318 "test_events_collection_batch_manager"
319
320 # Tests utilities
321 "test_converter_with_llama3_2_model"
322 "test_converter_with_llama3_1_model"
323 "test_converter_with_nested_model"
324 "test_convert_with_instructions"
325 "test_crew_emits_start_kickoff_event"
326 "test_crew_emits_test_kickoff_type_event"
327 "test_crew_emits_start_task_event"
328 "test_llm_emits_call_started_event"
329 "test_register_handler_adds_new_handler"
330 "test_multiple_handlers_for_same_event"
331 "test_llm_emits_event_with_lite_agent"
332 "test_tools_emits_finished_events"
333 "test_agent_emits_execution_started_and_completed_events"
334 "test_crew_emits_end_kickoff_event"
335 "test_llm_emits_stream_chunk_events"
336 "test_tools_emits_error_events"
337 "test_crew_emits_end_task_event"
338 "test_stream_llm_emits_event_with_task_and_agent_info"
339 "test_llm_no_stream_chunks_when_streaming_disabled"
340 "test_llm_emits_event_with_task_and_agent_info"
341
342 # Tests qdrant
343 "test_acreate_collection"
344 "test_aget_or_create_collection_wrong_client_type"
345 "test_aadd_documents_empty_list"
346 "test_acreate_collection_already_exists"
347 "test_aget_or_create_collection_existing"
348 "test_aadd_documents_collection_not_exists"
349 "test_acreate_collection_wrong_client_type"
350 "test_aadd_documents"
351 "test_aadd_documents_wrong_client_type"
352 "test_asearch"
353 "test_adelete_collection_not_exists"
354 "test_asearch_with_filters"
355 "test_adelete_collection_wrong_client_type"
356 "test_asearch_collection_not_exists"
357 "test_areset"
358 "test_areset_no_collections"
359 "test_aget_or_create_collection_new"
360 "test_aadd_documents_with_doc_id"
361 "test_asearch_wrong_client_type"
362 "test_areset_wrong_client_type"
363 "test_adelete_collection"
364 ];
365
366 nativeCheckInputs = [
367 pytestCheckHook
368 pytest-xdist
369 qdrant-client
370 versionCheckHook
371 writableTmpDirAsHomeHook
372 ];
373
374 versionCheckProgramArg = "--version";
375
376 meta = {
377 description = "Framework for orchestrating role-playing, autonomous AI agents";
378 homepage = "https://github.com/crewAIInc/crewAI";
379 changelog = "https://github.com/crewAIInc/crewAI/releases/tag/${version}";
380 license = lib.licenses.mit;
381 maintainers = with lib.maintainers; [ liberodark ];
382 platforms = lib.platforms.linux;
383 mainProgram = "crewai";
384 };
385}