Skip to content

Framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.

Add python 3.10 support back to CLI +fixes

Thiago Moretto9a10cc15f4bd
diff --git a/src/crewai/cli/deploy/api.py b/src/crewai/cli/deploy/api.py
index 942fc487e..1037744af 100644
--- a/src/crewai/cli/deploy/api.py
+++ b/src/crewai/cli/deploy/api.py
@@ -2,6 +2,8 @@ from os import getenv
import requests
+from crewai.cli.deploy.utils import get_crewai_version
+
class CrewAPI:
"""
@@ -13,6 +15,7 @@ class CrewAPI:
self.headers = {
"Authorization": f"Bearer {api_key}",
"Content-Type": "application/json",
+ "User-Agent": f"CrewAI-CLI/{get_crewai_version()}",
}
self.base_url = getenv(
"CREWAI_BASE_URL", "https://dev.crewai.com/crewai_plus/api/v1/crews"
diff --git a/src/crewai/cli/deploy/main.py b/src/crewai/cli/deploy/main.py
index d67e1cdc8..9cb6f6c8c 100644
--- a/src/crewai/cli/deploy/main.py
+++ b/src/crewai/cli/deploy/main.py
@@ -113,6 +113,11 @@ class DeployCommand:
env_vars = fetch_and_json_env_file()
remote_repo_url = get_git_remote_url()
+ if remote_repo_url is None:
+ console.print("No remote repository URL found.", style="bold red")
+ console.print("Please ensure your project has a valid remote repository.", style="yellow")
+ return
+
self._confirm_input(env_vars, remote_repo_url)
payload = self._create_payload(env_vars, remote_repo_url)
diff --git a/src/crewai/cli/deploy/utils.py b/src/crewai/cli/deploy/utils.py
index a7534fc48..e55309cfa 100644
--- a/src/crewai/cli/deploy/utils.py
+++ b/src/crewai/cli/deploy/utils.py
@@ -1,10 +1,13 @@
import sys
import re
import subprocess
-import ast
+
+from rich.console import Console
from ..authentication.utils import TokenManager
+console = Console()
+
if sys.version_info >= (3, 11):
import tomllib
@@ -53,13 +56,12 @@ def get_git_remote_url() -> str:
if matches:
return matches[0] # Return the first match (origin URL)
else:
- print("No origin remote found.")
- return "No remote URL found"
+ console.print("No origin remote found.", style="bold red")
except subprocess.CalledProcessError as e:
- return f"Error running trying to fetch the Git Repository: {e}"
+ console.print(f"Error running trying to fetch the Git Repository: {e}", style="bold red")
except FileNotFoundError:
- return "Git command not found. Make sure Git is installed and in your PATH."
+ console.print("Git command not found. Make sure Git is installed and in your PATH.", style="bold red")
def get_project_name(pyproject_path: str = "pyproject.toml"):