mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-07-05 23:19:22 +00:00
Add declarative Flow CLI support
Currently, declarative flows can be loaded by the runtime, but the CLI still treats them as an experimental definition file instead of a first-class Flow project shape. With this PR, `crewai create flow --declarative` scaffolds a YAML-backed Flow project, and `crewai run`, `crewai flow kickoff`, and `crewai flow plot` can run against the configured definition. This also lets crew actions reference reusable crew definition files or folders and override their inputs from the Flow definition, so declarative flows can compose existing declarative crews without inlining everything.
This commit is contained in:
31
lib/cli/tests/test_create_flow.py
Normal file
31
lib/cli/tests/test_create_flow.py
Normal file
@@ -0,0 +1,31 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
from crewai_cli.create_flow import create_flow
|
||||
|
||||
|
||||
def test_create_flow_declarative_scaffold(monkeypatch, tmp_path: Path):
|
||||
monkeypatch.chdir(tmp_path)
|
||||
|
||||
create_flow("Research Flow", declarative=True)
|
||||
|
||||
project_root = tmp_path / "research_flow"
|
||||
assert (project_root / "flow.yaml").is_file()
|
||||
assert (project_root / "crews").is_dir()
|
||||
assert (project_root / "tools").is_dir()
|
||||
assert (project_root / "knowledge").is_dir()
|
||||
assert (project_root / "skills").is_dir()
|
||||
assert not (project_root / "src").exists()
|
||||
|
||||
pyproject = (project_root / "pyproject.toml").read_text(encoding="utf-8")
|
||||
assert 'type = "flow"' in pyproject
|
||||
assert 'definition = "flow.yaml"' in pyproject
|
||||
assert (
|
||||
'only-include = ["flow.yaml", "crews", "tools", "knowledge", "skills"]'
|
||||
in pyproject
|
||||
)
|
||||
|
||||
flow_definition = (project_root / "flow.yaml").read_text(encoding="utf-8")
|
||||
assert "schema: crewai.flow/v1" in flow_definition
|
||||
assert "name: ResearchFlow" in flow_definition
|
||||
Reference in New Issue
Block a user