mirror of
https://github.com/crewAIInc/crewAI.git
synced 2025-12-18 13:28:31 +00:00
Compare commits
7 Commits
feat/cli-i
...
feat/updat
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5136df8cc6 | ||
|
|
5495825b1d | ||
|
|
6e36f84cc6 | ||
|
|
cddf2d8f7c | ||
|
|
5f17e35c5a | ||
|
|
231a833ad0 | ||
|
|
a870295d42 |
6
.github/workflows/mkdocs.yml
vendored
6
.github/workflows/mkdocs.yml
vendored
@@ -1,10 +1,8 @@
|
|||||||
name: Deploy MkDocs
|
name: Deploy MkDocs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
release:
|
||||||
push:
|
types: [published]
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|||||||
1
.github/workflows/stale.yml
vendored
1
.github/workflows/stale.yml
vendored
@@ -24,3 +24,4 @@ jobs:
|
|||||||
stale-pr-message: 'This PR is stale because it has been open for 45 days with no 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-stale: 45
|
||||||
days-before-pr-close: -1
|
days-before-pr-close: -1
|
||||||
|
operations-per-run: 500
|
||||||
|
|||||||
142
docs/core-concepts/Cli.md
Normal file
142
docs/core-concepts/Cli.md
Normal file
@@ -0,0 +1,142 @@
|
|||||||
|
# CrewAI CLI Documentation
|
||||||
|
|
||||||
|
The CrewAI CLI provides a set of commands to interact with CrewAI, allowing you to create, train, run, and manage crews and pipelines.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
To use the CrewAI CLI, make sure you have CrewAI & Poetry installed:
|
||||||
|
|
||||||
|
```
|
||||||
|
pip install crewai poetry
|
||||||
|
```
|
||||||
|
|
||||||
|
## Basic Usage
|
||||||
|
|
||||||
|
The basic structure of a CrewAI CLI command is:
|
||||||
|
|
||||||
|
```
|
||||||
|
crewai [COMMAND] [OPTIONS] [ARGUMENTS]
|
||||||
|
```
|
||||||
|
|
||||||
|
## Available Commands
|
||||||
|
|
||||||
|
### 1. create
|
||||||
|
|
||||||
|
Create a new crew or pipeline.
|
||||||
|
|
||||||
|
```
|
||||||
|
crewai create [OPTIONS] TYPE NAME
|
||||||
|
```
|
||||||
|
|
||||||
|
- `TYPE`: Choose between "crew" or "pipeline"
|
||||||
|
- `NAME`: Name of the crew or pipeline
|
||||||
|
- `--router`: (Optional) Create a pipeline with router functionality
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
crewai create crew my_new_crew
|
||||||
|
crewai create pipeline my_new_pipeline --router
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. version
|
||||||
|
|
||||||
|
Show the installed version of CrewAI.
|
||||||
|
|
||||||
|
```
|
||||||
|
crewai version [OPTIONS]
|
||||||
|
```
|
||||||
|
|
||||||
|
- `--tools`: (Optional) Show the installed version of CrewAI tools
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
crewai version
|
||||||
|
crewai version --tools
|
||||||
|
```
|
||||||
|
|
||||||
|
### 3. train
|
||||||
|
|
||||||
|
Train the crew for a specified number of iterations.
|
||||||
|
|
||||||
|
```
|
||||||
|
crewai train [OPTIONS]
|
||||||
|
```
|
||||||
|
|
||||||
|
- `-n, --n_iterations INTEGER`: Number of iterations to train the crew (default: 5)
|
||||||
|
- `-f, --filename TEXT`: Path to a custom file for training (default: "trained_agents_data.pkl")
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
crewai train -n 10 -f my_training_data.pkl
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. replay
|
||||||
|
|
||||||
|
Replay the crew execution from a specific task.
|
||||||
|
|
||||||
|
```
|
||||||
|
crewai replay [OPTIONS]
|
||||||
|
```
|
||||||
|
|
||||||
|
- `-t, --task_id TEXT`: Replay the crew from this task ID, including all subsequent tasks
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
crewai replay -t task_123456
|
||||||
|
```
|
||||||
|
|
||||||
|
### 5. log_tasks_outputs
|
||||||
|
|
||||||
|
Retrieve your latest crew.kickoff() task outputs.
|
||||||
|
|
||||||
|
```
|
||||||
|
crewai log_tasks_outputs
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. reset_memories
|
||||||
|
|
||||||
|
Reset the crew memories (long, short, entity, latest_crew_kickoff_outputs).
|
||||||
|
|
||||||
|
```
|
||||||
|
crewai reset_memories [OPTIONS]
|
||||||
|
```
|
||||||
|
|
||||||
|
- `-l, --long`: Reset LONG TERM memory
|
||||||
|
- `-s, --short`: Reset SHORT TERM memory
|
||||||
|
- `-e, --entities`: Reset ENTITIES memory
|
||||||
|
- `-k, --kickoff-outputs`: Reset LATEST KICKOFF TASK OUTPUTS
|
||||||
|
- `-a, --all`: Reset ALL memories
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
crewai reset_memories --long --short
|
||||||
|
crewai reset_memories --all
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7. test
|
||||||
|
|
||||||
|
Test the crew and evaluate the results.
|
||||||
|
|
||||||
|
```
|
||||||
|
crewai test [OPTIONS]
|
||||||
|
```
|
||||||
|
|
||||||
|
- `-n, --n_iterations INTEGER`: Number of iterations to test the crew (default: 3)
|
||||||
|
- `-m, --model TEXT`: LLM Model to run the tests on the Crew (default: "gpt-4o-mini")
|
||||||
|
|
||||||
|
Example:
|
||||||
|
```
|
||||||
|
crewai test -n 5 -m gpt-3.5-turbo
|
||||||
|
```
|
||||||
|
|
||||||
|
### 8. run
|
||||||
|
|
||||||
|
Run the crew.
|
||||||
|
|
||||||
|
```
|
||||||
|
crewai run
|
||||||
|
```
|
||||||
|
|
||||||
|
## Note
|
||||||
|
|
||||||
|
Make sure to run these commands from the directory where your CrewAI project is set up. Some commands may require additional configuration or setup within your project structure.
|
||||||
@@ -109,8 +109,7 @@ To install the dependencies for your project, use Poetry:
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ cd <project_name>
|
$ cd <project_name>
|
||||||
$ poetry lock
|
$ crewai install
|
||||||
$ poetry install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Running Your Pipeline Project
|
## Running Your Pipeline Project
|
||||||
@@ -121,12 +120,6 @@ To run your pipeline project, use the following command:
|
|||||||
$ crewai run
|
$ crewai run
|
||||||
```
|
```
|
||||||
|
|
||||||
or
|
|
||||||
|
|
||||||
```shell
|
|
||||||
$ poetry run <project_name>
|
|
||||||
```
|
|
||||||
|
|
||||||
This will initialize your pipeline and begin task execution as defined in your `main.py` file.
|
This will initialize your pipeline and begin task execution as defined in your `main.py` file.
|
||||||
|
|
||||||
## Deploying Your Pipeline Project
|
## Deploying Your Pipeline Project
|
||||||
|
|||||||
@@ -191,8 +191,7 @@ To install the dependencies for your project, you can use Poetry. First, navigat
|
|||||||
|
|
||||||
```shell
|
```shell
|
||||||
$ cd my_project
|
$ cd my_project
|
||||||
$ poetry lock
|
$ crewai install
|
||||||
$ poetry install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
This will install the dependencies specified in the `pyproject.toml` file.
|
This will install the dependencies specified in the `pyproject.toml` file.
|
||||||
@@ -233,11 +232,6 @@ To run your project, use the following command:
|
|||||||
```shell
|
```shell
|
||||||
$ crewai run
|
$ crewai run
|
||||||
```
|
```
|
||||||
or
|
|
||||||
```shell
|
|
||||||
$ poetry run my_project
|
|
||||||
```
|
|
||||||
|
|
||||||
This will initialize your crew of AI agents and begin task execution as defined in your configuration in the `main.py` file.
|
This will initialize your crew of AI agents and begin task execution as defined in your configuration in the `main.py` file.
|
||||||
|
|
||||||
### Replay Tasks from Latest Crew Kickoff
|
### Replay Tasks from Latest Crew Kickoff
|
||||||
|
|||||||
@@ -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)
|
||||||
@@ -14,12 +14,9 @@ pip install poetry
|
|||||||
|
|
||||||
Next, navigate to your project directory and install the dependencies:
|
Next, navigate to your project directory and install the dependencies:
|
||||||
|
|
||||||
1. First lock the dependencies and then install them:
|
1. First lock the dependencies and install them by using the CLI command:
|
||||||
```bash
|
```bash
|
||||||
poetry lock
|
crewai install
|
||||||
```
|
|
||||||
```bash
|
|
||||||
poetry install
|
|
||||||
```
|
```
|
||||||
### Customizing
|
### Customizing
|
||||||
|
|
||||||
@@ -37,10 +34,6 @@ To kickstart your crew of AI agents and begin task execution, run this from the
|
|||||||
```bash
|
```bash
|
||||||
$ crewai run
|
$ crewai run
|
||||||
```
|
```
|
||||||
or
|
|
||||||
```bash
|
|
||||||
poetry run {{folder_name}}
|
|
||||||
```
|
|
||||||
|
|
||||||
This command initializes the {{name}} Crew, assembling the agents and assigning them tasks as defined in your configuration.
|
This command initializes the {{name}} Crew, assembling the agents and assigning them tasks as defined in your configuration.
|
||||||
|
|
||||||
|
|||||||
@@ -17,11 +17,7 @@ Next, navigate to your project directory and install the dependencies:
|
|||||||
1. First lock the dependencies and then install them:
|
1. First lock the dependencies and then install them:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry lock
|
crewai install
|
||||||
```
|
|
||||||
|
|
||||||
```bash
|
|
||||||
poetry install
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Customizing
|
### Customizing
|
||||||
@@ -38,7 +34,7 @@ poetry install
|
|||||||
To kickstart your crew of AI agents and begin task execution, run this from the root folder of your project:
|
To kickstart your crew of AI agents and begin task execution, run this from the root folder of your project:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry run {{folder_name}}
|
crewai run
|
||||||
```
|
```
|
||||||
|
|
||||||
This command initializes the {{name}} Crew, assembling the agents and assigning them tasks as defined in your configuration.
|
This command initializes the {{name}} Crew, assembling the agents and assigning them tasks as defined in your configuration.
|
||||||
|
|||||||
@@ -16,10 +16,7 @@ Next, navigate to your project directory and install the dependencies:
|
|||||||
|
|
||||||
1. First lock the dependencies and then install them:
|
1. First lock the dependencies and then install them:
|
||||||
```bash
|
```bash
|
||||||
poetry lock
|
crewai install
|
||||||
```
|
|
||||||
```bash
|
|
||||||
poetry install
|
|
||||||
```
|
```
|
||||||
### Customizing
|
### Customizing
|
||||||
|
|
||||||
@@ -35,7 +32,7 @@ poetry install
|
|||||||
To kickstart your crew of AI agents and begin task execution, run this from the root folder of your project:
|
To kickstart your crew of AI agents and begin task execution, run this from the root folder of your project:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
poetry run {{folder_name}}
|
crewai run
|
||||||
```
|
```
|
||||||
|
|
||||||
This command initializes the {{name}} Crew, assembling the agents and assigning them tasks as defined in your configuration.
|
This command initializes the {{name}} Crew, assembling the agents and assigning them tasks as defined in your configuration.
|
||||||
|
|||||||
Reference in New Issue
Block a user