From 2740196c0801ec04d6c75839e6f7a5df37213b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Moura?= Date: Wed, 7 Feb 2024 23:09:16 -0800 Subject: [PATCH] Adding new crew specific docs --- docs/core-concepts/Crews.md | 75 +++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 76 insertions(+) create mode 100644 docs/core-concepts/Crews.md diff --git a/docs/core-concepts/Crews.md b/docs/core-concepts/Crews.md new file mode 100644 index 000000000..86226f051 --- /dev/null +++ b/docs/core-concepts/Crews.md @@ -0,0 +1,75 @@ +--- +title: crewAI Crews +description: Understanding and utilizing crews in the crewAI framework. +--- + +## What is a Crew? +!!! note "Definition of a Crew" + A crew in crewAI represents a collaborative group of agents working together to achieve a set of tasks. Each crew defines the strategy for task execution, agent collaboration, and the overall workflow. + +## Crew Attributes + +| Attribute | Description | +| :------------------- | :----------------------------------------------------------- | +| **Tasks** | A list of tasks assigned to the crew. | +| **Agents** | A list of agents that are part of the crew. | +| **Process** | The process flow (e.g., sequential, hierarchical) the crew follows. | +| **Verbose** | The verbosity level for logging during execution. | +| **Manager LLM** | The language model used by the manager agent in a hierarchical process. | +| **Config** | Configuration settings for the crew. | +| **Max RPM** | Maximum requests per minute the crew adheres to during execution. | +| **Language** | Language setting for the crew's operation. | + +!!! note "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. + +## Creating a Crew + +!!! note "Crew Composition" + When assembling a crew, you combine agents with complementary roles and tools, assign tasks, and select a process that dictates their execution order and interaction. + +### Example: Assembling a Crew + +```python +from crewai import Crew, Agent, Task, Process +from langchain_community.tools import DuckDuckGoSearchRun + +# Define agents with specific roles and tools +researcher = Agent( + role='Senior Research Analyst', + goal='Discover innovative AI technologies', + tools=[DuckDuckGoSearchRun()] +) + +writer = Agent( + role='Content Writer', + goal='Write engaging articles on AI discoveries' +) + +# Create tasks for the agents +research_task = Task(description='Identify breakthrough AI technologies', agent=researcher) +write_article_task = Task(description='Draft an article on the latest AI technologies', agent=writer) + +# Assemble the crew with a sequential process +my_crew = Crew( + agents=[researcher, writer], + tasks=[research_task, write_article_task], + process=Process.sequential, + verbose=True +) +``` + +## Crew Execution Process + +- **Sequential Process**: Tasks are executed one after another, allowing for a linear flow of work. +- **Hierarchical Process**: A manager agent coordinates the crew, delegating tasks and validating outcomes before proceeding. + +### Kicking Off a Crew + +Once your crew is assembled, initiate the workflow with the `kickoff()` method. This starts the execution process according to the defined process flow. + +```python +# Start the crew's task execution +result = my_crew.kickoff() +print(result) +``` \ No newline at end of file diff --git a/mkdocs.yml b/mkdocs.yml index b832d78f3..4be09b32a 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -124,6 +124,7 @@ nav: - Tasks: 'core-concepts/Tasks.md' - Tools: 'core-concepts/Tools.md' - Processes: 'core-concepts/Processes.md' + - Crews: 'core-concepts/Crews.md' - Collaboration: 'core-concepts/Collaboration.md' - How to Guides: - Getting Started: 'how-to/Creating-a-Crew-and-kick-it-off.md'