01 The Core Triad: Agent, Task, and Crew
PrimitivesAgent
A specialized worker defined by a role, a measurable goal, and a detailed backstory that primes its tone, domain expertise, and prompt behavior. Equipped with tools and optional delegation power.
Task
An actionable unit of work assigned to an Agent with a description and an explicit expected_output format (Markdown, JSON, Pydantic). Tasks can execute synchronously or asynchronously.
Crew
The container that orchestrates the execution flow between Agents and Tasks. Handles shared memory, manager LLM delegation, tool execution tracking, and final synthesis.
02 Sequential vs Hierarchical Processes
Execution FlowProcess.sequential
Linear Assembly LineTasks are executed in exact list order. The output of Task 1 is automatically passed as context into Task 2, and so on.
Process.hierarchical
Manager LLM Delegation
A designated manager_llm or manager_agent analyzes the overall goals, dynamically assigns tasks to workers, reviews outputs, and re-delegates if quality standards are not met.
03 CrewAI Multi-Tier Memory System
State & Context
When enabled with memory=True, CrewAI maintains three distinct memory layers simultaneously:
Short-Term Memory
Uses Chroma vector search to store intermediate execution context and agent thoughts during the active crew run. Agents can query past tool findings semantically.
Long-Term Memory
Persists task outcomes and reflections across separate crew runs in a local SQLite database (~/.crewai/memory/), allowing agents to learn from past executions over weeks.
Entity Memory
Extracts key subjects, organizations, people, and concepts into structured entity cards so agents maintain factual consistency across all conversation turns.
04 Custom Tool Integration with CrewAI
Extensibility
You can write custom tools either using the @tool decorator for lightweight functions or subclassing BaseTool with a Pydantic schema for robust validation:
Production Multi-Agent Competitive Intelligence Crew
A complete runnable CrewAI script with specialized personas, sequential tasks, and markdown output.
06 When to Choose CrewAI vs Other Frameworks
| Criteria | CrewAI | LangGraph | AutoGen |
|---|---|---|---|
| Philosophy | Role-playing department team | Cyclic state machine graph | Conversational group chat |
| Setup Complexity | Very Low (Declarative Python) | Medium (Nodes, Edges, Reducers) | Medium-High |
| Dynamic Delegation | Built-in (Hierarchical manager) | Manual (Supervisor node) | Built-in (GroupChatManager) |
| State Control | Implicit task context passing | Explicit typed dictionary state | Chat history messages |
07 Frequently Asked Questions
Can I run CrewAI with local open-source models (e.g. Ollama, vLLM)? →
Yes! CrewAI works with any OpenAI-compatible API or LangChain LLM wrapper. You can configure agents with Ollama using ChatOllama(model="llama3.3") or setting OPENAI_API_BASE="http://localhost:11434/v1".
How do I avoid runaway loops and excessive token costs? →
Always configure max_iter=15 and max_rpm=30 on your Agent instances. You can also specify cache=True on tool calls to prevent repeating identical web searches or database queries.
Can human feedback be inserted into a CrewAI workflow? →
Yes. Setting human_input=True on a Task prompts the human operator in the terminal (or via a custom handler) to review the agent's draft and provide feedback before the crew advances to the next task.