Prepare for Deployment

no
Summary: Ensure your Crew or Flow is ready for deployment to CrewAI AMP

Original Documentation

Documentation Index#

Fetch the complete documentation index at: https://docs.crewai.com/llms.txt Use this file to discover all available pages before exploring further.

Ensure your Crew or Flow is ready for deployment to CrewAI AMP

Before deploying to CrewAI AMP, it’s crucial to verify your project is correctly structured. Both Crews and Flows can be deployed as “automations,” but they have different project structures and requirements that must be met for successful deployment.

Understanding Automations#

In CrewAI AMP, automations is the umbrella term for deployable Agentic AI projects. An automation can be either:

  • A Crew: A standalone team of AI agents working together on tasks
  • A Flow: An orchestrated workflow that can combine multiple crews, direct LLM calls, and procedural logic

Understanding which type you’re deploying is essential because they have different project structures and entry points.

Crews vs Flows: Key Differences#

<span class=“card-start” data-card-raw=“title=“Crew Projects” icon=“users”"> Standalone AI agent teams with crew.py defining agents and tasks. Best for focused, collaborative tasks.

<span class=“card-start” data-card-raw=“title=“Flow Projects” icon=“diagram-project”"> Orchestrated workflows with embedded crews in a crews/ folder. Best for complex, multi-stage processes.

AspectCrewFlow
Project structuresrc/project_name/ with crew.pysrc/project_name/ with crews/ folder
Main logic locationsrc/project_name/crew.pysrc/project_name/main.py (Flow class)
Entry point functionrun() in main.pykickoff() in main.py
pyproject.toml typetype = "crew"type = "flow"
CLI create commandcrewai create crew namecrewai create flow name
Config locationsrc/project_name/config/src/project_name/crews/crew_name/config/
Can contain other crewsNoYes (in crews/ folder)

Project Structure Reference#

Crew Project Structure#

When you run crewai create crew my_crew, you get this structure:

my_crew/
├── .gitignore
├── pyproject.toml          # Must have type = "crew"
├── README.md
├── .env
├── uv.lock                  # REQUIRED for deployment
└── src/
    └── my_crew/
        ├── __init__.py
        ├── main.py          # Entry point with run() function
        ├── crew.py          # Crew class with @CrewBase decorator
        ├── tools/
        │   ├── custom_tool.py
        │   └── __init__.py
        └── config/
            ├── agents.yaml  # Agent definitions
            └── tasks.yaml   # Task definitions

The nested src/project_name/ structure is critical for Crews. Placing files at the wrong level will cause deployment failures.

Flow Project Structure#

When you run crewai create flow my_flow, you get this structure:

my_flow/
├── .gitignore
├── pyproject.toml          # Must have type = "flow"
├── README.md
├── .env
├── uv.lock                  # REQUIRED for deployment
└── src/
    └── my_flow/
        ├── __init__.py
        ├── main.py          # Entry point with kickoff() function + Flow class
        ├── crews/           # Embedded crews folder
        │   └── poem_crew/
        │       ├── __init__.py
        │       ├── poem_crew.py  # Crew with @CrewBase decorator
        │       └── config/
        │           ├── agents.yaml
        │           └── tasks.yaml
        └── tools/
            ├── __init__.py
            └── custom_tool.py

Both Crews and Flows use the src/project_name/ structure. The key difference is that Flows have a crews/ folder for embedded crews, while Crews have crew.py directly in the project folder.

Pre-Deployment Checklist#

Use this checklist to verify your project is ready for deployment.

1. Verify pyproject.toml Configuration#

Your pyproject.toml must include the correct [tool.crewai] section:

    [tool.crewai]
    type = "crew"
    ```
  <span class="tab-end"></span>

  <span class="tab-start" data-tab-title="For Flows"></span>
```toml
    [tool.crewai]
    type = "flow"
    ```
  <span class="tab-end"></span>
<span class="tab-group-end"></span>

<span class="callout-start" data-callout-type="warning"></span>
  If the `type` doesn't match your project structure, the build will fail or
  the automation won't run correctly.
<span class="callout-end"></span>

### 2. Ensure uv.lock File Exists

CrewAI uses `uv` for dependency management. The `uv.lock` file ensures reproducible builds and is **required** for deployment.

```bash
# Generate or update the lock file
uv lock

# Verify it exists
ls -la uv.lock

If the file doesn’t exist, run uv lock and commit it to your repository:

uv lock
git add uv.lock
git commit -m "Add uv.lock for deployment"
git push

3. Validate CrewBase Decorator Usage#

Every crew class must use the @CrewBase decorator. This applies to:

  • Standalone crew projects
  • Crews embedded inside Flow projects
from crewai import Agent, Crew, Process, Task
from crewai.project import CrewBase, agent, crew, task
from crewai.agents.agent_builder.base_agent import BaseAgent
from typing import List

@CrewBase  # This decorator is REQUIRED
class MyCrew():
    """My crew description"""

    agents: List[BaseAgent]
    tasks: List[Task]

    @agent
    def my_agent(self) -> Agent:
        return Agent(
            config=self.agents_config['my_agent'],  # type: ignore[index]
            verbose=True
        )

    @task
    def my_task(self) -> Task:
        return Task(
            config=self.tasks_config['my_task']  # type: ignore[index]
        )

    @crew
    def crew(self) -> Crew:
        return Crew(
            agents=self.agents,
            tasks=self.tasks,
            process=Process.sequential,
            verbose=True,
        )

If you forget the @CrewBase decorator, your deployment will fail with errors about missing agents or tasks configurations.

4. Check Project Entry Points#

Both Crews and Flows have their entry point in src/project_name/main.py:

The entry point uses a run() function:

    # src/my_crew/main.py
    from my_crew.crew import MyCrew

    def run():
        """Run the crew."""
        inputs = {'topic': 'AI in Healthcare'}
        result = MyCrew().crew().kickoff(inputs=inputs)
        return result

    if __name__ == "__main__":
        run()
    ```
  <span class="tab-end"></span>

  <span class="tab-start" data-tab-title="For Flows"></span>
The entry point uses a `kickoff()` function with a Flow class:

```python
    # src/my_flow/main.py
    from crewai.flow import Flow, listen, start
    from my_flow.crews.poem_crew.poem_crew import PoemCrew

    class MyFlow(Flow):
        @start()
        def begin(self):
            # Flow logic here
            result = PoemCrew().crew().kickoff(inputs={...})
            return result

    def kickoff():
        """Run the flow."""
        MyFlow().kickoff()

    if __name__ == "__main__":
        kickoff()
    ```
  <span class="tab-end"></span>
<span class="tab-group-end"></span>

### 5. Prepare Environment Variables

Before deployment, ensure you have:

1. **LLM API keys** ready (OpenAI, Anthropic, Google, etc.)
2. **Tool API keys** if using external tools (Serper, etc.)

<span class="callout-start" data-callout-type="info"></span>
  If your project depends on packages from a **private PyPI registry**, you'll also need to configure
  registry authentication credentials as environment variables. See the
  [Private Package Registries](/en/enterprise/guides/private-package-registry) guide for details.
<span class="callout-end"></span>

<span class="callout-start" data-callout-type="tip"></span>
  Test your project locally with the same environment variables before deploying
  to catch configuration issues early.
<span class="callout-end"></span>

## Quick Validation Commands

Run these commands from your project root to quickly verify your setup:

```bash
# 1. Check project type in pyproject.toml
grep -A2 "\[tool.crewai\]" pyproject.toml

# 2. Verify uv.lock exists
ls -la uv.lock || echo "ERROR: uv.lock missing! Run 'uv lock'"

# 3. Verify src/ structure exists
ls -la src/*/main.py 2>/dev/null || echo "No main.py found in src/"

# 4. For Crews - verify crew.py exists
ls -la src/*/crew.py 2>/dev/null || echo "No crew.py (expected for Crews)"

# 5. For Flows - verify crews/ folder exists
ls -la src/*/crews/ 2>/dev/null || echo "No crews/ folder (expected for Flows)"

# 6. Check for CrewBase usage
grep -r "@CrewBase" . --include="*.py"

Common Setup Mistakes#

MistakeSymptomFix
Missing uv.lockBuild fails during dependency resolutionRun uv lock and commit
Wrong type in pyproject.tomlBuild succeeds but runtime failsChange to correct type
Missing @CrewBase decorator“Config not found” errorsAdd decorator to all crew classes
Files at root instead of src/Entry point not foundMove to src/project_name/
Missing run() or kickoff()Cannot start automationAdd correct entry function

Next Steps#

Once your project passes all checklist items, you’re ready to deploy:

Follow the deployment guide to deploy your Crew or Flow to CrewAI AMP using the CLI, web interface, or CI/CD integration.

Link last verified June 7, 2026. View original ↗
Source: CrewAI Docs
Link last verified: 2026-03-04