@grove-dev/cli 0.7.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +30 -10
- package/dist/audit-cli.d.ts +1 -1
- package/dist/audit-cli.d.ts.map +1 -1
- package/dist/audit-cli.js +11 -11
- package/dist/audit-cli.js.map +1 -1
- package/dist/audit.d.ts +4 -4
- package/dist/audit.d.ts.map +1 -1
- package/dist/audit.js +91 -51
- package/dist/audit.js.map +1 -1
- package/dist/collection-cli.d.ts.map +1 -1
- package/dist/collection-cli.js +1 -1
- package/dist/collection-cli.js.map +1 -1
- package/dist/diff.d.ts +43 -0
- package/dist/diff.d.ts.map +1 -0
- package/dist/diff.js +70 -0
- package/dist/diff.js.map +1 -0
- package/dist/hash.d.ts +36 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +82 -0
- package/dist/hash.js.map +1 -0
- package/dist/icons-cli.d.ts +1 -1
- package/dist/icons-cli.d.ts.map +1 -1
- package/dist/icons-cli.js +32 -14
- package/dist/icons-cli.js.map +1 -1
- package/dist/import-cli.d.ts +1 -1
- package/dist/import-cli.d.ts.map +1 -1
- package/dist/import-cli.js +6 -6
- package/dist/import-cli.js.map +1 -1
- package/dist/index.js +84 -60
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +37 -4
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +251 -57
- package/dist/init.js.map +1 -1
- package/dist/package.json +3 -2
- package/dist/r/about.json +22 -0
- package/dist/r/browse.json +89 -0
- package/dist/r/collections.json +59 -0
- package/dist/r/contributors.json +22 -0
- package/dist/r/default.json +438 -0
- package/dist/r/home.json +67 -0
- package/dist/r/not-found.json +22 -0
- package/dist/r/project-card.json +48 -0
- package/dist/r/record.json +59 -0
- package/dist/r/registry.json +903 -0
- package/dist/r/shell.json +75 -0
- package/dist/r/submit.json +28 -0
- package/dist/r/taxonomy.json +65 -0
- package/dist/r/ui.json +54 -0
- package/dist/readme-cli.d.ts +1 -1
- package/dist/readme-cli.d.ts.map +1 -1
- package/dist/readme-cli.js +37 -47
- package/dist/readme-cli.js.map +1 -1
- package/dist/registry.d.ts +74 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/registry.js +180 -0
- package/dist/registry.js.map +1 -0
- package/dist/run.d.ts +7 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.js +20 -0
- package/dist/run.js.map +1 -0
- package/dist/unified-diff.d.ts +14 -0
- package/dist/unified-diff.d.ts.map +1 -0
- package/dist/unified-diff.js +103 -0
- package/dist/unified-diff.js.map +1 -0
- package/dist/update.d.ts +47 -0
- package/dist/update.d.ts.map +1 -0
- package/dist/update.js +231 -0
- package/dist/update.js.map +1 -0
- package/package.json +5 -4
- package/dist/site/.github/ISSUE_TEMPLATE/bug_report.md +0 -33
- package/dist/site/.github/ISSUE_TEMPLATE/feature_request.md +0 -20
- package/dist/site/.github/ISSUE_TEMPLATE/record_submission.md +0 -48
- package/dist/site/.github/pull_request_template.md +0 -27
- package/dist/site/.github/workflows/ci.yml +0 -21
- package/dist/site/.github/workflows/cleanup.yml +0 -27
- package/dist/site/.github/workflows/deploy.yml +0 -36
- package/dist/site/.github/workflows/readme.yml +0 -41
- package/dist/site/.github/workflows/sync-contributors.yml +0 -28
- package/dist/site/.github/workflows/sync-github.yml +0 -31
- package/dist/site/README.md +0 -89
- package/dist/site/astro.config.mjs +0 -26
- package/dist/site/content/records/crewai.md +0 -898
- package/dist/site/content/records/dify.md +0 -35
- package/dist/site/content/records/flowise.md +0 -38
- package/dist/site/content/records/llamaindex.md +0 -45
- package/dist/site/content/records/ollama.md +0 -39
- package/dist/site/content/records/open-webui.md +0 -35
- package/dist/site/data/collections/top-ai-agents.yml +0 -14
- package/dist/site/data/collections/top-flutter.yml +0 -12
- package/dist/site/data/health.yml +0 -13
- package/dist/site/data/records/.gitkeep +0 -0
- package/dist/site/data/records/crewai.yml +0 -23
- package/dist/site/data/records/dify.yml +0 -23
- package/dist/site/data/records/flowise.yml +0 -23
- package/dist/site/data/records/llamaindex.yml +0 -23
- package/dist/site/data/records/ollama.yml +0 -30
- package/dist/site/data/records/open-webui.yml +0 -23
- package/dist/site/data/taxonomy/categories.yml +0 -10
- package/dist/site/data/taxonomy/distribution-channels.yml +0 -43
- package/dist/site/data/taxonomy/licenses.yml +0 -16
- package/dist/site/data/taxonomy/platforms.yml +0 -20
- package/dist/site/data/taxonomy/stacks.yml +0 -15
- package/dist/site/data/taxonomy/topics.yml +0 -29
- package/dist/site/grove.config.ts +0 -110
- package/dist/site/package.json +0 -34
- package/dist/site/public/icons/.grove-icons.json +0 -47
- package/dist/site/public/icons/platforms/android.svg +0 -1
- package/dist/site/public/icons/platforms/app.svg +0 -4
- package/dist/site/public/icons/platforms/chrome.svg +0 -1
- package/dist/site/public/icons/platforms/desktop.svg +0 -4
- package/dist/site/public/icons/platforms/embedded.svg +0 -5
- package/dist/site/public/icons/platforms/ios.svg +0 -1
- package/dist/site/public/icons/platforms/linux.svg +0 -1
- package/dist/site/public/icons/platforms/macos.svg +0 -1
- package/dist/site/public/icons/platforms/ubuntu.svg +0 -1
- package/dist/site/public/icons/platforms/web.svg +0 -5
- package/dist/site/public/icons/platforms/windows.svg +0 -1
- package/dist/site/public/icons/stacks/android.svg +0 -1
- package/dist/site/public/icons/stacks/apple.svg +0 -1
- package/dist/site/public/icons/stacks/bun.svg +0 -1
- package/dist/site/public/icons/stacks/capacitor.svg +0 -1
- package/dist/site/public/icons/stacks/clojure.svg +0 -1
- package/dist/site/public/icons/stacks/dart.svg +0 -1
- package/dist/site/public/icons/stacks/deno.svg +0 -1
- package/dist/site/public/icons/stacks/django.svg +0 -1
- package/dist/site/public/icons/stacks/docker.svg +0 -1
- package/dist/site/public/icons/stacks/firebase.svg +0 -1
- package/dist/site/public/icons/stacks/flutter.svg +0 -1
- package/dist/site/public/icons/stacks/go.svg +0 -1
- package/dist/site/public/icons/stacks/graphql.svg +0 -1
- package/dist/site/public/icons/stacks/ionic.svg +0 -1
- package/dist/site/public/icons/stacks/java.svg +0 -1
- package/dist/site/public/icons/stacks/javascript.svg +0 -1
- package/dist/site/public/icons/stacks/kotlin.svg +0 -1
- package/dist/site/public/icons/stacks/llm.svg +0 -4
- package/dist/site/public/icons/stacks/mongodb.svg +0 -1
- package/dist/site/public/icons/stacks/nodejs.svg +0 -1
- package/dist/site/public/icons/stacks/python.svg +0 -1
- package/dist/site/public/icons/stacks/rag.svg +0 -6
- package/dist/site/public/icons/stacks/react-native.svg +0 -1
- package/dist/site/public/icons/stacks/react.svg +0 -1
- package/dist/site/public/icons/stacks/rust.svg +0 -1
- package/dist/site/public/icons/stacks/solidity.svg +0 -1
- package/dist/site/public/icons/stacks/sveltekit.svg +0 -1
- package/dist/site/public/icons/stacks/swift.svg +0 -1
- package/dist/site/public/icons/stacks/tauri.svg +0 -1
- package/dist/site/public/icons/stacks/tensorflow.svg +0 -1
- package/dist/site/public/icons/stacks/typescript.svg +0 -1
- package/dist/site/public/icons/stacks/vue.svg +0 -1
- package/dist/site/public/logo.svg +0 -16
- package/dist/site/src/components/DirectoryBrowse.astro +0 -246
- package/dist/site/src/components/PipelineStrip.astro +0 -121
- package/dist/site/src/components/TaxonomyList.astro +0 -108
- package/dist/site/src/pages/404.astro +0 -63
- package/dist/site/src/pages/[slug]/[recordSlug].astro +0 -71
- package/dist/site/src/pages/[slug]/index.astro +0 -19
- package/dist/site/src/pages/[slug]/page/[page].astro +0 -32
- package/dist/site/src/pages/[slug]/page/cards.astro +0 -50
- package/dist/site/src/pages/[slug]/page/records.json.ts +0 -24
- package/dist/site/src/pages/about.astro +0 -130
- package/dist/site/src/pages/categories/[name].astro +0 -35
- package/dist/site/src/pages/categories/index.astro +0 -33
- package/dist/site/src/pages/collections/[slug].astro +0 -45
- package/dist/site/src/pages/collections/index.astro +0 -32
- package/dist/site/src/pages/contributors.astro +0 -115
- package/dist/site/src/pages/empty.astro +0 -24
- package/dist/site/src/pages/index.astro +0 -161
- package/dist/site/src/pages/licenses/[name].astro +0 -35
- package/dist/site/src/pages/stacks/[name].astro +0 -35
- package/dist/site/src/pages/stacks/index.astro +0 -35
- package/dist/site/src/pages/submit.astro +0 -183
- package/dist/site/src/styles/global.css +0 -21
- package/dist/site/tsconfig.json +0 -13
- /package/{dist/site/LICENSE → LICENSE} +0 -0
|
@@ -1,898 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "CrewAI — Coordinating Role-Playing AI Agents in Python"
|
|
3
|
-
summary: "A Python framework for orchestrating role-playing autonomous agents, tasks, multi-step crews, and Flows with memory, tools, and human-in-the-loop guardrails."
|
|
4
|
-
tags: [agents, multi-agent, orchestration, python, llm, automation]
|
|
5
|
-
updated: 2026-08-10
|
|
6
|
-
---
|
|
7
|
-
|
|
8
|
-
CrewAI is a lean, fast Python framework for orchestrating **role-playing autonomous agents** that collaborate on a sequence of tasks. You define an `Agent` with a role, a goal, and a backstory; give it tools; bind it to one or more `Task`s; declare a `Crew` with a process; and call `.kickoff()`. The framework handles the message-passing loop, tool calling, memory, delegation, and checkpointing — all driven by [LiteLLM](https://github.com/BerriAI/litellm), so the same code can target GPT-4o, Claude 4.6, Llama 4, or a local Ollama model without changes.
|
|
9
|
-
|
|
10
|
-
> "Frameworks like LangChain and AutoGen made it easy to build single-agent loops. CrewAI made it easy to build *teams* that pass work between each other."
|
|
11
|
-
> — Joao (Joe) Moura, founder of CrewAI, interview on Latent Space, 2025
|
|
12
|
-
|
|
13
|
-
The project is published under the **MIT License** and ships with `crewai`, `crewai-tools`, a CLI (`crewai run`), and a streaming `crewai chat` REPL. It is actively maintained by the [crewAIInc](https://github.com/crewAIInc) organization on GitHub and powers production workloads across finance, research, and developer tooling.
|
|
14
|
-
|
|
15
|
-
## What it solves
|
|
16
|
-
|
|
17
|
-
Most LLM frameworks optimize for *one model + one prompt + one tool call*. CrewAI optimizes for the next step up: a **team** of agents with different roles, a shared plan, and explicit handoffs.
|
|
18
|
-
|
|
19
|
-
- **Multi-agent patterns as code.** A crew of `Researcher → Writer → Editor` is a five-line `Crew(...)` constructor. Tools are typed Python callables; delegation between agents is built in.
|
|
20
|
-
- **Model-agnostic by default.** CrewAI runs on LiteLLM, so the same code can switch between `openai/gpt-4o`, `anthropic/claude-sonnet-4-6`, `groq/llama-3.3-70b`, or a local Ollama endpoint.
|
|
21
|
-
- **Two execution modes.** `Process.sequential` (the canonical "research → write → review" pipeline) and `Process.hierarchical` (a manager agent picks the next worker). The manager pattern is what the "auto" mode uses.
|
|
22
|
-
- **Plays well with the rest of the Python LLM stack.** Tools, memory, and agent definitions are plain Python — drop into a FastAPI service, a notebook, or a scheduled job.
|
|
23
|
-
|
|
24
|
-
## At a glance
|
|
25
|
-
|
|
26
|
-
| Attribute | Value |
|
|
27
|
-
| :--- | :--- |
|
|
28
|
-
| **Repository** | [github.com/crewAIInc/crewAI](https://github.com/crewAIInc/crewAI) |
|
|
29
|
-
| **License** | MIT |
|
|
30
|
-
| **Language** | Python 3.10+ |
|
|
31
|
-
| **Package** | `crewai`, `crewai-tools` |
|
|
32
|
-
| **First release** | November 2023 |
|
|
33
|
-
| **Latest stable** | 1.6.x (as of mid-2026) |
|
|
34
|
-
| **Stars** | 35k+ |
|
|
35
|
-
| **Maintainer** | CrewAI Inc. |
|
|
36
|
-
| **Docs** | [docs.crewai.com](https://docs.crewai.com) |
|
|
37
|
-
| **Discord** | ~22k members |
|
|
38
|
-
|
|
39
|
-
## Core architecture
|
|
40
|
-
|
|
41
|
-
### Concepts
|
|
42
|
-
|
|
43
|
-
CrewAI exposes four core types. The first three are mandatory; the fourth is opt-in but recommended for any non-trivial project.
|
|
44
|
-
|
|
45
|
-
1. **Agent** — an autonomous unit with a `role`, `goal`, `backstory`, an LLM, and a list of tools.
|
|
46
|
-
2. **Task** — a unit of work. A task has a `description`, an `expected_output`, an `agent`, optional `context` (other tasks whose outputs feed in), and optional `tools`.
|
|
47
|
-
3. **Crew** — a scheduler. It owns `agents`, `tasks`, a `process` (sequential or hierarchical), a `memory` flag, and a `cache` flag.
|
|
48
|
-
4. **Flow** — a higher-level orchestration. A Flow is a stateful, event-driven workflow that triggers Crews as steps, branches on their outputs, and persists state across them.
|
|
49
|
-
|
|
50
|
-
> A common misconception: a *Flow* is not required to use CrewAI. A Crew can run standalone for prototyping or as a unit of work inside an existing system. **Flows** exist for long-running, stateful applications where you need branching, retries, and persistent state across Crew executions.
|
|
51
|
-
|
|
52
|
-
### Execution pattern
|
|
53
|
-
|
|
54
|
-
```text
|
|
55
|
-
User input
|
|
56
|
-
│
|
|
57
|
-
▼
|
|
58
|
-
┌─────────────┐
|
|
59
|
-
│ Flow │ ← state, events, branching
|
|
60
|
-
└─────┬───────┘
|
|
61
|
-
│ delegates a step
|
|
62
|
-
▼
|
|
63
|
-
┌─────────────┐
|
|
64
|
-
│ Crew │ ← process: sequential | hierarchical
|
|
65
|
-
│ ┌─────────┐ │
|
|
66
|
-
│ │ Task 1 │ │ ← agent: Researcher
|
|
67
|
-
│ ├─────────┤ │
|
|
68
|
-
│ │ Task 2 │ │ ← agent: Writer context=[Task 1]
|
|
69
|
-
│ ├─────────┤ │
|
|
70
|
-
│ │ Task 3 │ │ ← agent: Editor context=[Task 2]
|
|
71
|
-
│ └─────────┘ │
|
|
72
|
-
└─────────────┘
|
|
73
|
-
│
|
|
74
|
-
▼
|
|
75
|
-
CrewOutput (raw, pydantic, tasks_output, token_usage)
|
|
76
|
-
```
|
|
77
|
-
|
|
78
|
-
## Agents
|
|
79
|
-
|
|
80
|
-
An `Agent` is a single autonomous actor. It carries its own LLM, tools, memory, and prompts. The three string attributes — `role`, `goal`, `backstory` — form the system prompt and are *the* levers you have on agent behavior.
|
|
81
|
-
|
|
82
|
-
### Full reference
|
|
83
|
-
|
|
84
|
-
| Attribute | Parameter | Type | Default | Description |
|
|
85
|
-
| :--- | :--- | :--- | :--- | :--- |
|
|
86
|
-
| Role | `role` | `str` | _required_ | Agent's function and expertise |
|
|
87
|
-
| Goal | `goal` | `str` | _required_ | Individual objective guiding decisions |
|
|
88
|
-
| Backstory | `backstory` | `str` | _required_ | Context and personality |
|
|
89
|
-
| LLM | `llm` | `Union[str, LLM, Any]` | env or `"gpt-4o-mini"` | Language model powering the agent |
|
|
90
|
-
| Tools | `tools` | `List[BaseTool]` | `[]` | Available capabilities |
|
|
91
|
-
| Function-calling LLM | `function_calling_llm` | `Optional[Any]` | `None` | LLM used for tool calling (may differ from reasoning LLM) |
|
|
92
|
-
| Max iterations | `max_iter` | `int` | `20` | Max iterations before best answer |
|
|
93
|
-
| Max RPM | `max_rpm` | `Optional[int]` | `None` | Per-agent rate limit |
|
|
94
|
-
| Max execution time | `max_execution_time` | `Optional[int]` | `None` | Timeout in seconds |
|
|
95
|
-
| Verbose | `verbose` | `bool` | `False` | Detailed logs |
|
|
96
|
-
| Allow delegation | `allow_delegation` | `bool` | `False` | Whether the agent can hand work to other agents |
|
|
97
|
-
| Step callback | `step_callback` | `Optional[Any]` | `None` | Per-step callback function |
|
|
98
|
-
| Cache | `cache` | `bool` | `True` | Cache tool results across runs |
|
|
99
|
-
| Respect context window | `respect_context_window` | `bool` | `True` | Auto-summarize on overflow |
|
|
100
|
-
| Multimodal | `multimodal` | `bool` | `False` | Enable image inputs alongside text |
|
|
101
|
-
| Inject date | `inject_date` | `bool` | `False` | Auto-inject the current date into the prompt |
|
|
102
|
-
| Date format | `date_format` | `str` | `"%Y-%m-%d"` | `strftime` format for the injected date |
|
|
103
|
-
| Reasoning | `reasoning` | `bool` | `False` | Pre-task planning step |
|
|
104
|
-
| Max reasoning attempts | `max_reasoning_attempts` | `Optional[int]` | `None` | Cap on planning iterations |
|
|
105
|
-
| Embedder | `embedder` | `Optional[Dict[str, Any]]` | `None` | Embedding configuration for memory |
|
|
106
|
-
| Knowledge sources | `knowledge_sources` | `Optional[List[BaseKnowledgeSource]]` | `None` | Knowledge bases the agent can query |
|
|
107
|
-
| Use system prompt | `use_system_prompt` | `Optional[bool]` | `True` | System prompt toggle (set `False` for older models) |
|
|
108
|
-
| Max retry limit | `max_retry_limit` | `int` | `2` | Retries on tool errors |
|
|
109
|
-
|
|
110
|
-
### Defining an agent
|
|
111
|
-
|
|
112
|
-
The canonical way to define agents today is in a `crew.jsonc` file (or `agents/<name>.jsonc`). JSONC supports comments and trailing commas.
|
|
113
|
-
|
|
114
|
-
```jsonc
|
|
115
|
-
// agents/researcher.jsonc
|
|
116
|
-
{
|
|
117
|
-
"role": "{topic} Senior Data Researcher",
|
|
118
|
-
"goal": "Uncover cutting-edge developments in {topic}",
|
|
119
|
-
"backstory": "You find the most relevant information and present it clearly.",
|
|
120
|
-
"llm": "openai/gpt-4o",
|
|
121
|
-
"tools": ["SerperDevTool"],
|
|
122
|
-
"settings": {
|
|
123
|
-
"verbose": true,
|
|
124
|
-
"allow_delegation": false,
|
|
125
|
-
"max_iter": 20,
|
|
126
|
-
"respect_context_window": true
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
The same agent in Python:
|
|
132
|
-
|
|
133
|
-
```python
|
|
134
|
-
from crewai import Agent
|
|
135
|
-
from crewai_tools import SerperDevTool
|
|
136
|
-
|
|
137
|
-
researcher = Agent(
|
|
138
|
-
role="Senior Data Researcher",
|
|
139
|
-
goal="Uncover cutting-edge developments in {topic}",
|
|
140
|
-
backstory="You find the most relevant information and present it clearly.",
|
|
141
|
-
llm="openai/gpt-4o",
|
|
142
|
-
tools=[SerperDevTool()],
|
|
143
|
-
verbose=True,
|
|
144
|
-
allow_delegation=False,
|
|
145
|
-
max_iter=20,
|
|
146
|
-
respect_context_window=True,
|
|
147
|
-
)
|
|
148
|
-
```
|
|
149
|
-
|
|
150
|
-
Three notes on the Python form:
|
|
151
|
-
|
|
152
|
-
1. `llm="openai/gpt-4o"` — the **provider prefix is required** for every model. Bare `gpt-4o` will fail.
|
|
153
|
-
2. `tools=[SerperDevTool()]` — instantiate, do not pass the class.
|
|
154
|
-
3. The `llm=` argument accepts a string or a fully constructed `LLM(...)` object. Use a string for simplicity; use an `LLM(...)` instance when you need provider-specific knobs (timeout, response format, extended thinking, etc.).
|
|
155
|
-
|
|
156
|
-
### Common patterns
|
|
157
|
-
|
|
158
|
-
**Basic research agent.**
|
|
159
|
-
|
|
160
|
-
```python
|
|
161
|
-
research_agent = Agent(
|
|
162
|
-
role="Research Analyst",
|
|
163
|
-
goal="Find and summarize information about specific topics",
|
|
164
|
-
backstory="You are an experienced researcher with attention to detail",
|
|
165
|
-
tools=[SerperDevTool()],
|
|
166
|
-
verbose=True,
|
|
167
|
-
)
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
**Reasoning agent for complex planning.** The `reasoning=True` flag turns on a pre-task planning step. Use it when the task is open-ended.
|
|
171
|
-
|
|
172
|
-
```python
|
|
173
|
-
strategic_agent = Agent(
|
|
174
|
-
role="Strategic Planner",
|
|
175
|
-
goal="Analyze complex problems and create detailed execution plans",
|
|
176
|
-
backstory="Expert strategic planner who methodically breaks down complex challenges",
|
|
177
|
-
reasoning=True,
|
|
178
|
-
max_reasoning_attempts=3,
|
|
179
|
-
max_iter=30,
|
|
180
|
-
verbose=True,
|
|
181
|
-
)
|
|
182
|
-
```
|
|
183
|
-
|
|
184
|
-
**Date-aware agent.** With `inject_date=True`, the agent's system prompt is prefixed with today's date in the chosen format.
|
|
185
|
-
|
|
186
|
-
```python
|
|
187
|
-
market_agent = Agent(
|
|
188
|
-
role="Market Analyst",
|
|
189
|
-
goal="Track market movements with precise date references",
|
|
190
|
-
backstory="Expert in time-sensitive financial analysis and strategic reporting",
|
|
191
|
-
inject_date=True,
|
|
192
|
-
date_format="%B %d, %Y",
|
|
193
|
-
reasoning=True,
|
|
194
|
-
max_reasoning_attempts=2,
|
|
195
|
-
)
|
|
196
|
-
```
|
|
197
|
-
|
|
198
|
-
**Multimodal agent.** With `multimodal=True`, the agent accepts image inputs alongside text — useful for vision-language pipelines.
|
|
199
|
-
|
|
200
|
-
```python
|
|
201
|
-
vision_agent = Agent(
|
|
202
|
-
role="Visual Content Analyst",
|
|
203
|
-
goal="Analyze and process both text and visual content",
|
|
204
|
-
backstory="Specialized in multimodal analysis combining text and image understanding",
|
|
205
|
-
multimodal=True,
|
|
206
|
-
verbose=True,
|
|
207
|
-
)
|
|
208
|
-
```
|
|
209
|
-
|
|
210
|
-
**Custom prompt templates.** Override `system_template`, `prompt_template`, and `response_template` when the default wiring doesn't fit your use case — typically when integrating with reasoning models that don't support system prompts.
|
|
211
|
-
|
|
212
|
-
```python
|
|
213
|
-
custom_agent = Agent(
|
|
214
|
-
role="Customer Service Representative",
|
|
215
|
-
goal="Assist customers with their inquiries",
|
|
216
|
-
backstory="Experienced in customer support with a focus on satisfaction",
|
|
217
|
-
use_system_prompt=False,
|
|
218
|
-
system_template="""system\n{{ .System }}""",
|
|
219
|
-
prompt_template="""user\n{{ .Prompt }}""",
|
|
220
|
-
response_template="""assistant\n{{ .Response }}""",
|
|
221
|
-
)
|
|
222
|
-
```
|
|
223
|
-
|
|
224
|
-
### Direct `kickoff()`
|
|
225
|
-
|
|
226
|
-
You don't need a Crew to run an agent. The `Agent.kickoff()` method runs a single query and returns a `LiteAgentOutput`.
|
|
227
|
-
|
|
228
|
-
```python
|
|
229
|
-
from pydantic import BaseModel
|
|
230
|
-
from typing import List
|
|
231
|
-
|
|
232
|
-
class ResearchFindings(BaseModel):
|
|
233
|
-
main_points: List[str]
|
|
234
|
-
key_technologies: List[str]
|
|
235
|
-
future_predictions: str
|
|
236
|
-
|
|
237
|
-
result = researcher.kickoff(
|
|
238
|
-
"Summarize the latest developments in AI for 2026",
|
|
239
|
-
response_format=ResearchFindings,
|
|
240
|
-
)
|
|
241
|
-
|
|
242
|
-
print(result.pydantic.main_points)
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
The async equivalent is `agent.kickoff_async(...)`.
|
|
246
|
-
|
|
247
|
-
## Tasks
|
|
248
|
-
|
|
249
|
-
A `Task` is a unit of work. It has a `description` (what to do), an `expected_output` (what success looks like), an `agent`, and optional `context` (other tasks whose outputs should be fed in).
|
|
250
|
-
|
|
251
|
-
### Full reference
|
|
252
|
-
|
|
253
|
-
| Attribute | Parameter | Type | Default | Description |
|
|
254
|
-
| :--- | :--- | :--- | :--- | :--- |
|
|
255
|
-
| Description | `description` | `str` | _required_ | Clear statement of what the task entails |
|
|
256
|
-
| Expected output | `expected_output` | `str` | _required_ | Detailed description of task completion |
|
|
257
|
-
| Name | `name` | `Optional[str]` | `None` | Identifier for the task |
|
|
258
|
-
| Agent | `agent` | `Optional[BaseAgent]` | `None` | Agent responsible for execution |
|
|
259
|
-
| Tools | `tools` | `List[BaseTool]` | `[]` | Tools the agent may use for this task |
|
|
260
|
-
| Context | `context` | `Optional[List["Task"]]` | `None` | Tasks whose outputs provide context |
|
|
261
|
-
| Async execution | `async_execution` | `Optional[bool]` | `False` | Run asynchronously |
|
|
262
|
-
| Human input | `human_input` | `Optional[bool]` | `False` | Require human review before completing |
|
|
263
|
-
| Markdown | `markdown` | `Optional[bool]` | `False` | Return output formatted in Markdown |
|
|
264
|
-
| Output file | `output_file` | `Optional[str]` | `None` | Path for storing output |
|
|
265
|
-
| Create directory | `create_directory` | `Optional[bool]` | `True` | Create directory if missing |
|
|
266
|
-
| Output JSON | `output_json` | `Optional[Type[BaseModel]]` | `None` | Pydantic model for JSON structure |
|
|
267
|
-
| Output Pydantic | `output_pydantic` | `Optional[Type[BaseModel]]` | `None` | Pydantic model for output |
|
|
268
|
-
| Callback | `callback` | `Optional[Any]` | `None` | Function executed after completion |
|
|
269
|
-
| Guardrail | `guardrail` | `Optional[Callable]` | `None` | Validate output before next task |
|
|
270
|
-
| Guardrails | `guardrails` | `Optional[List[Callable]]` | `None` | List of guardrails (overrides `guardrail`) |
|
|
271
|
-
| Guardrail max retries | `guardrail_max_retries` | `Optional[int]` | `3` | Max retries on guardrail failure |
|
|
272
|
-
|
|
273
|
-
### Context — chaining tasks
|
|
274
|
-
|
|
275
|
-
The `context` parameter is how CrewAI implements task dependencies. A task with `context=[research_task]` receives the *raw output* of `research_task` as part of its prompt.
|
|
276
|
-
|
|
277
|
-
```python
|
|
278
|
-
research_task = Task(
|
|
279
|
-
description="Research the latest developments in AI",
|
|
280
|
-
expected_output="A list of recent AI developments",
|
|
281
|
-
agent=researcher,
|
|
282
|
-
)
|
|
283
|
-
|
|
284
|
-
analysis_task = Task(
|
|
285
|
-
description="Analyze the research findings and identify key trends",
|
|
286
|
-
expected_output="Analysis report of AI trends",
|
|
287
|
-
agent=analyst,
|
|
288
|
-
context=[research_task],
|
|
289
|
-
)
|
|
290
|
-
```
|
|
291
|
-
|
|
292
|
-
Forward references are rejected at runtime — `analysis_task` cannot reference a task defined after it.
|
|
293
|
-
|
|
294
|
-
### Guardrails
|
|
295
|
-
|
|
296
|
-
A guardrail is a function that validates the task output before the next task starts. Use it to enforce length, format, or content rules.
|
|
297
|
-
|
|
298
|
-
```python
|
|
299
|
-
from typing import Tuple, Any
|
|
300
|
-
from crewai import TaskOutput
|
|
301
|
-
|
|
302
|
-
def validate_blog_content(result: TaskOutput) -> Tuple[bool, Any]:
|
|
303
|
-
word_count = len(result.raw.split())
|
|
304
|
-
if word_count > 200:
|
|
305
|
-
return (False, "Blog content exceeds 200 words")
|
|
306
|
-
return (True, result.raw.strip())
|
|
307
|
-
|
|
308
|
-
blog_task = Task(
|
|
309
|
-
description="Write a blog post about AI",
|
|
310
|
-
expected_output="A blog post under 200 words",
|
|
311
|
-
agent=blog_agent,
|
|
312
|
-
guardrail=validate_blog_content,
|
|
313
|
-
guardrail_max_retries=3,
|
|
314
|
-
)
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
LLM-based guardrails are also supported — pass a string describing the rule and the agent's own LLM validates.
|
|
318
|
-
|
|
319
|
-
### Structured output
|
|
320
|
-
|
|
321
|
-
Set `output_pydantic=<MyPydanticModel>` and the task output is parsed into a typed model.
|
|
322
|
-
|
|
323
|
-
```python
|
|
324
|
-
from pydantic import BaseModel
|
|
325
|
-
|
|
326
|
-
class Blog(BaseModel):
|
|
327
|
-
title: str
|
|
328
|
-
content: str
|
|
329
|
-
|
|
330
|
-
task = Task(
|
|
331
|
-
description="Create a blog title and content on a given topic.",
|
|
332
|
-
expected_output="A compelling blog title and well-written content.",
|
|
333
|
-
agent=blog_agent,
|
|
334
|
-
output_pydantic=Blog,
|
|
335
|
-
)
|
|
336
|
-
|
|
337
|
-
result = crew.kickoff()
|
|
338
|
-
print(result.pydantic.title)
|
|
339
|
-
print(result.pydantic.content)
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
Only **one** output type can be set per task — pick `output_file`, `output_json`, *or* `output_pydantic`, not multiple.
|
|
343
|
-
|
|
344
|
-
## Crews
|
|
345
|
-
|
|
346
|
-
A `Crew` is a scheduler. It owns a list of agents, a list of tasks, and a process that controls how tasks are dispatched.
|
|
347
|
-
|
|
348
|
-
### Configuration
|
|
349
|
-
|
|
350
|
-
| Attribute | Type | Default | Description |
|
|
351
|
-
| :--- | :--- | :--- | :--- |
|
|
352
|
-
| `tasks` | `List[Task]` | _required_ | List of tasks assigned to the crew |
|
|
353
|
-
| `agents` | `List[Agent]` | _required_ | List of agents in the crew |
|
|
354
|
-
| `process` | `Process` | `Process.sequential` | Process flow — `sequential` or `hierarchical` |
|
|
355
|
-
| `verbose` | `bool` | `False` | Logging verbosity |
|
|
356
|
-
| `manager_llm` | `str` | _None_ | LLM used by the manager agent (required for hierarchical) |
|
|
357
|
-
| `manager_agent` | `BaseAgent` | _None_ | Custom manager agent (overrides `manager_llm`) |
|
|
358
|
-
| `function_calling_llm` | `Any` | _None_ | LLM used for function calling across all agents |
|
|
359
|
-
| `memory` | `bool` | `False` | Enable short-term, long-term, entity memory |
|
|
360
|
-
| `cache` | `bool` | `True` | Cache tool results across runs |
|
|
361
|
-
| `max_rpm` | `int` | _None_ | Crew-level rate limit (overrides per-agent settings) |
|
|
362
|
-
| `embedder` | `Dict[str, Any]` | _None_ | Embedding configuration for memory |
|
|
363
|
-
| `step_callback` | `Any` | _None_ | Called after each step of every agent |
|
|
364
|
-
| `task_callback` | `Any` | _None_ | Called after each task completes |
|
|
365
|
-
| `output_log_file` | `str` | _None_ | Save logs to `.txt` or `.json` |
|
|
366
|
-
| `planning` | `bool` | `False` | Enable `AgentPlanner` |
|
|
367
|
-
| `planning_llm` | `str` | _None_ | LLM used by the planner |
|
|
368
|
-
| `knowledge_sources` | `List[BaseKnowledgeSource]` | _None_ | Knowledge bases accessible to all agents |
|
|
369
|
-
| `stream` | `bool` | `False` | Enable real-time streaming (`CrewStreamingOutput`) |
|
|
370
|
-
| `chat_llm` | `str` | _None_ | LLM for `crewai chat` CLI |
|
|
371
|
-
| `tracing` | `bool` | _None_ | OpenTelemetry tracing toggle |
|
|
372
|
-
| `skills` | `Path \| Skill` | _None_ | Skill definitions for agents |
|
|
373
|
-
| `checkpoint` | `CheckpointConfig` | _None_ | Automatic checkpointing configuration |
|
|
374
|
-
|
|
375
|
-
### Process types
|
|
376
|
-
|
|
377
|
-
1. **`Process.sequential`** — tasks run in the order defined. The output of each task is appended to the context of the next.
|
|
378
|
-
2. **`Process.hierarchical`** — a manager agent (specified by `manager_llm` or `manager_agent`) picks which worker runs next based on the task description and the current state. Requires `manager_llm`.
|
|
379
|
-
|
|
380
|
-
> **Tip:** Hierarchical mode is more flexible but compounds token cost. A 3-agent hierarchical crew with delegation can multiply a single user's prompt by **5–10x** at the API. Set `max_iter` and `max_rpm` aggressively.
|
|
381
|
-
|
|
382
|
-
### Kickoff
|
|
383
|
-
|
|
384
|
-
```python
|
|
385
|
-
result = crew.kickoff(inputs={"topic": "AI Agents"})
|
|
386
|
-
|
|
387
|
-
# Streaming
|
|
388
|
-
for chunk in crew.kickoff(inputs={"topic": "AI"}, stream=True):
|
|
389
|
-
print(chunk.content, end="", flush=True)
|
|
390
|
-
|
|
391
|
-
# Async
|
|
392
|
-
result = await crew.kickoff_async(inputs={"topic": "AI"})
|
|
393
|
-
|
|
394
|
-
# For-each
|
|
395
|
-
results = crew.kickoff_for_each(inputs=[{"topic": "A"}, {"topic": "B"}])
|
|
396
|
-
```
|
|
397
|
-
|
|
398
|
-
The result is a `CrewOutput` with `raw`, `pydantic`, `json_dict`, `tasks_output`, and `token_usage`.
|
|
399
|
-
|
|
400
|
-
### Checkpointing
|
|
401
|
-
|
|
402
|
-
Add `checkpoint=True` to save state after every task. Resume with `Crew.from_checkpoint(path)`.
|
|
403
|
-
|
|
404
|
-
```python
|
|
405
|
-
crew = Crew(
|
|
406
|
-
agents=[...],
|
|
407
|
-
tasks=[...],
|
|
408
|
-
checkpoint=True, # saves to ./.checkpoints
|
|
409
|
-
)
|
|
410
|
-
|
|
411
|
-
crew = Crew.from_checkpoint("./.checkpoints/latest.json")
|
|
412
|
-
crew.kickoff() # resumes from where it stopped
|
|
413
|
-
```
|
|
414
|
-
|
|
415
|
-
For fine-grained control, pass a `CheckpointConfig`:
|
|
416
|
-
|
|
417
|
-
```python
|
|
418
|
-
from crewai.checkpoint import CheckpointConfig, JsonProvider, SqliteProvider
|
|
419
|
-
|
|
420
|
-
crew = Crew(
|
|
421
|
-
agents=[...],
|
|
422
|
-
tasks=[...],
|
|
423
|
-
checkpoint=CheckpointConfig(
|
|
424
|
-
location="./.checkpoints",
|
|
425
|
-
on_events=["task_completed"], # or ["*"] for all events
|
|
426
|
-
provider=JsonProvider(), # or SqliteProvider for larger state
|
|
427
|
-
max_checkpoints=10,
|
|
428
|
-
),
|
|
429
|
-
)
|
|
430
|
-
```
|
|
431
|
-
|
|
432
|
-
## Memory
|
|
433
|
-
|
|
434
|
-
CrewAI 1.6 ships a **unified memory system** that replaces the older split between short-term, long-term, and entity memory with a single `Memory` class. Behind the scenes it uses LanceDB and an LLM to infer scope, categories, and importance when saving.
|
|
435
|
-
|
|
436
|
-
### Standalone usage
|
|
437
|
-
|
|
438
|
-
```python
|
|
439
|
-
from crewai import Memory
|
|
440
|
-
|
|
441
|
-
memory = Memory()
|
|
442
|
-
memory.remember("The API rate limit is 1000 requests per minute.")
|
|
443
|
-
memory.remember("Our staging environment uses port 8080.")
|
|
444
|
-
|
|
445
|
-
matches = memory.recall("What are our API limits?", limit=5)
|
|
446
|
-
for m in matches:
|
|
447
|
-
print(f"[{m.score:.2f}] {m.record.content}")
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
`Memory.recall()` returns a composite score that blends semantic similarity, recency, and importance:
|
|
451
|
-
|
|
452
|
-
```text
|
|
453
|
-
composite = semantic_weight * similarity
|
|
454
|
-
+ recency_weight * decay
|
|
455
|
-
+ importance_weight * importance
|
|
456
|
-
```
|
|
457
|
-
|
|
458
|
-
Defaults: `semantic_weight=0.5`, `recency_weight=0.3`, `importance_weight=0.2`, `recency_half_life_days=30`.
|
|
459
|
-
|
|
460
|
-
### Configuration
|
|
461
|
-
|
|
462
|
-
| Parameter | Default |
|
|
463
|
-
| :--- | :--- |
|
|
464
|
-
| `llm` | `"gpt-4o-mini"` |
|
|
465
|
-
| `storage` | `"lancedb"` (under `./.crewai/memory`) |
|
|
466
|
-
| `embedder` | OpenAI `text-embedding-3-large` |
|
|
467
|
-
| `recency_weight` | `0.3` |
|
|
468
|
-
| `semantic_weight` | `0.5` |
|
|
469
|
-
| `importance_weight` | `0.2` |
|
|
470
|
-
| `recency_half_life_days` | `30` |
|
|
471
|
-
| `consolidation_threshold` | `0.85` |
|
|
472
|
-
| `query_analysis_threshold` | `200` |
|
|
473
|
-
|
|
474
|
-
### Hierarchical scopes
|
|
475
|
-
|
|
476
|
-
Memories organize into a tree like `/`, `/project/alpha`, `/agent/researcher`. The LLM infers scope when not explicitly provided.
|
|
477
|
-
|
|
478
|
-
```python
|
|
479
|
-
memory.remember("Sprint velocity is 42 points", scope="/team/metrics")
|
|
480
|
-
|
|
481
|
-
agent_memory = memory.scope("/agent/researcher")
|
|
482
|
-
agent_memory.remember("Found three relevant papers on LLM memory.")
|
|
483
|
-
```
|
|
484
|
-
|
|
485
|
-
### Slices
|
|
486
|
-
|
|
487
|
-
A slice combines context from multiple disjoint scopes (read-only by default).
|
|
488
|
-
|
|
489
|
-
```python
|
|
490
|
-
agent_view = memory.slice(
|
|
491
|
-
scopes=["/agent/researcher", "/company/knowledge"],
|
|
492
|
-
read_only=True,
|
|
493
|
-
)
|
|
494
|
-
```
|
|
495
|
-
|
|
496
|
-
### Recall depth
|
|
497
|
-
|
|
498
|
-
```python
|
|
499
|
-
matches = memory.recall("What did we decide?", depth="shallow")
|
|
500
|
-
matches = memory.recall("Summarize all architecture decisions", depth="deep")
|
|
501
|
-
```
|
|
502
|
-
|
|
503
|
-
Deep recall uses multi-step `RecallFlow` with query analysis. Short queries (<200 chars by default) skip the LLM analysis step.
|
|
504
|
-
|
|
505
|
-
## Tools
|
|
506
|
-
|
|
507
|
-
CrewAI ships a separate package — `crewai-tools` — that bundles pre-built tools for the most common use cases.
|
|
508
|
-
|
|
509
|
-
| Tool | Purpose |
|
|
510
|
-
| :--- | :--- |
|
|
511
|
-
| `SerperDevTool` | Google search via Serper API |
|
|
512
|
-
| `ScrapeWebsiteTool` | Scrape a single URL and return cleaned text |
|
|
513
|
-
| `FileReadTool` | Read a file from disk with size limit |
|
|
514
|
-
| `FileWriteTool` | Write a string to a file |
|
|
515
|
-
| `DirectoryReadTool` | List and read files in a directory |
|
|
516
|
-
| `DirectorySearchTool` | Recursively search a directory by content |
|
|
517
|
-
| `CodeInterpreterTool` | Execute Python in a sandbox (use E2B or Modal) |
|
|
518
|
-
| `RagTool` | Retrieval-augmented generation over a knowledge base |
|
|
519
|
-
| `TXTSearchTool` | RAG over local `.txt` files |
|
|
520
|
-
| `CSVSearchTool` | RAG over local `.csv` files |
|
|
521
|
-
| `JSONSearchTool` | RAG over local `.json` files |
|
|
522
|
-
| `MDXSearchTool` | RAG over local `.mdx` files |
|
|
523
|
-
| `PDFSearchTool` | RAG over local `.pdf` files |
|
|
524
|
-
| `PGSearchTool` | RAG over a PostgreSQL table |
|
|
525
|
-
| `WebsiteSearchTool` | RAG over a website (crawl + index) |
|
|
526
|
-
| `YoutubeVideoSearchTool` | RAG over a YouTube video transcript |
|
|
527
|
-
| `GithubSearchTool` | Search GitHub repos, code, issues |
|
|
528
|
-
| `SnowflakeSearchTool` | Query a Snowflake warehouse |
|
|
529
|
-
| `StripeTool` | Stripe API helpers |
|
|
530
|
-
| `ExaSearchTool` | Neural search via Exa |
|
|
531
|
-
| `FirecrawlScrapeWebsiteTool` | Crawl & scrape with Firecrawl |
|
|
532
|
-
|
|
533
|
-
### Custom tools
|
|
534
|
-
|
|
535
|
-
Implement the `BaseTool` interface to add your own.
|
|
536
|
-
|
|
537
|
-
```python
|
|
538
|
-
from crewai.tools import BaseTool
|
|
539
|
-
from pydantic import Field
|
|
540
|
-
|
|
541
|
-
class MyJiraSearchTool(BaseTool):
|
|
542
|
-
name: str = "Jira Search"
|
|
543
|
-
description: str = "Search Jira issues by JQL query string."
|
|
544
|
-
|
|
545
|
-
jira_url: str = Field(...)
|
|
546
|
-
api_token: str = Field(...)
|
|
547
|
-
|
|
548
|
-
def _run(self, query: str) -> str:
|
|
549
|
-
# Make the API call, return a string the agent can read.
|
|
550
|
-
...
|
|
551
|
-
return results
|
|
552
|
-
```
|
|
553
|
-
|
|
554
|
-
Register it on an agent:
|
|
555
|
-
|
|
556
|
-
```python
|
|
557
|
-
jira_tool = MyJiraSearchTool(jira_url=..., api_token=...)
|
|
558
|
-
agent = Agent(role="...", tools=[jira_tool], ...)
|
|
559
|
-
```
|
|
560
|
-
|
|
561
|
-
## LLM providers
|
|
562
|
-
|
|
563
|
-
CrewAI integrates with multiple LLM providers through native SDKs (OpenAI, Anthropic, Google, Azure, AWS Bedrock, Snowflake) and LiteLLM for everything else.
|
|
564
|
-
|
|
565
|
-
### Native providers
|
|
566
|
-
|
|
567
|
-
| Provider | Env var | Example model string |
|
|
568
|
-
| :--- | :--- | :--- |
|
|
569
|
-
| OpenAI | `OPENAI_API_KEY` | `openai/gpt-4o` |
|
|
570
|
-
| Anthropic | `ANTHROPIC_API_KEY` | `anthropic/claude-sonnet-4-6` |
|
|
571
|
-
| Google Gemini | `GOOGLE_API_KEY` | `gemini/gemini-2.5-pro` |
|
|
572
|
-
| Azure | `AZURE_API_KEY`, `AZURE_ENDPOINT` | `azure/gpt-4o` |
|
|
573
|
-
| AWS Bedrock | `AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY` | `bedrock/us.anthropic.claude-sonnet-4-6` |
|
|
574
|
-
| Snowflake Cortex | `SNOWFLOKE_PAT` | `snowflake/openai-gpt-4.1` |
|
|
575
|
-
|
|
576
|
-
### LiteLLM-powered providers
|
|
577
|
-
|
|
578
|
-
| Provider | Env var | Example model string |
|
|
579
|
-
| :--- | :--- | :--- |
|
|
580
|
-
| Groq | `GROQ_API_KEY` | `groq/llama-3.3-70b-versatile` |
|
|
581
|
-
| Mistral | `MISTRAL_API_KEY` | `mistral/mistral-large-latest` |
|
|
582
|
-
| Ollama (local) | _none_ | `ollama/llama3.2` |
|
|
583
|
-
| Hugging Face | `HF_TOKEN` | `huggingface/meta-llama/Meta-Llama-3.1-8B-Instruct` |
|
|
584
|
-
| Fireworks AI | `FIREWORKS_API_KEY` | `fireworks_ai/accounts/fireworks/models/llama-v3-70b-instruct` |
|
|
585
|
-
| Perplexity | `PERPLEXITY_API_KEY` | `perplexity/sonar-pro` |
|
|
586
|
-
| Cerebras | `CEREBRAS_API_KEY` | `cerebras/gpt-oss-120b` |
|
|
587
|
-
| OpenRouter | `OPENROUTER_API_KEY` | `openrouter/deepseek/deepseek-r1` |
|
|
588
|
-
| Nvidia NIM | `NVIDIA_API_KEY` | `nvidia_nim/nvidia/nemotron-3-ultra-550b-a55b` |
|
|
589
|
-
|
|
590
|
-
### Reasoning models
|
|
591
|
-
|
|
592
|
-
For reasoning models (OpenAI `o-series`, Anthropic `claude-sonnet-4-6` with extended thinking), pass model-specific parameters through `LLM(...)`:
|
|
593
|
-
|
|
594
|
-
```python
|
|
595
|
-
from crewai import LLM
|
|
596
|
-
|
|
597
|
-
# OpenAI reasoning
|
|
598
|
-
llm = LLM(model="openai/o3", reasoning_effort="high")
|
|
599
|
-
|
|
600
|
-
# Anthropic extended thinking
|
|
601
|
-
llm = LLM(
|
|
602
|
-
model="anthropic/claude-sonnet-4-6",
|
|
603
|
-
thinking={"type": "enabled", "budget_tokens": 5000},
|
|
604
|
-
max_tokens=10000,
|
|
605
|
-
)
|
|
606
|
-
```
|
|
607
|
-
|
|
608
|
-
> Some reasoning models **ignore** `temperature` and `top_p`. Treat these as no-ops and use the model's reasoning controls instead.
|
|
609
|
-
|
|
610
|
-
### Drop unsupported params
|
|
611
|
-
|
|
612
|
-
If a model rejects `stop`, `top_p`, or other legacy params, drop them:
|
|
613
|
-
|
|
614
|
-
```python
|
|
615
|
-
llm = LLM(
|
|
616
|
-
model="openai/o3",
|
|
617
|
-
drop_params=True,
|
|
618
|
-
additional_drop_params=["stop"],
|
|
619
|
-
)
|
|
620
|
-
```
|
|
621
|
-
|
|
622
|
-
## Flows
|
|
623
|
-
|
|
624
|
-
A **Flow** is the higher-level orchestration primitive. Use it when you need:
|
|
625
|
-
|
|
626
|
-
- Stateful workflows that persist across multiple Crew executions.
|
|
627
|
-
- Conditional branching based on Crew outputs.
|
|
628
|
-
- Long-running processes (cron jobs, event listeners, async pipelines).
|
|
629
|
-
- Audit trails and step-level logging.
|
|
630
|
-
|
|
631
|
-
### Minimal Flow
|
|
632
|
-
|
|
633
|
-
```python
|
|
634
|
-
from crewai.flow.flow import Flow, listen, start
|
|
635
|
-
|
|
636
|
-
class ResearchFlow(Flow):
|
|
637
|
-
@start()
|
|
638
|
-
def generate_topic(self):
|
|
639
|
-
return "CrewAI multi-agent patterns"
|
|
640
|
-
|
|
641
|
-
@listen(generate_topic)
|
|
642
|
-
def run_crew(self, topic):
|
|
643
|
-
result = research_crew.kickoff(inputs={"topic": topic})
|
|
644
|
-
return result.raw
|
|
645
|
-
```
|
|
646
|
-
|
|
647
|
-
The `@start()` decorator marks the entry point; `@listen(method_name)` chains steps and receives the previous step's return value. Flows can also `or_`, `and_`, and branch based on conditions.
|
|
648
|
-
|
|
649
|
-
## Getting started
|
|
650
|
-
|
|
651
|
-
### Install
|
|
652
|
-
|
|
653
|
-
```bash
|
|
654
|
-
# Core framework
|
|
655
|
-
pip install crewai
|
|
656
|
-
|
|
657
|
-
# Optional: tool package
|
|
658
|
-
pip install 'crewai[tools]'
|
|
659
|
-
|
|
660
|
-
# Optional: every LLM provider via LiteLLM
|
|
661
|
-
pip install 'crewai[litellm]'
|
|
662
|
-
```
|
|
663
|
-
|
|
664
|
-
### Minimal crew (sequential)
|
|
665
|
-
|
|
666
|
-
```python
|
|
667
|
-
from crewai import Agent, Crew, Process, Task
|
|
668
|
-
from crewai_tools import SerperDevTool
|
|
669
|
-
|
|
670
|
-
researcher = Agent(
|
|
671
|
-
role="Researcher",
|
|
672
|
-
goal="Find the most cited papers on {topic}",
|
|
673
|
-
backstory="Senior research analyst",
|
|
674
|
-
tools=[SerperDevTool()],
|
|
675
|
-
)
|
|
676
|
-
|
|
677
|
-
writer = Agent(
|
|
678
|
-
role="Writer",
|
|
679
|
-
goal="Draft a 500-word summary",
|
|
680
|
-
backstory="Technical writer",
|
|
681
|
-
)
|
|
682
|
-
|
|
683
|
-
research_task = Task(
|
|
684
|
-
description="Summarize the top three results on {topic}",
|
|
685
|
-
expected_output="Bullet list of three findings",
|
|
686
|
-
agent=researcher,
|
|
687
|
-
)
|
|
688
|
-
|
|
689
|
-
draft = Task(
|
|
690
|
-
description="Write a 500-word article using the research",
|
|
691
|
-
expected_output="Polished article",
|
|
692
|
-
agent=writer,
|
|
693
|
-
context=[research_task],
|
|
694
|
-
)
|
|
695
|
-
|
|
696
|
-
crew = Crew(
|
|
697
|
-
agents=[researcher, writer],
|
|
698
|
-
tasks=[research_task, draft],
|
|
699
|
-
process=Process.sequential,
|
|
700
|
-
)
|
|
701
|
-
|
|
702
|
-
result = crew.kickoff(inputs={"topic": "CrewAI"})
|
|
703
|
-
print(result.raw)
|
|
704
|
-
```
|
|
705
|
-
|
|
706
|
-
### Project scaffold
|
|
707
|
-
|
|
708
|
-
The CLI scaffolds a working project. It asks for an LLM provider and writes a `crew.jsonc`, `agents/`, `tasks/`, and `tools/` directory.
|
|
709
|
-
|
|
710
|
-
```bash
|
|
711
|
-
crewai create crew my_research_crew
|
|
712
|
-
cd my_research_crew
|
|
713
|
-
crewai run
|
|
714
|
-
```
|
|
715
|
-
|
|
716
|
-
To scaffold the classic YAML/Python form instead:
|
|
717
|
-
|
|
718
|
-
```bash
|
|
719
|
-
crewai create crew my_research_crew --classic
|
|
720
|
-
```
|
|
721
|
-
|
|
722
|
-
## Production tips
|
|
723
|
-
|
|
724
|
-
These patterns come up repeatedly in production deployments.
|
|
725
|
-
|
|
726
|
-
### 1. Pin LiteLLM
|
|
727
|
-
|
|
728
|
-
```toml
|
|
729
|
-
# pyproject.toml
|
|
730
|
-
crewai = ">=1.6,<2.0"
|
|
731
|
-
litellm = ">=1.40,<2.0"
|
|
732
|
-
```
|
|
733
|
-
|
|
734
|
-
LiteLLM is a fast-moving target. Some model features (vision, JSON-schema tools, reasoning controls) need a recent LiteLLM version.
|
|
735
|
-
|
|
736
|
-
### 2. Set guardrails everywhere
|
|
737
|
-
|
|
738
|
-
A guardrail is cheap. A missed guardrail in production is not.
|
|
739
|
-
|
|
740
|
-
```python
|
|
741
|
-
def must_include_citation(result: TaskOutput) -> Tuple[bool, Any]:
|
|
742
|
-
if "http" not in result.raw and "doi:" not in result.raw:
|
|
743
|
-
return (False, "Output must cite a source URL or DOI")
|
|
744
|
-
return (True, result.raw)
|
|
745
|
-
|
|
746
|
-
blog_task = Task(
|
|
747
|
-
description=...,
|
|
748
|
-
expected_output=...,
|
|
749
|
-
agent=writer,
|
|
750
|
-
guardrail=must_include_citation,
|
|
751
|
-
guardrail_max_retries=3,
|
|
752
|
-
)
|
|
753
|
-
```
|
|
754
|
-
|
|
755
|
-
### 3. Log step_callback for observability
|
|
756
|
-
|
|
757
|
-
```python
|
|
758
|
-
import logging
|
|
759
|
-
|
|
760
|
-
logger = logging.getLogger("crew")
|
|
761
|
-
|
|
762
|
-
def step_logger(step_output):
|
|
763
|
-
logger.info("step complete: %s", step_output)
|
|
764
|
-
|
|
765
|
-
crew = Crew(agents=[...], tasks=[...], step_callback=step_logger)
|
|
766
|
-
```
|
|
767
|
-
|
|
768
|
-
Pair with OpenTelemetry by setting `tracing=True` and configuring `OTEL_EXPORTER_OTLP_ENDPOINT`.
|
|
769
|
-
|
|
770
|
-
### 4. Use async kickoff for I/O-bound crews
|
|
771
|
-
|
|
772
|
-
```python
|
|
773
|
-
results = await asyncio.gather(
|
|
774
|
-
crew_a.kickoff_async(inputs={"topic": "A"}),
|
|
775
|
-
crew_b.kickoff_async(inputs={"topic": "B"}),
|
|
776
|
-
)
|
|
777
|
-
```
|
|
778
|
-
|
|
779
|
-
Native `akickoff()` is preferred over `kickoff_async()` — the latter is a thread-based wrapper.
|
|
780
|
-
|
|
781
|
-
### 5. Cache aggressively in dev, sparingly in prod
|
|
782
|
-
|
|
783
|
-
```python
|
|
784
|
-
crew = Crew(agents=[...], tasks=[...], cache=True) # dev: free
|
|
785
|
-
crew = Crew(agents=[...], tasks=[...], cache=False) # prod: avoid stale results
|
|
786
|
-
```
|
|
787
|
-
|
|
788
|
-
## Caveats
|
|
789
|
-
|
|
790
|
-
- **Token cost is real.** A 3-agent crew with delegation can multiply a single user's prompt by 5–10x. Hierarchical mode compounds this. Set `max_iter` and `max_rpm` aggressively.
|
|
791
|
-
- **Debugging is verbose.** A failed delegation chain prints a lot of agent chatter. Bring a structured logger; tail the `CrewAI` namespace.
|
|
792
|
-
- **LiteLLM is a fast-moving target.** Some model features (vision, tools with JSON schema) need a recent LiteLLM version. Pin both packages.
|
|
793
|
-
- **Not a DAG runner.** If your task graph is strictly acyclic and you want deterministic execution, LangGraph or a custom orchestrator is a better fit.
|
|
794
|
-
- **`allow_code_execution` is deprecated.** Use `CodeInterpreterTool` with E2B or Modal for sandboxed code execution.
|
|
795
|
-
- **JSONC config has no schema validation.** A typo in `crew.jsonc` is a runtime error. Use `crewai validate` before deploying.
|
|
796
|
-
|
|
797
|
-
## Deployment notes
|
|
798
|
-
|
|
799
|
-
### Docker
|
|
800
|
-
|
|
801
|
-
```dockerfile
|
|
802
|
-
FROM python:3.12-slim
|
|
803
|
-
|
|
804
|
-
WORKDIR /app
|
|
805
|
-
COPY pyproject.toml uv.lock ./
|
|
806
|
-
RUN pip install uv && uv sync --frozen
|
|
807
|
-
|
|
808
|
-
COPY src ./src
|
|
809
|
-
COPY agents ./agents
|
|
810
|
-
COPY tasks ./tasks
|
|
811
|
-
COPY crew.jsonc ./
|
|
812
|
-
|
|
813
|
-
ENV CREWAI_STORAGE_DIR=/app/.crewai
|
|
814
|
-
CMD ["crewai", "run"]
|
|
815
|
-
```
|
|
816
|
-
|
|
817
|
-
### Environment variables
|
|
818
|
-
|
|
819
|
-
| Variable | Required for |
|
|
820
|
-
| :--- | :--- |
|
|
821
|
-
| `OPENAI_API_KEY` | OpenAI provider |
|
|
822
|
-
| `ANTHROPIC_API_KEY` | Anthropic provider |
|
|
823
|
-
| `MODEL` | Default model when not set on the agent |
|
|
824
|
-
| `CREWAI_STORAGE_DIR` | Memory storage path |
|
|
825
|
-
| `OTEL_EXPORTER_OTLP_ENDPOINT` | OpenTelemetry export |
|
|
826
|
-
| `CREWAI_TRACING_ENABLED` | Toggle tracing |
|
|
827
|
-
|
|
828
|
-
### Resources
|
|
829
|
-
|
|
830
|
-
| Resource | Quantity |
|
|
831
|
-
| :--- | :--- |
|
|
832
|
-
| CPU | 1+ vCPU |
|
|
833
|
-
| Memory | 512 MB minimum, 2 GB recommended |
|
|
834
|
-
| Storage | 1 GB for memory + logs |
|
|
835
|
-
| Network | Outbound HTTPS to LLM provider |
|
|
836
|
-
| Tokens | Dominates over compute cost |
|
|
837
|
-
|
|
838
|
-
## FAQ
|
|
839
|
-
|
|
840
|
-
<details>
|
|
841
|
-
<summary><strong>When should I use a Flow instead of a Crew?</strong></summary>
|
|
842
|
-
|
|
843
|
-
Use a Crew for one-shot or short-lived multi-agent work. Use a Flow when you need persistent state, branching on outputs, retries, or long-running processes that span multiple Crew invocations. For production, start with a Flow and call Crews from inside it.
|
|
844
|
-
</details>
|
|
845
|
-
|
|
846
|
-
<details>
|
|
847
|
-
<summary><strong>Can I run a Crew without a manager_llm in hierarchical mode?</strong></summary>
|
|
848
|
-
|
|
849
|
-
No. Hierarchical mode requires either `manager_llm` (a model string) or `manager_agent` (a custom `BaseAgent` instance). If neither is set, the crew falls back to sequential mode at runtime.
|
|
850
|
-
</details>
|
|
851
|
-
|
|
852
|
-
<details>
|
|
853
|
-
<summary><strong>How do I handle rate limits?</strong></summary>
|
|
854
|
-
|
|
855
|
-
Set `max_rpm` on the agent or the crew. The framework will throttle calls to stay under the limit. For backoff-and-retry on `429` responses, set `max_retry_limit` on the agent.
|
|
856
|
-
</details>
|
|
857
|
-
|
|
858
|
-
<details>
|
|
859
|
-
<summary><strong>Can I use local models?</strong></summary>
|
|
860
|
-
|
|
861
|
-
Yes — any LiteLLM-supported provider works. For Ollama, set `ollama/llama3.2` (or another model) and pass `base_url="http://localhost:11434"` if Ollama is not on the default port.
|
|
862
|
-
</details>
|
|
863
|
-
|
|
864
|
-
<details>
|
|
865
|
-
<summary><strong>How do I debug a stuck crew?</strong></summary>
|
|
866
|
-
|
|
867
|
-
Set `verbose=True` on the Crew and on each Agent. Inspect `crew_output.tasks_output` for per-task raw output. Use `step_callback` to log every step. For deeper inspection, enable `tracing=True` and view the trace in your OpenTelemetry collector.
|
|
868
|
-
</details>
|
|
869
|
-
|
|
870
|
-
## When to choose CrewAI
|
|
871
|
-
|
|
872
|
-
Pick CrewAI if:
|
|
873
|
-
|
|
874
|
-
- ✅ You want role-based, multi-agent collaboration out of the box.
|
|
875
|
-
- ✅ You want YAML/JSONC configuration that version-controls your agent team.
|
|
876
|
-
- ✅ You need delegation, hierarchical coordination, or guardrails.
|
|
877
|
-
- ✅ You want a stable, well-maintained library with a large community.
|
|
878
|
-
|
|
879
|
-
Look elsewhere if:
|
|
880
|
-
|
|
881
|
-
- ❌ You need a strict DAG executor (use [LangGraph](https://langchain-ai.github.io/langgraph/) or [Prefect](https://prefect.io/)).
|
|
882
|
-
- ❌ You need type-safe graphs in TypeScript (use [Inngest](https://www.inngest.com/) or [temporal.io](https://temporal.io/)).
|
|
883
|
-
- ❌ Your workload is one agent + tools (a raw LiteLLM loop is enough).
|
|
884
|
-
- ❌ You need fine-grained GPU control or a fully local stack — combine with [Ollama](https://ollama.com/) but verify compatibility.
|
|
885
|
-
|
|
886
|
-
## Related projects
|
|
887
|
-
|
|
888
|
-
CrewAI sits in a wider ecosystem. Adjacent tools to consider:
|
|
889
|
-
|
|
890
|
-
- **[LangGraph](https://langchain-ai.github.io/langgraph/)** — graph-based orchestration with explicit state and cycles.
|
|
891
|
-
- **[AutoGen](https://github.com/microsoft/autogen)** — Microsoft's multi-agent framework with conversation-first design.
|
|
892
|
-
- **[LlamaIndex](https://www.llamaindex.com/)** — data framework for RAG; pairs well with CrewAI for knowledge-heavy agents.
|
|
893
|
-
- **[Dify](https://dify.ai/)** — visual LLM app builder with agent nodes.
|
|
894
|
-
- **[Flowise](https://flowiseai.com/)** — drag-and-drop LangChain UI; great for non-developers.
|
|
895
|
-
|
|
896
|
-
---
|
|
897
|
-
|
|
898
|
-
<sub>Last reviewed by the Grove curators on <time datetime="2026-08-10">2026-08-10</time>. Press <kbd>Ctrl</kbd>+<kbd>C</kbd> in the `crewai chat` REPL to exit. Found an outdated section? Open an issue at <https://github.com/tortuvshin/grove>.</sub>
|