From 297dc93fb48f716dcc77050221bebb123fbd881b Mon Sep 17 00:00:00 2001 From: Eduardo Chiarotti Date: Thu, 8 Aug 2024 10:48:22 -0300 Subject: [PATCH 1/3] feat: add cli to run the crew (#1080) * feat: add cli to run the crew * feat: change command to run_crew * feat: change pyprojet to run_Crew * docs: change docs to address crewai run --- ...rt-a-New-CrewAI-Project-Template-Method.md | 4 ++++ src/crewai/cli/cli.py | 8 +++++++ src/crewai/cli/run_crew.py | 23 +++++++++++++++++++ src/crewai/cli/templates/README.md | 4 ++++ src/crewai/cli/templates/pyproject.toml | 1 + 5 files changed, 40 insertions(+) create mode 100644 src/crewai/cli/run_crew.py diff --git a/docs/getting-started/Start-a-New-CrewAI-Project-Template-Method.md b/docs/getting-started/Start-a-New-CrewAI-Project-Template-Method.md index bc3b03a7e..70877cb18 100644 --- a/docs/getting-started/Start-a-New-CrewAI-Project-Template-Method.md +++ b/docs/getting-started/Start-a-New-CrewAI-Project-Template-Method.md @@ -244,6 +244,10 @@ def run(): To run your project, use the following command: +```shell +$ crewai run +``` +or ```shell $ poetry run my_project ``` diff --git a/src/crewai/cli/cli.py b/src/crewai/cli/cli.py index 52d2bc75c..5ae9feb03 100644 --- a/src/crewai/cli/cli.py +++ b/src/crewai/cli/cli.py @@ -9,6 +9,7 @@ from .create_crew import create_crew from .evaluate_crew import evaluate_crew from .replay_from_task import replay_task_command from .reset_memories_command import reset_memories_command +from .run_crew import run_crew from .train_crew import train_crew @@ -147,5 +148,12 @@ def test(n_iterations: int, model: str): evaluate_crew(n_iterations, model) +@crewai.command() +def run(): + """Run the crew.""" + click.echo("Running the crew") + run_crew() + + if __name__ == "__main__": crewai() diff --git a/src/crewai/cli/run_crew.py b/src/crewai/cli/run_crew.py new file mode 100644 index 000000000..4c3f69a2d --- /dev/null +++ b/src/crewai/cli/run_crew.py @@ -0,0 +1,23 @@ +import subprocess + +import click + + +def run_crew() -> None: + """ + Run the crew by running a command in the Poetry environment. + """ + command = ["poetry", "run", "run_crew"] + + try: + result = subprocess.run(command, capture_output=False, text=True, check=True) + + if result.stderr: + click.echo(result.stderr, err=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) diff --git a/src/crewai/cli/templates/README.md b/src/crewai/cli/templates/README.md index 60dc617e9..0914be209 100644 --- a/src/crewai/cli/templates/README.md +++ b/src/crewai/cli/templates/README.md @@ -34,6 +34,10 @@ poetry install To kickstart your crew of AI agents and begin task execution, run this from the root folder of your project: +```bash +$ crewai run +``` +or ```bash poetry run {{folder_name}} ``` diff --git a/src/crewai/cli/templates/pyproject.toml b/src/crewai/cli/templates/pyproject.toml index 048782d1c..b74b8fd03 100644 --- a/src/crewai/cli/templates/pyproject.toml +++ b/src/crewai/cli/templates/pyproject.toml @@ -10,6 +10,7 @@ crewai = { extras = ["tools"], version = "^0.46.0" } [tool.poetry.scripts] {{folder_name}} = "{{folder_name}}.main:run" +run_crew = "{{folder_name}}.main:run" train = "{{folder_name}}.main:train" replay = "{{folder_name}}.main:replay" test = "{{folder_name}}.main:test" From 217f5fc5ac9730e241de1858882fefdc0bdca7ea Mon Sep 17 00:00:00 2001 From: Eduardo Chiarotti Date: Thu, 8 Aug 2024 11:54:13 -0300 Subject: [PATCH 2/3] Create stale.yml (#1158) --- .github/workflows/stale.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/stale.yml diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..624bf34f4 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,26 @@ +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '10 12 * * *' + workflow_dispatch: + +jobs: + stale: + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + steps: + - uses: actions/stale@v9 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-label: 'no-issue-activity' + stale-issue-message: 'This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.' + close-issue-message: 'This issue was closed because it has been stalled for 5 days with no activity.' + days-before-issue-stale: 30 + days-before-issue-close: 5 + stale-pr-label: 'no-pr-activity' + stale-pr-message: 'This PR is stale because it has been open for 45 days with no activity.' + days-before-pr-stale: 45 + days-before-pr-close: -1 From 6583f314592148a31c1bec23205a8256ce062ab6 Mon Sep 17 00:00:00 2001 From: Eduardo Chiarotti Date: Thu, 8 Aug 2024 20:10:41 -0300 Subject: [PATCH 3/3] Update issue templates (#1076) * Update issue templates * Update custom.md --- .github/ISSUE_TEMPLATE/custom.md | 24 +++++++++++++++++++++++ .github/ISSUE_TEMPLATE/feature_request.md | 21 -------------------- 2 files changed, 24 insertions(+), 21 deletions(-) create mode 100644 .github/ISSUE_TEMPLATE/custom.md delete mode 100644 .github/ISSUE_TEMPLATE/feature_request.md diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md new file mode 100644 index 000000000..90b829277 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/custom.md @@ -0,0 +1,24 @@ +--- +name: Custom issue template +about: Describe this issue template's purpose here. +title: "[DOCS]" +labels: documentation +assignees: '' + +--- + +## Documentation Page + + +## Description + + +## Suggested Changes + + +## Additional Context + + +## Checklist +- [ ] I have searched the existing issues to make sure this is not a duplicate +- [ ] I have checked the latest version of the documentation to ensure this hasn't been addressed diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md deleted file mode 100644 index c578e8daa..000000000 --- a/.github/ISSUE_TEMPLATE/feature_request.md +++ /dev/null @@ -1,21 +0,0 @@ ---- -name: Feature request -about: Suggest a Feature to improve CrewAI -title: "[FEAT]" -labels: feature-request, improvement -assignees: '' - ---- - -**Is your feature request related to a problem? Please describe.** -A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -If possible attach the Issue related to it - -**Describe the solution you'd like / Use-case** -A clear and concise description of what you want to happen. - -**Describe alternatives you've considered** -A clear and concise description of any alternative solutions or features you've considered. - -**Additional context** -Add any other context or screenshots about the feature request here.