CrewAI projects with the CLI

CrewAI · Essentials · 12 min

The CLI project layout is how CrewAI expects real projects to be organised, run, trained and deployed.

For anything beyond a script, create a project with the CLI:

crewai create crew research_crew
cd research_crew
crewai install
crewai run

crewai create asks for a model provider and writes a project. Since CrewAI 1.15 the default layout is JSON-first:

  • agents/researcher.jsonc: one file per agent with role, goal, backstory, llm, tools and a settings block (such as verbose and allow_delegation).
  • crew.jsonc: the crew's name, the list of agents, the tasks (each with name, description, expected_output, agent, optional context and output_file), the process, and default inputs for placeholders.
  • tools/: your own tools as Python files, referenced from an agent as "custom:my_tool".
  • knowledge/: files agents can search (a later lesson).
  • .env for keys and pyproject.toml for dependencies.

JSONC is JSON that also allows // comments. The generated files are full of commented-out options, which makes them a handy reference.

crewai install installs dependencies into the project's own environment. crewai run loads crew.jsonc, asks for any placeholder that has no default in inputs, and runs the crew.

From Python you can load the same project: load_crew("crew.jsonc") returns the crew and its default inputs.

Older tutorials show crew.py with config/agents.yaml and config/tasks.yaml. That classic layout still exists behind --classic (next level). Only run projects from sources you trust: custom: tools are executed as Python code when the crew loads.

Example

// agents/researcher.jsonc
{
  "role": "Senior research specialist for {topic}",
  "goal": "Find accurate, current information about {topic}",
  "backstory": "You verify facts and always note your sources.",
  "llm": "openai/gpt-4o-mini",
  "tools": ["SerperDevTool"],           // web search (needs SERPER_API_KEY)
  "settings": { "verbose": true, "allow_delegation": false }
}

// crew.jsonc
{
  "name": "Research crew",
  "agents": ["researcher"],
  "tasks": [{
    "name": "research_task",
    "description": "Research the latest developments in {topic}.",
    "expected_output": "10 bullet points with sources.",
    "agent": "researcher",
    "output_file": "output/report.md"
  }],
  "process": "sequential",
  "inputs": { "topic": "AI in healthcare" }
}

Remember

  • crewai create crew NAME scaffolds a JSON-first project
  • Agents live in agents/*.jsonc; tasks, process and inputs in crew.jsonc
  • crewai install then crewai run; load_crew() loads it from Python

Watch out for

  • Copying a 0.x tutorial's crew.py/YAML files into a new JSON-first project and wondering why crewai run ignores them; use --classic for that layout.

Check yourself

  1. In a default CrewAI 1.15 project, where is the list of tasks defined?

Sign in to answer, see the explanations, and get this lesson back as a quick review later.

Official docs: docs.crewai.com/en/guides/crews/first-crew