Open In App

CrewAI CLI

Last Updated : 15 Sep, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

A Command-Line Interface (CLI) is a way to interact with software by typing commands into a terminal or shell. Unlike graphical interfaces the CLI allows us to directly input instructions and receive text-based responses. It is often used for tasks such as configuring projects, running scripts and managing workflows efficiently. In the context of CrewAI, CLI allows us to create, run, test and deploy AI crews and flows directly from the terminal.

Using CrewAI CLI we can:

  • Create and organize crews or flows
  • Train AI agents
  • Execute and monitor tasks
  • Deploy projects to CrewAI Enterprisen.

Installation

To begin, we must install CrewAI. This ensures the CLI and all related libraries are available in our environment.

pip install crewai

Basic Command Structure

Every CrewAI CLI command has the following structure. Understanding this pattern helps in constructing commands accurately.

crewai [COMMAND] [OPTIONS] [ARGUMENTS]

  • COMMAND: The action we want to perform (e.g., create, train)
  • OPTIONS: Modifiers that customize the command behavior
  • ARGUMENTS: Additional inputs such as names or IDs

Note: When running these commands in Google Colab or Jupyter Notebook, we must prefix them with ! to execute them in a shell environment. For example: "!crewai version".

CrewAI Basic Commands

These commands focus on managing crews and flows locally.

1. Create

We can create a new crew or flow.

Options:

  • TYPE: "crew" or "flow"
  • NAME: Name of the crew or flow

Example:

crewai create crew my_new_crew
crewai create flow my_new_flow

Output:

my_crew
Create

This sets up the project structure and initial configuration files.

2. Version

We can check the installed version of CrewAI.

  • --tools (optional): Show installed CrewAI tools

Example:

crewai version
crewai version --tools

Output:

crewai_version
Version

3. Train

Training a crew updates the internal state of AI agents for better task execution.

Options :

  • -n, --n_iterations INTEGER: Number of training iterations (default: 5)
  • -f, --filename TEXT: Custom training data file

Example:

%cd my_new_crew #Changes current directory to the crew's directory
!crewai train -n 3 -f my_training_data.pkl

Output:

4. Replay

Replaying a crew allows us to run previous tasks again from a specific point.

  • -t, --task_id TEXT: Task ID to start the replay from

Example:

crewai replay -t <task_id>

Output:

replay
Replay

5. Log Task Outputs

Retrieve outputs from the latest crew.kickoff() execution:

crewai log-tasks-outputs

Output:

logfiles
Log Task Outputs

6. Reset Memories

Reset different types of memory for a crew.

Options :

  • -l, --long: Long-term memory
  • -s, --short: Short-term memory
  • -e, --entities: Entities memory
  • -k, --kickoff-outputs: Latest task outputs
  • -a, --all: Reset all memory

Example:

crewai reset-memories --all

Output:

reset_memory
Reset Memorie

7. Test

Testing allows us to check how a crew performs.

Options :

  • -n, --n_iterations INTEGER: Number of test iterations (default: 3)
  • -m, --model TEXT: LLM model to run tests (default: "gpt-4o-mini")

Example:

crewai test -n 3 -m gpt-3.5-turbo

Output:

8. Run

We can run a crew or flow:

crewai run

Output:

running_crew
Run

Note: From version 0.103.0, the CLI automatically detects the type and executes it. Running from the project root ensures proper configuration.

CrewAI Enterprise Commands

Enterprise commands handle deployment, authentication and organization management. CrewAI Enterprise is a paid feature.

1. Login

Authenticate using a device code flow:

crewai login

Steps:

  1. CLI displays a verification URL and code
  2. Open the URL in a browser and enter the code
  3. Authentication is confirmed

2. Deploy

Deploy crews or flows to CrewAI Enterprise:

  1. Create Deployment: crewai deploy create
  2. Push Deployment: crewai deploy push

Monitor Deployment:

  • crewai deploy status
  • crewai deploy logs
  • crewai deploy list
  • crewai deploy remove

Deployment reads project configuration and environment variables.

3. Organization Management

Manage Enterprise organizations:

crewai org [COMMAND] [OPTIONS]

Commands:

  • list — Show all organizations
  • current — Show active organization
  • switch <organization_id> — Switch organization

4. API Keys

When creating a crew, select an LLM provider and enter the API key. Providers include:

  • OpenAI
  • Groq
  • Anthropic
  • Google Gemini
  • SambaNova

Other LiteLLM-supported providers are available via "other".

5. Configuration Management

Manage CLI configuration:

crewai config [COMMAND] [OPTIONS]

Commands:

  • list — Show all parameters
  • set <key> <value> — Update a parameter
  • reset — Restore defaults

Example:

crewai config set enterprise_base_url https://my-enterprise.crewai.com
crewai config set oauth2_provider auth0
crewai config reset

Configuration is stored in ~/.config/crewai/settings.json. Some values are read-only and managed through authentication.


Explore