Skip to content

Commit 2f48937

Browse files
authored
docs(crews): document missing params and add Checkpointing section (OSS-32) (#5409)
- Add 8 missing parameters to the Crew Attributes table: chat_llm, before_kickoff_callbacks, after_kickoff_callbacks, tracing, skills, security_config, checkpoint - Add new "## Checkpointing" section before "## Memory Utilization" with: - Quick-start checkpoint=True example - Full CheckpointConfig usage example - Crew.from_checkpoint() resume pattern - CheckpointConfig attributes table (location, on_events, provider, max_checkpoints) - Note on auto-restored checkpoint fields Closes OSS-32
1 parent c5192b9 commit 2f48937

1 file changed

Lines changed: 74 additions & 1 deletion

File tree

docs/en/concepts/crews.mdx

Lines changed: 74 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,14 @@ A crew in crewAI represents a collaborative group of agents working together to
3333
| **Planning** *(optional)* | `planning` | Adds planning ability to the Crew. When activated before each Crew iteration, all Crew data is sent to an AgentPlanner that will plan the tasks and this plan will be added to each task description. |
3434
| **Planning LLM** *(optional)* | `planning_llm` | The language model used by the AgentPlanner in a planning process. |
3535
| **Knowledge Sources** _(optional)_ | `knowledge_sources` | Knowledge sources available at the crew level, accessible to all the agents. |
36-
| **Stream** _(optional)_ | `stream` | Enable streaming output to receive real-time updates during crew execution. Returns a `CrewStreamingOutput` object that can be iterated for chunks. Defaults to `False`. |
36+
| **Stream** _(optional)_ | `stream` | Enable streaming output to receive real-time updates during crew execution. Returns a `CrewStreamingOutput` object that can be iterated for chunks. Defaults to `False`. |
37+
| **Chat LLM** _(optional)_ | `chat_llm` | The language model used to orchestrate `crewai chat` CLI interactions with the crew. Accepts a model name string or `LLM` instance. Defaults to `None`. |
38+
| **Before Kickoff Callbacks** _(optional)_ | `before_kickoff_callbacks` | A list of callable functions executed **before** the crew starts. Each callback receives and can modify the inputs dict. Distinct from the `@before_kickoff` decorator. Defaults to `[]`. |
39+
| **After Kickoff Callbacks** _(optional)_ | `after_kickoff_callbacks` | A list of callable functions executed **after** the crew finishes. Each callback receives and can modify the `CrewOutput`. Distinct from the `@after_kickoff` decorator. Defaults to `[]`. |
40+
| **Tracing** _(optional)_ | `tracing` | Controls OpenTelemetry tracing for the crew. `True` = always enable, `False` = always disable, `None` = inherit from environment / user settings. Defaults to `None`. |
41+
| **Skills** _(optional)_ | `skills` | A list of `Path` objects (skill search directories) or pre-loaded `Skill` objects applied to all agents in the crew. Defaults to `None`. |
42+
| **Security Config** _(optional)_ | `security_config` | A `SecurityConfig` instance managing crew fingerprinting and identity. Defaults to `SecurityConfig()`. |
43+
| **Checkpoint** _(optional)_ | `checkpoint` | Enables automatic checkpointing. Pass `True` for sensible defaults, a `CheckpointConfig` for full control, `False` to opt out, or `None` to inherit. See the [Checkpointing](#checkpointing) section below. Defaults to `None`. |
3744

3845
<Tip>
3946
**Crew Max RPM**: The `max_rpm` attribute sets the maximum number of requests per minute the crew can perform to avoid rate limits and will override individual agents' `max_rpm` settings if you set it.
@@ -271,6 +278,72 @@ crew = Crew(output_log_file = file_name.json) # Logs will be saved as file_name
271278

272279

273280

281+
## Checkpointing
282+
283+
Checkpointing lets a crew automatically save its state after key events (e.g. task completion) so that long-running or interrupted runs can be resumed exactly where they left off without re-executing completed tasks.
284+
285+
### Quick Start
286+
287+
Pass `checkpoint=True` to enable checkpointing with sensible defaults (saves to `.checkpoints/` after every task):
288+
289+
```python Code
290+
from crewai import Crew, Process
291+
292+
crew = Crew(
293+
agents=[researcher, writer],
294+
tasks=[research_task, write_task],
295+
process=Process.sequential,
296+
checkpoint=True, # saves to .checkpoints/ after every task
297+
)
298+
299+
crew.kickoff(inputs={"topic": "AI trends"})
300+
```
301+
302+
### Full Control with `CheckpointConfig`
303+
304+
Use `CheckpointConfig` for fine-grained control over location, trigger events, storage backend, and retention:
305+
306+
```python Code
307+
from crewai import Crew, Process
308+
from crewai.state.checkpoint_config import CheckpointConfig
309+
310+
crew = Crew(
311+
agents=[researcher, writer],
312+
tasks=[research_task, write_task],
313+
process=Process.sequential,
314+
checkpoint=CheckpointConfig(
315+
location="./.checkpoints", # directory for JSON files (default)
316+
on_events=["task_completed"], # trigger after each task (default)
317+
max_checkpoints=5, # keep only the 5 most recent checkpoints
318+
),
319+
)
320+
321+
crew.kickoff(inputs={"topic": "AI trends"})
322+
```
323+
324+
### Resuming from a Checkpoint
325+
326+
Use `Crew.from_checkpoint()` to restore a crew from a saved checkpoint file, then call `kickoff()` to resume:
327+
328+
```python Code
329+
# Resume from the most recent checkpoint
330+
crew = Crew.from_checkpoint(".checkpoints/latest.json")
331+
crew.kickoff()
332+
```
333+
334+
<Note>
335+
When restoring from a checkpoint, `checkpoint_inputs`, `checkpoint_train`, and `checkpoint_kickoff_event_id` are automatically reconstructed — you do not need to set these manually.
336+
</Note>
337+
338+
### `CheckpointConfig` Attributes
339+
340+
| Attribute | Type | Default | Description |
341+
| :----------------- | :------------------------------------- | :------------------- | :-------------------------------------------------------------------------------------------- |
342+
| `location` | `str` | `"./.checkpoints"` | Storage destination. For `JsonProvider` this is a directory path; for `SqliteProvider` a database file path. |
343+
| `on_events` | `list[str]` | `["task_completed"]` | Event types that trigger a checkpoint write. Use `["*"]` to checkpoint on every event. |
344+
| `provider` | `JsonProvider \| SqliteProvider` | `JsonProvider()` | Storage backend. Defaults to `JsonProvider` (plain JSON files). |
345+
| `max_checkpoints` | `int \| None` | `None` | Maximum checkpoints to keep. Oldest are pruned after each write. `None` keeps all. |
346+
274347
## Memory Utilization
275348

276349
Crews can utilize memory (short-term, long-term, and entity memory) to enhance their execution and learning over time. This feature allows crews to store and recall execution memories, aiding in decision-making and task execution strategies.

0 commit comments

Comments
 (0)