Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
Improve crewai run startup UX (#6297)
Vinicius Brasil2eb4e3a236ba
diff --git a/lib/cli/src/crewai_cli/cli.py b/lib/cli/src/crewai_cli/cli.pyindex b2050bc34..30eccdc61 100644--- a/lib/cli/src/crewai_cli/cli.py+++ b/lib/cli/src/crewai_cli/cli.py@@ -787,9 +787,13 @@ def flow() -> None:"""Flow related commands."""[email protected](name="kickoff", deprecated=True)[email protected](name="kickoff")def flow_run() -> None:"""Kickoff the Flow."""+ click.secho(+ "The command 'crewai flow kickoff' is deprecated. Use 'crewai run' instead.",+ fg="yellow",+ )run_crew(trained_agents_file=None, definition=None, inputs=None)diff --git a/lib/cli/src/crewai_cli/run_crew.py b/lib/cli/src/crewai_cli/run_crew.pyindex 0fa61dc7a..f9948a297 100644--- a/lib/cli/src/crewai_cli/run_crew.py+++ b/lib/cli/src/crewai_cli/run_crew.py@@ -595,7 +595,6 @@ def _run_flow_project(if trained_agents_file is not None:raise click.UsageError("--filename can only be used when running crews")- click.echo("Running the Flow")from crewai_cli.run_declarative_flow import (configured_project_declarative_flow,run_declarative_flow_in_project_env,@@ -611,7 +610,6 @@ def _run_flow_project(def _run_classic_crew_project(pyproject_data: dict[str, Any], trained_agents_file: str | None) -> None:- click.echo("Running the Crew")_execute_uv_script("run_crew",entity_type="crew",diff --git a/lib/cli/tests/test_cli.py b/lib/cli/tests/test_cli.pyindex 28f849ce2..acdeee7ff 100644--- a/lib/cli/tests/test_cli.py+++ b/lib/cli/tests/test_cli.py@@ -190,7 +190,10 @@ def test_flow_kickoff_is_deprecated_and_uses_run_path(run_crew, runner):definition=None,inputs=None,)- assert "DeprecationWarning" in result.output+ assert (+ "The command 'crewai flow kickoff' is deprecated. Use 'crewai run' instead."+ in result.output+ )@mock.patch("crewai_cli.create_json_crew.create_json_crew")diff --git a/lib/cli/tests/test_create_flow.py b/lib/cli/tests/test_create_flow.pyindex 256ace28c..21487a7a1 100644--- a/lib/cli/tests/test_create_flow.py+++ b/lib/cli/tests/test_create_flow.py@@ -31,5 +31,5 @@ def test_create_flow_declarative_project_can_run(result = CliRunner().invoke(crewai, ["run"], env={"UV_RUN_RECURSION_DEPTH": "1"})assert result.exit_code == 0- assert "Running the Flow" in result.output+ assert "Running the Flow" not in result.outputassert "AI agents" in result.outputdiff --git a/lib/cli/tests/test_flow_commands.py b/lib/cli/tests/test_flow_commands.pyindex 3158fc9e0..00e39b6db 100644--- a/lib/cli/tests/test_flow_commands.py+++ b/lib/cli/tests/test_flow_commands.py@@ -44,8 +44,12 @@ def test_flow_kickoff_runs_configured_declarative_definition(result = CliRunner().invoke(flow_run)assert result.exit_code == 0- assert "DeprecationWarning" in result.output- assert "Running the Flow\nAI\n" in result.output+ assert (+ "The command 'crewai flow kickoff' is deprecated. Use 'crewai run' instead."+ in result.output+ )+ assert "AI\n" in result.output+ assert "Running the Flow" not in result.outputdef test_plot_flow_runs_configured_declarative_definition(diff --git a/lib/cli/tests/test_run_crew.py b/lib/cli/tests/test_run_crew.pyindex 40255abed..c51fc16c5 100644--- a/lib/cli/tests/test_run_crew.py+++ b/lib/cli/tests/test_run_crew.py@@ -622,7 +622,7 @@ def test_run_crew_runs_classic_crew_project(monkeypatch, capsys):run_crew_module.run_crew(trained_agents_file="trained.pkl")- assert capsys.readouterr().out == "Running the Crew\n"+ assert capsys.readouterr().out == ""assert calls == [("run_crew",@@ -648,7 +648,7 @@ def test_run_crew_runs_python_flow_project(monkeypatch, capsys):run_crew_module.run_crew()- assert capsys.readouterr().out == "Running the Flow\n"+ assert capsys.readouterr().out == ""assert calls == [("kickoff", {"entity_type": "flow"})]@@ -694,5 +694,5 @@ def test_run_crew_runs_configured_declarative_flow_project(monkeypatch, capsys):run_crew_module.run_crew()- assert capsys.readouterr().out == "Running the Flow\n"+ assert capsys.readouterr().out == ""assert calls == [("flow.yaml", None)]diff --git a/lib/crewai/src/crewai/flow/runtime/__init__.py b/lib/crewai/src/crewai/flow/runtime/__init__.pyindex fa465cb71..c47526a78 100644--- a/lib/crewai/src/crewai/flow/runtime/__init__.py+++ b/lib/crewai/src/crewai/flow/runtime/__init__.py@@ -2455,11 +2455,6 @@ class Flow(BaseModel, Generic[T], metaclass=FlowMeta):object.__setattr__(self, "_deferred_flow_started_event_id", started_event.event_id)- if not self.suppress_flow_events:- self._log_flow_event(- f"Flow started with ID: {self.flow_id}", color="bold magenta"- )-# After FlowStarted: env events must not pre-empt trace batch init# with implicit "crew" execution_type.get_env_context()