diff --git a/lib/cli/src/crewai_cli/cli.py b/lib/cli/src/crewai_cli/cli.py index 0870dc5be..a38c4f0d4 100644 --- a/lib/cli/src/crewai_cli/cli.py +++ b/lib/cli/src/crewai_cli/cli.py @@ -864,6 +864,9 @@ def _test_new_agents( all_passed = True agents_tested: set[str] = set() + _loop = asyncio.new_event_loop() + asyncio.set_event_loop(_loop) + for iteration in range(n_iterations): if n_iterations > 1: click.secho(f"\n Iteration {iteration + 1}/{n_iterations}", fg="cyan") @@ -876,10 +879,10 @@ def _test_new_agents( with ArtifactsSandbox(): if verbose: with VerboseBenchmarkOutput(): - all_results = asyncio.run(_run_all()) + all_results = _loop.run_until_complete(_run_all()) else: with SuppressBenchmarkOutput(): - all_results = asyncio.run(_run_all()) + all_results = _loop.run_until_complete(_run_all()) finally: if not verbose: if progress is None: @@ -914,6 +917,8 @@ def _test_new_agents( f" [green bold]{job['agent_name']}: PASSED all {len(results)} cases >= {job['threshold']}[/green bold]" ) + _loop.close() + if len(agents_tested) == 0: click.secho("No agents completed successfully.", fg="yellow") raise SystemExit(1) diff --git a/lib/cli/src/crewai_cli/constants.py b/lib/cli/src/crewai_cli/constants.py index e80ab6abd..43cbf6a39 100644 --- a/lib/cli/src/crewai_cli/constants.py +++ b/lib/cli/src/crewai_cli/constants.py @@ -55,7 +55,7 @@ ENV_VARS: dict[str, list[dict[str, Any]]] = { "ollama": [ { "default": True, - "key_name": "OPENAI_API_BASE", + "key_name": "OLLAMA_HOST", "API_BASE": "http://localhost:11434", } ], diff --git a/lib/cli/src/crewai_cli/utils.py b/lib/cli/src/crewai_cli/utils.py index 063c6d14e..ff291ab2b 100644 --- a/lib/cli/src/crewai_cli/utils.py +++ b/lib/cli/src/crewai_cli/utils.py @@ -125,6 +125,12 @@ def load_env_vars(folder_path: Path) -> dict[str, Any]: for line in file: key, _, value = line.strip().partition("=") if key and value: + if ( + len(value) >= 2 + and value[0] == value[-1] + and value[0] in ('"', "'") + ): + value = value[1:-1] env_vars[key] = value return env_vars @@ -134,4 +140,4 @@ def write_env_file(folder_path: Path, env_vars: dict[str, Any]) -> None: env_file_path = folder_path / ".env" with open(env_file_path, "w") as file: for key, value in env_vars.items(): - file.write(f"{key.upper()}={value}\n") + file.write(f"{key}={value}\n")