mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-10 00:28:31 +00:00
feat: Add crewai install CLI command
This commit is contained in:
@@ -8,6 +8,7 @@ from crewai.memory.storage.kickoff_task_outputs_storage import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
from .evaluate_crew import evaluate_crew
|
from .evaluate_crew import evaluate_crew
|
||||||
|
from .install_crew import install_crew
|
||||||
from .replay_from_task import replay_task_command
|
from .replay_from_task import replay_task_command
|
||||||
from .reset_memories_command import reset_memories_command
|
from .reset_memories_command import reset_memories_command
|
||||||
from .run_crew import run_crew
|
from .run_crew import run_crew
|
||||||
@@ -165,10 +166,16 @@ def test(n_iterations: int, model: str):
|
|||||||
evaluate_crew(n_iterations, model)
|
evaluate_crew(n_iterations, model)
|
||||||
|
|
||||||
|
|
||||||
|
@crewai.command()
|
||||||
|
def install():
|
||||||
|
"""Install the Crew."""
|
||||||
|
install_crew()
|
||||||
|
|
||||||
|
|
||||||
@crewai.command()
|
@crewai.command()
|
||||||
def run():
|
def run():
|
||||||
"""Run the crew."""
|
"""Run the Crew."""
|
||||||
click.echo("Running the crew")
|
click.echo("Running the Crew")
|
||||||
run_crew()
|
run_crew()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
21
src/crewai/cli/install_crew.py
Normal file
21
src/crewai/cli/install_crew.py
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
import subprocess
|
||||||
|
|
||||||
|
import click
|
||||||
|
|
||||||
|
|
||||||
|
def install_crew() -> None:
|
||||||
|
"""
|
||||||
|
Install the crew by running the Poetry command to lock and install.
|
||||||
|
"""
|
||||||
|
try:
|
||||||
|
subprocess.run(["poetry", "lock"], check=True, capture_output=False, text=True)
|
||||||
|
subprocess.run(
|
||||||
|
["poetry", "install"], check=True, capture_output=False, text=True
|
||||||
|
)
|
||||||
|
|
||||||
|
except subprocess.CalledProcessError as e:
|
||||||
|
click.echo(f"An error occurred while running the crew: {e}", err=True)
|
||||||
|
click.echo(e.output, err=True)
|
||||||
|
|
||||||
|
except Exception as e:
|
||||||
|
click.echo(f"An unexpected error occurred: {e}", err=True)
|
||||||
Reference in New Issue
Block a user