DS DevShelfHub Projects · AI tools
Tutorials / AI Agents / Core Concepts
Build with CrewAI Beginner · 12 min read Page 2 of 29

CrewAI Primitives: Agents, Tasks, and Crews for Python Builders

By DevShelfHub

The five primitives that make up every CrewAI app: Agents, Tasks, Crews, Tools, and Processes — explained with minimal code.

Series progress2 / 29
CrewAI core concepts tutorial — CrewAI Primitives: Agents, Tasks, and Crews for Python Builders

1. Agent

An Agent is an autonomous AI worker. It has a role, a goal, and a backstory that shape its behavior, plus optional tools it can call.

Minimal Agent

PYTHON
from crewai import Agent

researcher = Agent(
    role="Senior Research Analyst",
    goal="Find current, accurate information on {topic}",
    backstory=(
        "You are a meticulous research analyst with 10 years "
        "of experience in tech industry trends. You cite sources."
    ),
    verbose=True,
)

The role is the strongest behavioral lever — choose it carefully.

2. Task

A Task is a unit of work assigned to an agent. It has a description (what to do) and an expected_output (what success looks like).

Defining a Task

PYTHON
from crewai import Task

research_task = Task(
    description=(
        "Research the latest developments in {topic}. "
        "Focus on the past 6 months. Include 3-5 reputable sources."
    ),
    expected_output=(
        "A bullet-point summary of 5 key findings, each with "
        "a one-sentence explanation and a source URL."
    ),
    agent=researcher,
)

3. Crew

A Crew ties agents and tasks together with a process (sequential or hierarchical) and runs them.

Building & Running a Crew

PYTHON
from crewai import Crew, Process

crew = Crew(
    agents=[researcher, writer],
    tasks=[research_task, writing_task],
    process=Process.sequential,
    verbose=True,
)

result = crew.kickoff(inputs={"topic": "agentic RAG"})
print(result)

4. Tools

Tools are functions an agent can call. CrewAI ships with web search (for example SerperDevTool), scraping, file I/O, and you can register custom ones with @tool.

Attaching a Tool

PYTHON
from crewai_tools import SerperDevTool

search_tool = SerperDevTool()

researcher = Agent(
    role="Research Analyst",
    goal="Find recent news on {topic}",
    backstory="...",
    tools=[search_tool],
)

5. Process

The Process controls how tasks flow.

Sequential

Tasks run in order. Output of one feeds the next via context. Easy to reason about — start here.

Hierarchical

A manager agent delegates tasks to workers, then verifies. Use when work order is dynamic or supervision matters.

The Mental Model

Think: "A crew of agents executes tasks under a process, optionally using tools."

That's the whole framework. Everything else (memory, callbacks, delegation) is optional polish on top.

Notes

Primitives interact; do not optimize one in isolation

A perfect task description still fails if tools are too broad or memory is polluted. When debugging, change one primitive at a time and measure outputs.

Processes encode business semantics

Sequential versus hierarchical is not a performance knob; it mirrors how your org approves work. Mismatch here creates agents that sound smart but violate workflow rules.

Tools should match agent scope

If every agent can call every integration, you rebuilt a monolith with extra steps. Treat tool lists like RBAC assignments.

Crews are schedulers, not magic reliability

You still need timeouts, retries, and human oversight for customer-facing flows. The framework wires LLM calls; your service owns SLOs.

CrewAI core concepts FAQ

What are the five CrewAI primitives?

Agents define who does the work, tasks define what to deliver, crews bind agents and tasks with a process, tools extend agent capabilities, and processes set execution order such as sequential or hierarchical flows.

How does a CrewAI crew differ from a single LLM call?

A crew schedules multiple agent steps with explicit contracts, tool access, and memory instead of one prompt trying to do everything. That separation improves reliability for multi-step business workflows.

What is a CrewAI process?

A process is the execution strategy for tasks—commonly sequential for pipelines or hierarchical when a manager agent coordinates others. It determines ordering, delegation, and failure handling semantics.

How do tools attach in CrewAI?

Tools attach to agents so each worker only sees integrations it needs. That reduces tool misuse compared with giving one mega-prompt access to every integration at once.

Where do I go after learning CrewAI core concepts?

Follow installation and setup, then build your first crew. Keep the API reference open for class-level details while you iterate on prompts and task descriptions.

See also: DevShelfHub's CrewAI tool review for a product-level comparison, pricing notes, and links back into this tutorial series.

Quick jump: API Reference