Prepare for Deployment
Understanding Automations
Section titled “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
Section titled “Crews vs Flows: Key Differences”Crew Projects
Standalone AI agent teams. New crews are JSON-first with crew.jsonc and agents/; classic crews can still use crew.py.
Flow Projects
Orchestrated workflows with embedded crews in a crews/ folder. Best for complex, multi-stage processes.
| Aspect | Crew | Flow |
|---|---|---|
| Project structure | Project root with crew.jsonc and agents/ | src/project_name/ with crews/ folder |
| Main logic location | crew.jsonc (classic: src/project_name/crew.py) | src/project_name/main.py (Flow class) |
| Entry point function | Loaded from crew.jsonc (classic: run() in main.py) | kickoff() in main.py |
| pyproject.toml type | type = "crew" | type = "flow" |
| CLI create command | crewai create crew name | crewai create flow name |
| Config location | crew.jsonc, agents/, optional tools/ | src/project_name/crews/crew_name/config/ or embedded JSON crew folders |
| Can contain other crews | No | Yes (in crews/ folder) |
Project Structure Reference
Section titled “Project Structure Reference”Crew Project Structure
Section titled “Crew Project Structure”When you run crewai create crew my_crew, you get the JSON-first structure:
my_crew/├── .gitignore├── pyproject.toml # Must have type = "crew"├── README.md├── .env├── uv.lock # REQUIRED for deployment├── crew.jsonc # Crew settings, tasks, process, inputs├── agents/│ └── researcher.jsonc # Agent definitions├── tools/ # Optional custom:<name> tools├── knowledge/└── skills/Flow Project Structure
Section titled “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.pyPre-Deployment Checklist
Section titled “Pre-Deployment Checklist”Use this checklist to verify your project is ready for deployment.
1. Verify pyproject.toml Configuration
Section titled “1. Verify pyproject.toml Configuration”Your pyproject.toml must include the correct [tool.crewai] section:
[tool.crewai]type = "crew"[tool.crewai]type = "flow"2. Ensure uv.lock File Exists
Section titled “2. Ensure uv.lock File Exists”CrewAI uses uv for dependency management. The uv.lock file ensures reproducible builds and is required for deployment.
# Generate or update the lock fileuv lock
# Verify it existsls -la uv.lockIf the file doesn’t exist, run uv lock and commit it to your repository:
uv lockgit add uv.lockgit commit -m "Add uv.lock for deployment"git push3. Validate the Crew Definition
Section titled “3. Validate the Crew Definition”JSON-first crews must have a crew.jsonc or crew.json file at the project root.
The agents array must reference files in agents/, and each task should reference
a valid agent name.
{ "name": "Research Crew", "agents": ["researcher"], "tasks": [ { "name": "research_task", "description": "Research {topic}.", "expected_output": "A concise report.", "agent": "researcher" } ], "inputs": { "topic": "AI Agents" }}Custom tools are referenced as "custom:<name>" and must be implemented in
tools/<name>.py with a BaseTool subclass.
Classic crews and Python crews embedded in Flows must use the @CrewBase decorator.
from crewai import Agent, Crew, Process, Taskfrom crewai.project import CrewBase, agent, crew, taskfrom crewai.agents.agent_builder.base_agent import BaseAgentfrom typing import List
@CrewBaseclass 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, )4. Check Project Entry Points
Section titled “4. Check Project Entry Points”JSON-first standalone crews do not need a hand-written src/project_name/main.py; crewai run
and deployment packaging load crew.jsonc directly. Classic crews and Flows use Python entry
points:
Run locally from the project root:
crewai runThe entry point uses a run() function:
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()The entry point uses a kickoff() function with a Flow class:
from crewai.flow import Flow, listen, startfrom 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()5. Prepare Environment Variables
Section titled “5. Prepare Environment Variables”Before deployment, ensure you have:
- LLM API keys ready (OpenAI, Anthropic, Google, etc.)
- Tool API keys if using external tools (Serper, etc.)
Quick Validation Commands
Section titled “Quick Validation Commands”Run these commands from your project root to quickly verify your setup:
# 1. Check project type in pyproject.tomlgrep -A2 "\[tool.crewai\]" pyproject.toml
# 2. Verify uv.lock existsls -la uv.lock || echo "ERROR: uv.lock missing! Run 'uv lock'"
# 3. For JSON-first crews, verify crew.jsonc and agents/ exist([ -f crew.jsonc ] || [ -f crew.json ]) || echo "No crew.jsonc or crew.json found"test -d agents || echo "No agents/ directory found"
# 4. For classic Crews - verify crew.py existsls -la src/*/crew.py 2>/dev/null || echo "No crew.py (expected for Crews)"
# 5. For Flows - verify crews/ folder existsls -la src/*/crews/ 2>/dev/null || echo "No crews/ folder (expected for Flows)"
# 6. For classic Python crews - check for CrewBase usagegrep -r "@CrewBase" . --include="*.py"Common Setup Mistakes
Section titled “Common Setup Mistakes”| Mistake | Symptom | Fix |
|---|---|---|
Missing uv.lock | Build fails during dependency resolution | Run uv lock and commit |
Wrong type in pyproject.toml | Build succeeds but runtime fails | Change to correct type |
Missing crew.jsonc or agents/ in a JSON-first crew | Crew definition not found | Keep crew.jsonc and agents/ at the project root |
Missing @CrewBase decorator in a classic crew | ”Config not found” errors | Add decorator to all classic crew classes |
Classic files at root instead of src/ | Entry point not found | Move classic Python files to src/project_name/ |
Missing run() or kickoff() | Cannot start automation | Add correct entry function |
Next Steps
Section titled “Next Steps”Once your project passes all checklist items, you’re ready to deploy:
Deploy to AMP
Follow the deployment guide to deploy your Crew or Flow to CrewAI AMP using the CLI, web interface, or CI/CD integration.