mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-07 15:18:29 +00:00
* docs: Fix major memory system documentation issues - Remove misleading deprecation warnings, fix confusing comments, clearly separate three memory approaches, provide accurate examples that match implementation * fix: Correct broken image paths in README - Update crewai_logo.png and asset.png paths to point to docs/images/ directory instead of docs/ directly * docs: Add system prompt transparency and customization guide - Add 'Understanding Default System Instructions' section to address black-box concerns - Document what CrewAI automatically injects into prompts - Provide code examples to inspect complete system prompts - Show 3 methods to override default instructions - Include observability integration examples with Langfuse - Add best practices for production prompt management * docs: Fix implementation accuracy issues in memory documentation - Fix Ollama embedding URL parameter and remove unsupported Cohere input_type parameter * docs: Reference observability docs instead of showing specific tool examples * docs: Reorganize knowledge documentation for better developer experience - Move quickstart examples right after overview for immediate hands-on experience - Create logical learning progression: basics → configuration → advanced → troubleshooting - Add comprehensive agent vs crew knowledge guide with working examples - Consolidate debugging and troubleshooting in dedicated section - Organize best practices by topic in accordion format - Improve content flow from simple concepts to advanced features - Ensure all examples are grounded in actual codebase implementation * docs: enhance custom LLM documentation with comprehensive examples and accurate imports * docs: reorganize observability tools into dedicated section with comprehensive overview and improved navigation * docs: rename how-to section to learn and add comprehensive overview page * docs: finalize documentation reorganization and update navigation labels * docs: enhance README with comprehensive badges, navigation links, and getting started video
127 lines
4.6 KiB
Plaintext
127 lines
4.6 KiB
Plaintext
---
|
|
title: Sequential Processes
|
|
description: A comprehensive guide to utilizing the sequential processes for task execution in CrewAI projects.
|
|
icon: forward
|
|
---
|
|
|
|
## Introduction
|
|
|
|
CrewAI offers a flexible framework for executing tasks in a structured manner, supporting both sequential and hierarchical processes.
|
|
This guide outlines how to effectively implement these processes to ensure efficient task execution and project completion.
|
|
|
|
## Sequential Process Overview
|
|
|
|
The sequential process ensures tasks are executed one after the other, following a linear progression.
|
|
This approach is ideal for projects requiring tasks to be completed in a specific order.
|
|
|
|
### Key Features
|
|
|
|
- **Linear Task Flow**: Ensures orderly progression by handling tasks in a predetermined sequence.
|
|
- **Simplicity**: Best suited for projects with clear, step-by-step tasks.
|
|
- **Easy Monitoring**: Facilitates easy tracking of task completion and project progress.
|
|
|
|
## Implementing the Sequential Process
|
|
|
|
To use the sequential process, assemble your crew and define tasks in the order they need to be executed.
|
|
|
|
```python Code
|
|
from crewai import Crew, Process, Agent, Task, TaskOutput, CrewOutput
|
|
|
|
# Define your agents
|
|
researcher = Agent(
|
|
role='Researcher',
|
|
goal='Conduct foundational research',
|
|
backstory='An experienced researcher with a passion for uncovering insights'
|
|
)
|
|
analyst = Agent(
|
|
role='Data Analyst',
|
|
goal='Analyze research findings',
|
|
backstory='A meticulous analyst with a knack for uncovering patterns'
|
|
)
|
|
writer = Agent(
|
|
role='Writer',
|
|
goal='Draft the final report',
|
|
backstory='A skilled writer with a talent for crafting compelling narratives'
|
|
)
|
|
|
|
# Define your tasks
|
|
research_task = Task(
|
|
description='Gather relevant data...',
|
|
agent=researcher,
|
|
expected_output='Raw Data'
|
|
)
|
|
analysis_task = Task(
|
|
description='Analyze the data...',
|
|
agent=analyst,
|
|
expected_output='Data Insights'
|
|
)
|
|
writing_task = Task(
|
|
description='Compose the report...',
|
|
agent=writer,
|
|
expected_output='Final Report'
|
|
)
|
|
|
|
# Form the crew with a sequential process
|
|
report_crew = Crew(
|
|
agents=[researcher, analyst, writer],
|
|
tasks=[research_task, analysis_task, writing_task],
|
|
process=Process.sequential
|
|
)
|
|
|
|
# Execute the crew
|
|
result = report_crew.kickoff()
|
|
|
|
# Accessing the type-safe output
|
|
task_output: TaskOutput = result.tasks[0].output
|
|
crew_output: CrewOutput = result.output
|
|
```
|
|
|
|
### Note:
|
|
|
|
Each task in a sequential process **must** have an agent assigned. Ensure that every `Task` includes an `agent` parameter.
|
|
|
|
### Workflow in Action
|
|
|
|
1. **Initial Task**: In a sequential process, the first agent completes their task and signals completion.
|
|
2. **Subsequent Tasks**: Agents pick up their tasks based on the process type, with outcomes of preceding tasks or directives guiding their execution.
|
|
3. **Completion**: The process concludes once the final task is executed, leading to project completion.
|
|
|
|
## Advanced Features
|
|
|
|
### Task Delegation
|
|
|
|
In sequential processes, if an agent has `allow_delegation` set to `True`, they can delegate tasks to other agents in the crew.
|
|
This feature is automatically set up when there are multiple agents in the crew.
|
|
|
|
### Asynchronous Execution
|
|
|
|
Tasks can be executed asynchronously, allowing for parallel processing when appropriate.
|
|
To create an asynchronous task, set `async_execution=True` when defining the task.
|
|
|
|
### Memory and Caching
|
|
|
|
CrewAI supports both memory and caching features:
|
|
|
|
- **Memory**: Enable by setting `memory=True` when creating the Crew. This allows agents to retain information across tasks.
|
|
- **Caching**: By default, caching is enabled. Set `cache=False` to disable it.
|
|
|
|
### Callbacks
|
|
|
|
You can set callbacks at both the task and step level:
|
|
|
|
- `task_callback`: Executed after each task completion.
|
|
- `step_callback`: Executed after each step in an agent's execution.
|
|
|
|
### Usage Metrics
|
|
|
|
CrewAI tracks token usage across all tasks and agents. You can access these metrics after execution.
|
|
|
|
## Best Practices for Sequential Processes
|
|
|
|
1. **Order Matters**: Arrange tasks in a logical sequence where each task builds upon the previous one.
|
|
2. **Clear Task Descriptions**: Provide detailed descriptions for each task to guide the agents effectively.
|
|
3. **Appropriate Agent Selection**: Match agents' skills and roles to the requirements of each task.
|
|
4. **Use Context**: Leverage the context from previous tasks to inform subsequent ones.
|
|
|
|
This updated documentation ensures that details accurately reflect the latest changes in the codebase and clearly describes how to leverage new features and configurations.
|
|
The content is kept simple and direct to ensure easy understanding. |