mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-04 06:29:22 +00:00
Implement DMN mode support in crew creation and execution (#6194)
* Implement DMN mode support in crew creation and execution - Added `is_dmn_mode_enabled` utility to check for enterprise non-interactive mode based on the `CREWAI_DMN` environment variable. - Updated `create` function in `cli.py` to enforce required parameters when DMN mode is active, raising appropriate usage errors. - Enhanced `create_crew` and `create_json_crew` functions to skip provider prompts and handle folder existence checks in DMN mode. - Introduced non-interactive defaults for agent and task creation in DMN mode, ensuring seamless project setup without user input. - Modified `run_crew` to bypass TUI and handle runtime inputs directly when in DMN mode, improving execution flow for JSON-defined crews. - Added tests to validate DMN mode behavior, ensuring correct handling of required inputs and non-interactive defaults. * Implement DMN mode support in crew creation and execution - Introduced `is_dmn_mode_enabled()` utility to check for non-interactive mode based on the `CREWAI_DMN` environment variable. - Updated `create` function to enforce required parameters when DMN mode is active, raising appropriate usage errors. - Modified `create_crew` and `create_json_crew` functions to skip provider prompts and utilize non-interactive defaults in DMN mode. - Enhanced `run_crew` to bypass TUI and handle runtime inputs directly in DMN mode, ensuring smooth execution without user interaction. - Added tests to validate DMN mode behavior, including requirements for type and name, and ensuring proper handling of existing folders and missing inputs.
This commit is contained in:
@@ -102,6 +102,23 @@ def test_tree_copy_to_existing_directory(temp_tree):
|
||||
shutil.rmtree(dest_dir)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", ["1", "true", "True", "yes", "anything"])
|
||||
def test_is_dmn_mode_enabled_for_truthy_values(monkeypatch, value):
|
||||
monkeypatch.setenv("CREWAI_DMN", value)
|
||||
|
||||
assert utils.is_dmn_mode_enabled() is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("value", [None, "", "0", "false", "no", "off"])
|
||||
def test_is_dmn_mode_enabled_for_falsey_values(monkeypatch, value):
|
||||
if value is None:
|
||||
monkeypatch.delenv("CREWAI_DMN", raising=False)
|
||||
else:
|
||||
monkeypatch.setenv("CREWAI_DMN", value)
|
||||
|
||||
assert utils.is_dmn_mode_enabled() is False
|
||||
|
||||
|
||||
# Tests for extract_available_exports, get_crews, get_flows, fetch_crews,
|
||||
# is_valid_tool live in lib/crewai/tests/cli/test_utils.py — the canonical
|
||||
# implementations are in crewai.utilities.project_utils.
|
||||
|
||||
Reference in New Issue
Block a user