-
+
-# **crewAI**
+# **CrewAI**
-π€ **crewAI**: Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
+π€ **CrewAI**: Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
@@ -44,83 +44,222 @@ To get started with CrewAI, follow these simple steps:
### 1. Installation
+Ensure you have Python >=3.10 <=3.13 installed on your system. CrewAI uses [Poetry](https://python-poetry.org/) for dependency management and package handling, offering a seamless setup and execution experience.
+
+First, if you haven't already, install Poetry:
+
+```bash
+pip install poetry
+```
+
+Then, install CrewAI:
+
```shell
pip install crewai
```
-If you want to install the 'crewai' package along with its optional features that include additional tools for agents, you can do so by using the following command: pip install 'crewai[tools]'. This command installs the basic package and also adds extra components which require more dependencies to function."
+If you want to install the 'crewai' package along with its optional features that include additional tools for agents, you can do so by using the following command:
```shell
pip install 'crewai[tools]'
```
+The command above installs the basic package and also adds extra components which require more dependencies to function.
-### 2. Setting Up Your Crew
+### 2. Setting Up Your Crew with the YAML Configuration
+
+To create a new CrewAI project, run the following CLI (Command Line Interface) command:
+
+```shell
+crewai create crew
+```
+
+This command creates a new project folder with the following structure:
+
+```
+my_project/
+βββ .gitignore
+βββ pyproject.toml
+βββ README.md
+βββ .env
+βββ src/
+ βββ my_project/
+ βββ __init__.py
+ βββ main.py
+ βββ crew.py
+ βββ tools/
+ β βββ custom_tool.py
+ β βββ __init__.py
+ βββ config/
+ βββ agents.yaml
+ βββ tasks.yaml
+```
+
+You can now start developing your crew by editing the files in the `src/my_project` folder. The `main.py` file is the entry point of the project, the `crew.py` file is where you define your crew, the `agents.yaml` file is where you define your agents, and the `tasks.yaml` file is where you define your tasks.
+
+#### To customize your project, you can:
+
+- Modify `src/my_project/config/agents.yaml` to define your agents.
+- Modify `src/my_project/config/tasks.yaml` to define your tasks.
+- Modify `src/my_project/crew.py` to add your own logic, tools, and specific arguments.
+- Modify `src/my_project/main.py` to add custom inputs for your agents and tasks.
+- Add your environment variables into the `.env` file.
+
+#### Example of a simple crew with a sequential process:
+
+Instatiate your crew:
+
+```shell
+crewai create crew latest-ai-development
+```
+
+Modify the files as needed to fit your use case:
+
+**agents.yaml**
+
+```yaml
+# src/my_project/config/agents.yaml
+researcher:
+ role: >
+ {topic} Senior Data Researcher
+ goal: >
+ Uncover cutting-edge developments in {topic}
+ backstory: >
+ You're a seasoned researcher with a knack for uncovering the latest
+ developments in {topic}. Known for your ability to find the most relevant
+ information and present it in a clear and concise manner.
+
+reporting_analyst:
+ role: >
+ {topic} Reporting Analyst
+ goal: >
+ Create detailed reports based on {topic} data analysis and research findings
+ backstory: >
+ You're a meticulous analyst with a keen eye for detail. You're known for
+ your ability to turn complex data into clear and concise reports, making
+ it easy for others to understand and act on the information you provide.
+```
+
+**tasks.yaml**
+
+```yaml
+# src/my_project/config/tasks.yaml
+research_task:
+ description: >
+ Conduct a thorough research about {topic}
+ Make sure you find any interesting and relevant information given
+ the current year is 2024.
+ expected_output: >
+ A list with 10 bullet points of the most relevant information about {topic}
+ agent: researcher
+
+reporting_task:
+ description: >
+ Review the context you got and expand each topic into a full section for a report.
+ Make sure the report is detailed and contains any and all relevant information.
+ expected_output: >
+ A fully fledge reports with the mains topics, each with a full section of information.
+ Formatted as markdown without '```'
+ agent: reporting_analyst
+ output_file: report.md
+```
+
+**crew.py**
```python
-import os
-from crewai import Agent, Task, Crew, Process
+# src/my_project/crew.py
+from crewai import Agent, Crew, Process, Task
+from crewai.project import CrewBase, agent, crew, task
from crewai_tools import SerperDevTool
-os.environ["OPENAI_API_KEY"] = "YOUR_API_KEY"
-os.environ["SERPER_API_KEY"] = "Your Key" # serper.dev API key
+@CrewBase
+class LatestAiDevelopmentCrew():
+ """LatestAiDevelopment crew"""
-# It can be a local model through Ollama / LM Studio or a remote
-# model like OpenAI, Mistral, Antrophic or others (https://docs.crewai.com/how-to/LLM-Connections/)
+ @agent
+ def researcher(self) -> Agent:
+ return Agent(
+ config=self.agents_config['researcher'],
+ verbose=True,
+ tools=[SerperDevTool()]
+ )
-# Define your agents with roles and goals
-researcher = Agent(
- role='Senior Research Analyst',
- goal='Uncover cutting-edge developments in AI and data science',
- backstory="""You work at a leading tech think tank.
- Your expertise lies in identifying emerging trends.
- You have a knack for dissecting complex data and presenting actionable insights.""",
- verbose=True,
- allow_delegation=False,
- # You can pass an optional llm attribute specifying what model you wanna use.
- # llm=ChatOpenAI(model_name="gpt-3.5", temperature=0.7),
- tools=[SerperDevTool()]
-)
-writer = Agent(
- role='Tech Content Strategist',
- goal='Craft compelling content on tech advancements',
- backstory="""You are a renowned Content Strategist, known for your insightful and engaging articles.
- You transform complex concepts into compelling narratives.""",
- verbose=True,
- allow_delegation=True
-)
+ @agent
+ def reporting_analyst(self) -> Agent:
+ return Agent(
+ config=self.agents_config['reporting_analyst'],
+ verbose=True
+ )
-# Create tasks for your agents
-task1 = Task(
- description="""Conduct a comprehensive analysis of the latest advancements in AI in 2024.
- Identify key trends, breakthrough technologies, and potential industry impacts.""",
- expected_output="Full analysis report in bullet points",
- agent=researcher
-)
+ @task
+ def research_task(self) -> Task:
+ return Task(
+ config=self.tasks_config['research_task'],
+ )
-task2 = Task(
- description="""Using the insights provided, develop an engaging blog
- post that highlights the most significant AI advancements.
- Your post should be informative yet accessible, catering to a tech-savvy audience.
- Make it sound cool, avoid complex words so it doesn't sound like AI.""",
- expected_output="Full blog post of at least 4 paragraphs",
- agent=writer
-)
+ @task
+ def reporting_task(self) -> Task:
+ return Task(
+ config=self.tasks_config['reporting_task'],
+ output_file='report.md'
+ )
-# Instantiate your crew with a sequential process
-crew = Crew(
- agents=[researcher, writer],
- tasks=[task1, task2],
- verbose=True,
- process = Process.sequential
-)
-
-# Get your crew to work!
-result = crew.kickoff()
-
-print("######################")
-print(result)
+ @crew
+ def crew(self) -> Crew:
+ """Creates the LatestAiDevelopment crew"""
+ return Crew(
+ agents=self.agents, # Automatically created by the @agent decorator
+ tasks=self.tasks, # Automatically created by the @task decorator
+ process=Process.sequential,
+ verbose=True,
+ )
```
+**main.py**
+
+```python
+#!/usr/bin/env python
+# src/my_project/main.py
+import sys
+from latest_ai_development.crew import LatestAiDevelopmentCrew
+
+def run():
+ """
+ Run the crew.
+ """
+ inputs = {
+ 'topic': 'AI Agents'
+ }
+ LatestAiDevelopmentCrew().crew().kickoff(inputs=inputs)
+```
+
+### 3. Running Your Crew
+
+Before running your crew, make sure you have the following keys set as environment variables in your `.env` file:
+
+- An [OpenAI API key](https://platform.openai.com/account/api-keys) (or other LLM API key): `OPENAI_API_KEY=sk-...`
+- A [Serper.dev](https://serper.dev/) API key: `SERPER_API_KEY=YOUR_KEY_HERE`
+
+Lock the dependencies and install them by using the CLI command but first, navigate to your project directory:
+
+```shell
+cd my_project
+crewai install
+```
+
+To run your crew, execute the following command in the root of your project:
+
+```bash
+crewai run
+```
+
+or
+
+```bash
+python src/my_project/main.py
+```
+
+You should see the output in the console and the `report.md` file should be created in the root of your project with the full final report.
+
In addition to the sequential process, you can use the hierarchical process, which automatically assigns a manager to the defined crew to properly coordinate the planning and execution of tasks through delegation and validation of results. [See more about the processes here](https://docs.crewai.com/core-concepts/Processes/).
## Key Features
@@ -131,13 +270,13 @@ In addition to the sequential process, you can use the hierarchical process, whi
- **Processes Driven**: Currently only supports `sequential` task execution and `hierarchical` processes, but more complex processes like consensual and autonomous are being worked on.
- **Save output as file**: Save the output of individual tasks as a file, so you can use it later.
- **Parse output as Pydantic or Json**: Parse the output of individual tasks as a Pydantic model or as a Json if you want to.
-- **Works with Open Source Models**: Run your crew using Open AI or open source models refer to the [Connect crewAI to LLMs](https://docs.crewai.com/how-to/LLM-Connections/) page for details on configuring your agents' connections to models, even ones running locally!
+- **Works with Open Source Models**: Run your crew using Open AI or open source models refer to the [Connect CrewAI to LLMs](https://docs.crewai.com/how-to/LLM-Connections/) page for details on configuring your agents' connections to models, even ones running locally!

## Examples
-You can test different real life examples of AI crews in the [crewAI-examples repo](https://github.com/crewAIInc/crewAI-examples?tab=readme-ov-file):
+You can test different real life examples of AI crews in the [CrewAI-examples repo](https://github.com/crewAIInc/crewAI-examples?tab=readme-ov-file):
- [Landing Page Generator](https://github.com/crewAIInc/crewAI-examples/tree/main/landing_page_generator)
- [Having Human input on the execution](https://docs.crewai.com/how-to/Human-Input-on-Execution)
@@ -168,9 +307,9 @@ You can test different real life examples of AI crews in the [crewAI-examples re
## Connecting Your Crew to a Model
-crewAI supports using various LLMs through a variety of connection options. By default your agents will use the OpenAI API when querying the model. However, there are several other ways to allow your agents to connect to models. For example, you can configure your agents to use a local model via the Ollama tool.
+CrewAI supports using various LLMs through a variety of connection options. By default your agents will use the OpenAI API when querying the model. However, there are several other ways to allow your agents to connect to models. For example, you can configure your agents to use a local model via the Ollama tool.
-Please refer to the [Connect crewAI to LLMs](https://docs.crewai.com/how-to/LLM-Connections/) page for details on configuring you agents' connections to models.
+Please refer to the [Connect CrewAI to LLMs](https://docs.crewai.com/how-to/LLM-Connections/) page for details on configuring you agents' connections to models.
## How CrewAI Compares
@@ -241,7 +380,7 @@ It's pivotal to understand that **NO data is collected** concerning prompts, tas
Data collected includes:
-- Version of crewAI
+- Version of CrewAI
- So we can understand how many users are using the latest version
- Version of Python
- So we can decide on what versions to better support
@@ -266,7 +405,7 @@ Users can opt-in to Further Telemetry, sharing the complete telemetry data by se
## License
-CrewAI is released under the MIT License.
+CrewAI is released under the [MIT License](https://github.com/crewAIInc/crewAI/blob/main/LICENSE).
## Frequently Asked Questions (FAQ)
@@ -299,7 +438,7 @@ A: Yes, CrewAI is open-source and welcomes contributions from the community.
A: CrewAI uses anonymous telemetry to collect usage data for improvement purposes. No sensitive data (like prompts, task descriptions, or API calls) is collected. Users can opt-in to share more detailed data by setting `share_crew=True` on their Crews.
### Q: Where can I find examples of CrewAI in action?
-A: You can find various real-life examples in the [crewAI-examples repository](https://github.com/crewAIInc/crewAI-examples), including trip planners, stock analysis tools, and more.
+A: You can find various real-life examples in the [CrewAI-examples repository](https://github.com/crewAIInc/crewAI-examples), including trip planners, stock analysis tools, and more.
### Q: How can I contribute to CrewAI?
A: Contributions are welcome! You can fork the repository, create a new branch for your feature, add your improvement, and send a pull request. Check the Contribution section in the README for more details.
diff --git a/docs/CNAME b/docs/CNAME
deleted file mode 100644
index e21535791..000000000
--- a/docs/CNAME
+++ /dev/null
@@ -1 +0,0 @@
-docs.crewai.com
\ No newline at end of file
diff --git a/docs/core-concepts/Agents.md b/docs/concepts/agents.mdx
similarity index 81%
rename from docs/core-concepts/Agents.md
rename to docs/concepts/agents.mdx
index 2a1c656b2..16518e626 100644
--- a/docs/core-concepts/Agents.md
+++ b/docs/concepts/agents.mdx
@@ -1,20 +1,23 @@
---
-title: crewAI Agents
-description: What are crewAI Agents and how to use them.
+title: Agents
+description: What are CrewAI Agents and how to use them.
+icon: robot
---
-## What is an Agent?
-!!! note "What is an Agent?"
- An agent is an **autonomous unit** programmed to:
-
-
Perform tasks
-
Make decisions
-
Communicate with other agents
-
-
- Think of an agent as a member of a team, with specific skills and a particular job to do. Agents can have different roles like 'Researcher', 'Writer', or 'Customer Support', each contributing to the overall goal of the crew.
+## What is an agent?
-## Agent Attributes
+An agent is an **autonomous unit** programmed to:
+
+
Perform tasks
+
Make decisions
+
Communicate with other agents
+
+
+
+Think of an agent as a member of a team, with specific skills and a particular job to do. Agents can have different roles like `Researcher`, `Writer`, or `Customer Support`, each contributing to the overall goal of the crew.
+
+
+## Agent attributes
| Attribute | Parameter | Description |
| :------------------------- | :--------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
@@ -30,7 +33,7 @@ description: What are crewAI Agents and how to use them.
| **Verbose** *(optional)* | `verbose` | Setting this to `True` configures the internal logger to provide detailed execution logs, aiding in debugging and monitoring. Default is `False`. |
| **Allow Delegation** *(optional)* | `allow_delegation` | Agents can delegate tasks or questions to one another, ensuring that each task is handled by the most suitable agent. Default is `False`.
| **Step Callback** *(optional)* | `step_callback` | A function that is called after each step of the agent. This can be used to log the agent's actions or to perform other operations. It will overwrite the crew `step_callback`. |
-| **Cache** *(optional)* | `cache` | Indicates if the agent should use a cache for tool usage. Default is `True`. |
+| gbv vbn zzdsxcdsdfc**Cache** *(optional)* | `cache` | Indicates if the agent should use a cache for tool usage. Default is `True`. |
| **System Template** *(optional)* | `system_template` | Specifies the system format for the agent. Default is `None`. |
| **Prompt Template** *(optional)* | `prompt_template` | Specifies the prompt format for the agent. Default is `None`. |
| **Response Template** *(optional)* | `response_template` | Specifies the response format for the agent. Default is `None`. |
@@ -39,25 +42,25 @@ description: What are crewAI Agents and how to use them.
| **Use System Prompt** *(optional)* | `use_system_prompt` | Adds the ability to not use system prompt (to support o1 models). Default is `True`. |
| **Respect Context Window** *(optional)* | `respect_context_window` | Summary strategy to avoid overflowing the context window. Default is `True`. |
-## Creating an Agent
+## Creating an agent
-!!! note "Agent Interaction"
- Agents can interact with each other using crewAI's built-in delegation and communication mechanisms. This allows for dynamic task management and problem-solving within the crew.
+
+ **Agent interaction**: Agents can interact with each other using CrewAI's built-in delegation and communication mechanisms. This allows for dynamic task management and problem-solving within the crew.
+
To create an agent, you would typically initialize an instance of the `Agent` class with the desired properties. Here's a conceptual example including all attributes:
-```python
-# Example: Creating an agent with all attributes
+```python Code example
from crewai import Agent
agent = Agent(
role='Data Analyst',
goal='Extract actionable insights',
backstory="""You're a data analyst at a large company.
- You're responsible for analyzing data and providing insights
- to the business.
- You're currently working on a project to analyze the
- performance of our marketing campaigns.""",
+ You're responsible for analyzing data and providing insights
+ to the business.
+ You're currently working on a project to analyze the
+ performance of our marketing campaigns.""",
tools=[my_tool1, my_tool2], # Optional, defaults to an empty list
llm=my_llm, # Optional
function_calling_llm=my_llm, # Optional
@@ -87,32 +90,31 @@ agent = Agent(
Prompt templates are used to format the prompt for the agent. You can use to update the system, regular and response templates for the agent. Here's an example of how to set prompt templates:
-```python
+```python Code example
agent = Agent(
role="{topic} specialist",
goal="Figure {goal} out",
backstory="I am the master of {role}",
system_template="""<|start_header_id|>system<|end_header_id|>
-
-{{ .System }}<|eot_id|>""",
+ {{ .System }}<|eot_id|>""",
prompt_template="""<|start_header_id|>user<|end_header_id|>
-
-{{ .Prompt }}<|eot_id|>""",
+ {{ .Prompt }}<|eot_id|>""",
response_template="""<|start_header_id|>assistant<|end_header_id|>
-
-{{ .Response }}<|eot_id|>""",
- )
+ {{ .Response }}<|eot_id|>""",
+)
```
-## Bring your Third Party Agents
-!!! note "Extend your Third Party Agents like LlamaIndex, Langchain, Autogen or fully custom agents using the the crewai's BaseAgent class."
+## Bring your third-party agents
- BaseAgent includes attributes and methods required to integrate with your crews to run and delegate tasks to other agents within your own crew.
+Extend your third-party agents like LlamaIndex, Langchain, Autogen or fully custom agents using the the CrewAI's `BaseAgent` class.
- CrewAI is a universal multi-agent framework that allows for all agents to work together to automate tasks and solve problems.
+
+ **BaseAgent** includes attributes and methods required to integrate with your crews to run and delegate tasks to other agents within your own crew.
+
+CrewAI is a universal multi-agent framework that allows for all agents to work together to automate tasks and solve problems.
-```py
+```python Code example
from crewai import Agent, Task, Crew
from custom_agent import CustomAgent # You need to build and extend your own agent logic with the CrewAI BaseAgent class then import it here.
@@ -152,4 +154,6 @@ crew = my_crew.kickoff(inputs={"input": "Mark Twain"})
```
## Conclusion
-Agents are the building blocks of the CrewAI framework. By understanding how to define and interact with agents, you can create sophisticated AI systems that leverage the power of collaborative intelligence.
\ No newline at end of file
+
+Agents are the building blocks of the CrewAI framework. By understanding how to define and interact with agents,
+you can create sophisticated AI systems that leverage the power of collaborative intelligence.
\ No newline at end of file
diff --git a/docs/core-concepts/Cli.md b/docs/concepts/cli.mdx
similarity index 77%
rename from docs/core-concepts/Cli.md
rename to docs/concepts/cli.mdx
index 15546dcd7..26fdffc1d 100644
--- a/docs/core-concepts/Cli.md
+++ b/docs/concepts/cli.mdx
@@ -1,3 +1,9 @@
+---
+title: CLI
+description: Learn how to use the CrewAI CLI to interact with CrewAI.
+icon: terminal
+---
+
# CrewAI CLI Documentation
The CrewAI CLI provides a set of commands to interact with CrewAI, allowing you to create, train, run, and manage crews and pipelines.
@@ -6,7 +12,7 @@ The CrewAI CLI provides a set of commands to interact with CrewAI, allowing you
To use the CrewAI CLI, make sure you have CrewAI & Poetry installed:
-```
+```shell
pip install crewai poetry
```
@@ -14,17 +20,17 @@ pip install crewai poetry
The basic structure of a CrewAI CLI command is:
-```
+```shell
crewai [COMMAND] [OPTIONS] [ARGUMENTS]
```
## Available Commands
-### 1. create
+### 1. Create
Create a new crew or pipeline.
-```
+```shell
crewai create [OPTIONS] TYPE NAME
```
@@ -33,32 +39,32 @@ crewai create [OPTIONS] TYPE NAME
- `--router`: (Optional) Create a pipeline with router functionality
Example:
-```
+```shell
crewai create crew my_new_crew
crewai create pipeline my_new_pipeline --router
```
-### 2. version
+### 2. Version
Show the installed version of CrewAI.
-```
+```shell
crewai version [OPTIONS]
```
- `--tools`: (Optional) Show the installed version of CrewAI tools
Example:
-```
+```shell
crewai version
crewai version --tools
```
-### 3. train
+### 3. Train
Train the crew for a specified number of iterations.
-```
+```shell
crewai train [OPTIONS]
```
@@ -66,39 +72,39 @@ crewai train [OPTIONS]
- `-f, --filename TEXT`: Path to a custom file for training (default: "trained_agents_data.pkl")
Example:
-```
+```shell
crewai train -n 10 -f my_training_data.pkl
```
-### 4. replay
+### 4. Replay
Replay the crew execution from a specific task.
-```
+```shell
crewai replay [OPTIONS]
```
- `-t, --task_id TEXT`: Replay the crew from this task ID, including all subsequent tasks
Example:
-```
+```shell
crewai replay -t task_123456
```
-### 5. log_tasks_outputs
+### 5. Log-tasks-outputs
Retrieve your latest crew.kickoff() task outputs.
-```
-crewai log_tasks_outputs
+```shell
+crewai log-tasks-outputs
```
-### 6. reset_memories
+### 6. Reset-memories
Reset the crew memories (long, short, entity, latest_crew_kickoff_outputs).
-```
-crewai reset_memories [OPTIONS]
+```shell
+crewai reset-memories [OPTIONS]
```
- `-l, --long`: Reset LONG TERM memory
@@ -108,16 +114,16 @@ crewai reset_memories [OPTIONS]
- `-a, --all`: Reset ALL memories
Example:
-```
-crewai reset_memories --long --short
-crewai reset_memories --all
+```shell
+crewai reset-memories --long --short
+crewai reset-memories --all
```
-### 7. test
+### 7. Test
Test the crew and evaluate the results.
-```
+```shell
crewai test [OPTIONS]
```
@@ -125,18 +131,18 @@ crewai test [OPTIONS]
- `-m, --model TEXT`: LLM Model to run the tests on the Crew (default: "gpt-4o-mini")
Example:
-```
+```shell
crewai test -n 5 -m gpt-3.5-turbo
```
-### 8. run
+### 8. Run
Run the crew.
-```
+```shell
crewai run
```
-
-## Note
-
-Make sure to run these commands from the directory where your CrewAI project is set up. Some commands may require additional configuration or setup within your project structure.
+
+Make sure to run these commands from the directory where your CrewAI project is set up.
+Some commands may require additional configuration or setup within your project structure.
+
\ No newline at end of file
diff --git a/docs/concepts/collaboration.mdx b/docs/concepts/collaboration.mdx
new file mode 100644
index 000000000..0aad7abf5
--- /dev/null
+++ b/docs/concepts/collaboration.mdx
@@ -0,0 +1,52 @@
+---
+title: Collaboration
+description: Exploring the dynamics of agent collaboration within the CrewAI framework, focusing on the newly integrated features for enhanced functionality.
+icon: screen-users
+---
+
+## Collaboration Fundamentals
+
+Collaboration in CrewAI is fundamental, enabling agents to combine their skills, share information, and assist each other in task execution, embodying a truly cooperative ecosystem.
+
+- **Information Sharing**: Ensures all agents are well-informed and can contribute effectively by sharing data and findings.
+- **Task Assistance**: Allows agents to seek help from peers with the required expertise for specific tasks.
+- **Resource Allocation**: Optimizes task execution through the efficient distribution and sharing of resources among agents.
+
+## Enhanced Attributes for Improved Collaboration
+
+The `Crew` class has been enriched with several attributes to support advanced functionalities:
+
+| Feature | Description |
+|:-------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **Language Model Management** (`manager_llm`, `function_calling_llm`) | Manages language models for executing tasks and tools. `manager_llm` is required for hierarchical processes, while `function_calling_llm` is optional with a default value for streamlined interactions. |
+| **Custom Manager Agent** (`manager_agent`) | Specifies a custom agent as the manager, replacing the default CrewAI manager. |
+| **Process Flow** (`process`) | Defines execution logic (e.g., sequential, hierarchical) for task distribution. |
+| **Verbose Logging** (`verbose`) | Provides detailed logging for monitoring and debugging. Accepts integer and boolean values to control verbosity level. |
+| **Rate Limiting** (`max_rpm`) | Limits requests per minute to optimize resource usage. Setting guidelines depend on task complexity and load. |
+| **Internationalization / Customization** (`language`, `prompt_file`) | Supports prompt customization for global usability. [Example of file](https://github.com/joaomdmoura/crewAI/blob/main/src/crewai/translations/en.json) |
+| **Execution and Output Handling** (`full_output`) | Controls output granularity, distinguishing between full and final outputs. |
+| **Callback and Telemetry** (`step_callback`, `task_callback`) | Enables step-wise and task-level execution monitoring and telemetry for performance analytics. |
+| **Crew Sharing** (`share_crew`) | Allows sharing crew data with CrewAI for model improvement. Privacy implications and benefits should be considered. |
+| **Usage Metrics** (`usage_metrics`) | Logs all LLM usage metrics during task execution for performance insights. |
+| **Memory Usage** (`memory`) | Enables memory for storing execution history, aiding in agent learning and task efficiency. |
+| **Embedder Configuration** (`embedder`) | Configures the embedder for language understanding and generation, with support for provider customization. |
+| **Cache Management** (`cache`) | Specifies whether to cache tool execution results, enhancing performance. |
+| **Output Logging** (`output_log_file`) | Defines the file path for logging crew execution output. |
+| **Planning Mode** (`planning`) | Enables action planning before task execution. Set `planning=True` to activate. |
+| **Replay Feature** (`replay`) | Provides CLI for listing tasks from the last run and replaying from specific tasks, aiding in task management and troubleshooting. |
+
+## Delegation (Dividing to Conquer)
+
+Delegation enhances functionality by allowing agents to intelligently assign tasks or seek help, thereby amplifying the crew's overall capability.
+
+## Implementing Collaboration and Delegation
+
+Setting up a crew involves defining the roles and capabilities of each agent. CrewAI seamlessly manages their interactions, ensuring efficient collaboration and delegation, with enhanced customization and monitoring features to adapt to various operational needs.
+
+## Example Scenario
+
+Consider a crew with a researcher agent tasked with data gathering and a writer agent responsible for compiling reports. The integration of advanced language model management and process flow attributes allows for more sophisticated interactions, such as the writer delegating complex research tasks to the researcher or querying specific information, thereby facilitating a seamless workflow.
+
+## Conclusion
+
+The integration of advanced attributes and functionalities into the CrewAI framework significantly enriches the agent collaboration ecosystem. These enhancements not only simplify interactions but also offer unprecedented flexibility and control, paving the way for sophisticated AI-driven solutions capable of tackling complex tasks through intelligent collaboration and delegation.
\ No newline at end of file
diff --git a/docs/core-concepts/Crews.md b/docs/concepts/crews.mdx
similarity index 97%
rename from docs/core-concepts/Crews.md
rename to docs/concepts/crews.mdx
index 56c8ff9dd..fdb1c382f 100644
--- a/docs/core-concepts/Crews.md
+++ b/docs/concepts/crews.mdx
@@ -1,6 +1,7 @@
---
-title: crewAI Crews
+title: Crews
description: Understanding and utilizing crews in the crewAI framework with comprehensive attributes and functionalities.
+icon: people-group
---
## What is a Crew?
@@ -36,14 +37,14 @@ A crew in crewAI represents a collaborative group of agents working together to
| **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. |
| **Planning LLM** *(optional)* | `planning_llm` | The language model used by the AgentPlanner in a planning process. |
-!!! 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.
+
+**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.
+
## Crew Output
-!!! note "Understanding Crew Outputs"
-The output of a crew in the crewAI framework is encapsulated within the `CrewOutput` class.
+The output of a crew in the CrewAI framework is encapsulated within the `CrewOutput` class.
This class provides a structured way to access results of the crew's execution, including various formats such as raw strings, JSON, and Pydantic models.
The `CrewOutput` includes the results from the final task output, token usage, and individual task outputs.
@@ -71,7 +72,7 @@ Once a crew has been executed, its output can be accessed through the `output` a
#### Example
-```python
+```python Code
# Example crew execution
crew = Crew(
agents=[research_agent, writer_agent],
@@ -103,7 +104,7 @@ Caches can be employed to store the results of tools' execution, making the proc
After the crew execution, you can access the `usage_metrics` attribute to view the language model (LLM) usage metrics for all tasks executed by the crew. This provides insights into operational efficiency and areas for improvement.
-```python
+```python Code
# Access the crew's usage metrics
crew = Crew(agents=[agent1, agent2], tasks=[task1, task2])
crew.kickoff()
@@ -119,7 +120,7 @@ print(crew.usage_metrics)
Once your crew is assembled, initiate the workflow with the `kickoff()` method. This starts the execution process according to the defined process flow.
-```python
+```python Code
# Start the crew's task execution
result = my_crew.kickoff()
print(result)
@@ -134,7 +135,7 @@ Once your crew is assembled, initiate the workflow with the appropriate kickoff
- `kickoff_async()`: Initiates the workflow asynchronously.
- `kickoff_for_each_async()`: Executes tasks for each agent individually in an asynchronous manner.
-```python
+```python Code
# Start the crew's task execution
result = my_crew.kickoff()
print(result)
diff --git a/docs/concepts/flows.mdx b/docs/concepts/flows.mdx
new file mode 100644
index 000000000..4791fc6c3
--- /dev/null
+++ b/docs/concepts/flows.mdx
@@ -0,0 +1,656 @@
+---
+title: Flows
+description: Learn how to create and manage AI workflows using CrewAI Flows.
+icon: arrow-progress
+---
+
+## Introduction
+
+CrewAI Flows is a powerful feature designed to streamline the creation and management of AI workflows. Flows allow developers to combine and coordinate coding tasks and Crews efficiently, providing a robust framework for building sophisticated AI automations.
+
+Flows allow you to create structured, event-driven workflows. They provide a seamless way to connect multiple tasks, manage state, and control the flow of execution in your AI applications. With Flows, you can easily design and implement multi-step processes that leverage the full potential of CrewAI's capabilities.
+
+1. **Simplified Workflow Creation**: Easily chain together multiple Crews and tasks to create complex AI workflows.
+
+2. **State Management**: Flows make it super easy to manage and share state between different tasks in your workflow.
+
+3. **Event-Driven Architecture**: Built on an event-driven model, allowing for dynamic and responsive workflows.
+
+4. **Flexible Control Flow**: Implement conditional logic, loops, and branching within your workflows.
+
+## Getting Started
+
+Let's create a simple Flow where you will use OpenAI to generate a random city in one task and then use that city to generate a fun fact in another task.
+
+```python Code
+import asyncio
+
+from crewai.flow.flow import Flow, listen, start
+from litellm import completion
+
+
+class ExampleFlow(Flow):
+ model = "gpt-4o-mini"
+
+ @start()
+ def generate_city(self):
+ print("Starting flow")
+
+ response = completion(
+ model=self.model,
+ messages=[
+ {
+ "role": "user",
+ "content": "Return the name of a random city in the world.",
+ },
+ ],
+ )
+
+ random_city = response["choices"][0]["message"]["content"]
+ print(f"Random City: {random_city}")
+
+ return random_city
+
+ @listen(generate_city)
+ def generate_fun_fact(self, random_city):
+ response = completion(
+ model=self.model,
+ messages=[
+ {
+ "role": "user",
+ "content": f"Tell me a fun fact about {random_city}",
+ },
+ ],
+ )
+
+ fun_fact = response["choices"][0]["message"]["content"]
+ return fun_fact
+
+
+async def main():
+ flow = ExampleFlow()
+ result = await flow.kickoff()
+
+ print(f"Generated fun fact: {result}")
+
+asyncio.run(main())
+```
+
+In the above example, we have created a simple Flow that generates a random city using OpenAI and then generates a fun fact about that city. The Flow consists of two tasks: `generate_city` and `generate_fun_fact`. The `generate_city` task is the starting point of the Flow, and the `generate_fun_fact` task listens for the output of the `generate_city` task.
+
+When you run the Flow, it will generate a random city and then generate a fun fact about that city. The output will be printed to the console.
+
+### @start()
+
+The `@start()` decorator is used to mark a method as the starting point of a Flow. When a Flow is started, all the methods decorated with `@start()` are executed in parallel. You can have multiple start methods in a Flow, and they will all be executed when the Flow is started.
+
+### @listen()
+
+The `@listen()` decorator is used to mark a method as a listener for the output of another task in the Flow. The method decorated with `@listen()` will be executed when the specified task emits an output. The method can access the output of the task it is listening to as an argument.
+
+#### Usage
+
+The `@listen()` decorator can be used in several ways:
+
+1. **Listening to a Method by Name**: You can pass the name of the method you want to listen to as a string. When that method completes, the listener method will be triggered.
+
+ ```python Code
+ @listen("generate_city")
+ def generate_fun_fact(self, random_city):
+ # Implementation
+ ```
+
+2. **Listening to a Method Directly**: You can pass the method itself. When that method completes, the listener method will be triggered.
+ ```python Code
+ @listen(generate_city)
+ def generate_fun_fact(self, random_city):
+ # Implementation
+ ```
+
+### Flow Output
+
+Accessing and handling the output of a Flow is essential for integrating your AI workflows into larger applications or systems. CrewAI Flows provide straightforward mechanisms to retrieve the final output, access intermediate results, and manage the overall state of your Flow.
+
+#### Retrieving the Final Output
+
+When you run a Flow, the final output is determined by the last method that completes. The `kickoff()` method returns the output of this final method.
+
+Here's how you can access the final output:
+
+
+```python Code
+import asyncio
+from crewai.flow.flow import Flow, listen, start
+
+class OutputExampleFlow(Flow):
+ @start()
+ def first_method(self):
+ return "Output from first_method"
+
+ @listen(first_method)
+ def second_method(self, first_output):
+ return f"Second method received: {first_output}"
+
+async def main():
+ flow = OutputExampleFlow()
+ final_output = await flow.kickoff()
+ print("---- Final Output ----")
+ print(final_output)
+
+asyncio.run(main())
+```
+
+``` text Output
+---- Final Output ----
+Second method received: Output from first_method
+```
+
+
+
+In this example, the `second_method` is the last method to complete, so its output will be the final output of the Flow.
+The `kickoff()` method will return the final output, which is then printed to the console.
+
+
+#### Accessing and Updating State
+
+In addition to retrieving the final output, you can also access and update the state within your Flow. The state can be used to store and share data between different methods in the Flow. After the Flow has run, you can access the state to retrieve any information that was added or updated during the execution.
+
+Here's an example of how to update and access the state:
+
+
+
+```python Code
+import asyncio
+from crewai.flow.flow import Flow, listen, start
+from pydantic import BaseModel
+
+class ExampleState(BaseModel):
+ counter: int = 0
+ message: str = ""
+
+class StateExampleFlow(Flow[ExampleState]):
+
+ @start()
+ def first_method(self):
+ self.state.message = "Hello from first_method"
+ self.state.counter += 1
+
+ @listen(first_method)
+ def second_method(self):
+ self.state.message += " - updated by second_method"
+ self.state.counter += 1
+ return self.state.message
+
+async def main():
+ flow = StateExampleFlow()
+ final_output = await flow.kickoff()
+ print(f"Final Output: {final_output}")
+ print("Final State:")
+ print(flow.state)
+
+asyncio.run(main())
+```
+
+``` text Output
+Final Output: Hello from first_method - updated by second_method
+Final State:
+counter=2 message='Hello from first_method - updated by second_method'
+```
+
+
+In this example, the state is updated by both `first_method` and `second_method`.
+After the Flow has run, you can access the final state to see the updates made by these methods.
+
+By ensuring that the final method's output is returned and providing access to the state, CrewAI Flows make it easy to integrate the results of your AI workflows into larger applications or systems,
+while also maintaining and accessing the state throughout the Flow's execution.
+
+## Flow State Management
+
+Managing state effectively is crucial for building reliable and maintainable AI workflows. CrewAI Flows provides robust mechanisms for both unstructured and structured state management,
+allowing developers to choose the approach that best fits their application's needs.
+
+### Unstructured State Management
+
+In unstructured state management, all state is stored in the `state` attribute of the `Flow` class.
+This approach offers flexibility, enabling developers to add or modify state attributes on the fly without defining a strict schema.
+
+```python Code
+import asyncio
+
+from crewai.flow.flow import Flow, listen, start
+
+class UntructuredExampleFlow(Flow):
+
+ @start()
+ def first_method(self):
+ self.state.message = "Hello from structured flow"
+ self.state.counter = 0
+
+ @listen(first_method)
+ def second_method(self):
+ self.state.counter += 1
+ self.state.message += " - updated"
+
+ @listen(second_method)
+ def third_method(self):
+ self.state.counter += 1
+ self.state.message += " - updated again"
+
+ print(f"State after third_method: {self.state}")
+
+
+async def main():
+ flow = UntructuredExampleFlow()
+ await flow.kickoff()
+
+
+asyncio.run(main())
+```
+
+**Key Points:**
+
+- **Flexibility:** You can dynamically add attributes to `self.state` without predefined constraints.
+- **Simplicity:** Ideal for straightforward workflows where state structure is minimal or varies significantly.
+
+### Structured State Management
+
+Structured state management leverages predefined schemas to ensure consistency and type safety across the workflow.
+By using models like Pydantic's `BaseModel`, developers can define the exact shape of the state, enabling better validation and auto-completion in development environments.
+
+```python Code
+import asyncio
+
+from crewai.flow.flow import Flow, listen, start
+from pydantic import BaseModel
+
+
+class ExampleState(BaseModel):
+ counter: int = 0
+ message: str = ""
+
+
+class StructuredExampleFlow(Flow[ExampleState]):
+
+ @start()
+ def first_method(self):
+ self.state.message = "Hello from structured flow"
+
+ @listen(first_method)
+ def second_method(self):
+ self.state.counter += 1
+ self.state.message += " - updated"
+
+ @listen(second_method)
+ def third_method(self):
+ self.state.counter += 1
+ self.state.message += " - updated again"
+
+ print(f"State after third_method: {self.state}")
+
+
+async def main():
+ flow = StructuredExampleFlow()
+ await flow.kickoff()
+
+
+asyncio.run(main())
+```
+
+**Key Points:**
+
+- **Defined Schema:** `ExampleState` clearly outlines the state structure, enhancing code readability and maintainability.
+- **Type Safety:** Leveraging Pydantic ensures that state attributes adhere to the specified types, reducing runtime errors.
+- **Auto-Completion:** IDEs can provide better auto-completion and error checking based on the defined state model.
+
+### Choosing Between Unstructured and Structured State Management
+
+- **Use Unstructured State Management when:**
+
+ - The workflow's state is simple or highly dynamic.
+ - Flexibility is prioritized over strict state definitions.
+ - Rapid prototyping is required without the overhead of defining schemas.
+
+- **Use Structured State Management when:**
+ - The workflow requires a well-defined and consistent state structure.
+ - Type safety and validation are important for your application's reliability.
+ - You want to leverage IDE features like auto-completion and type checking for better developer experience.
+
+By providing both unstructured and structured state management options, CrewAI Flows empowers developers to build AI workflows that are both flexible and robust, catering to a wide range of application requirements.
+
+## Flow Control
+
+### Conditional Logic: `or`
+
+The `or_` function in Flows allows you to listen to multiple methods and trigger the listener method when any of the specified methods emit an output.
+
+
+
+```python Code
+import asyncio
+from crewai.flow.flow import Flow, listen, or_, start
+
+class OrExampleFlow(Flow):
+
+ @start()
+ def start_method(self):
+ return "Hello from the start method"
+
+ @listen(start_method)
+ def second_method(self):
+ return "Hello from the second method"
+
+ @listen(or_(start_method, second_method))
+ def logger(self, result):
+ print(f"Logger: {result}")
+
+
+async def main():
+ flow = OrExampleFlow()
+ await flow.kickoff()
+
+
+asyncio.run(main())
+```
+
+``` text Output
+Logger: Hello from the start method
+Logger: Hello from the second method
+```
+
+
+
+When you run this Flow, the `logger` method will be triggered by the output of either the `start_method` or the `second_method`.
+The `or_` function is used to listen to multiple methods and trigger the listener method when any of the specified methods emit an output.
+
+### Conditional Logic: `and`
+
+The `and_` function in Flows allows you to listen to multiple methods and trigger the listener method only when all the specified methods emit an output.
+
+
+
+```python Code
+import asyncio
+from crewai.flow.flow import Flow, and_, listen, start
+
+class AndExampleFlow(Flow):
+
+ @start()
+ def start_method(self):
+ self.state["greeting"] = "Hello from the start method"
+
+ @listen(start_method)
+ def second_method(self):
+ self.state["joke"] = "What do computers eat? Microchips."
+
+ @listen(and_(start_method, second_method))
+ def logger(self):
+ print("---- Logger ----")
+ print(self.state)
+
+
+async def main():
+ flow = AndExampleFlow()
+ await flow.kickoff()
+
+
+asyncio.run(main())
+```
+
+``` text Output
+---- Logger ----
+{'greeting': 'Hello from the start method', 'joke': 'What do computers eat? Microchips.'}
+```
+
+
+
+When you run this Flow, the `logger` method will be triggered only when both the `start_method` and the `second_method` emit an output.
+The `and_` function is used to listen to multiple methods and trigger the listener method only when all the specified methods emit an output.
+
+### Router
+
+The `@router()` decorator in Flows allows you to define conditional routing logic based on the output of a method.
+You can specify different routes based on the output of the method, allowing you to control the flow of execution dynamically.
+
+
+
+```python Code
+import asyncio
+import random
+from crewai.flow.flow import Flow, listen, router, start
+from pydantic import BaseModel
+
+class ExampleState(BaseModel):
+ success_flag: bool = False
+
+class RouterFlow(Flow[ExampleState]):
+
+ @start()
+ def start_method(self):
+ print("Starting the structured flow")
+ random_boolean = random.choice([True, False])
+ self.state.success_flag = random_boolean
+
+ @router(start_method)
+ def second_method(self):
+ if self.state.success_flag:
+ return "success"
+ else:
+ return "failed"
+
+ @listen("success")
+ def third_method(self):
+ print("Third method running")
+
+ @listen("failed")
+ def fourth_method(self):
+ print("Fourth method running")
+
+
+async def main():
+ flow = RouterFlow()
+ await flow.kickoff()
+
+
+asyncio.run(main())
+```
+
+``` text Output
+Starting the structured flow
+Third method running
+Fourth method running
+```
+
+
+
+In the above example, the `start_method` generates a random boolean value and sets it in the state.
+The `second_method` uses the `@router()` decorator to define conditional routing logic based on the value of the boolean.
+If the boolean is `True`, the method returns `"success"`, and if it is `False`, the method returns `"failed"`.
+The `third_method` and `fourth_method` listen to the output of the `second_method` and execute based on the returned value.
+
+When you run this Flow, the output will change based on the random boolean value generated by the `start_method`.
+
+## Adding Crews to Flows
+
+Creating a flow with multiple crews in CrewAI is straightforward.
+
+You can generate a new CrewAI project that includes all the scaffolding needed to create a flow with multiple crews by running the following command:
+
+```bash
+crewai create flow name_of_flow
+```
+
+This command will generate a new CrewAI project with the necessary folder structure. The generated project includes a prebuilt crew called `poem_crew` that is already working. You can use this crew as a template by copying, pasting, and editing it to create other crews.
+
+### Folder Structure
+
+After running the `crewai create flow name_of_flow` command, you will see a folder structure similar to the following:
+
+| Directory/File | Description |
+|:---------------------------------|:------------------------------------------------------------------|
+| `name_of_flow/` | Root directory for the flow. |
+| βββ `crews/` | Contains directories for specific crews. |
+| β βββ `poem_crew/` | Directory for the "poem_crew" with its configurations and scripts.|
+| β βββ `config/` | Configuration files directory for the "poem_crew". |
+| β β βββ `agents.yaml` | YAML file defining the agents for "poem_crew". |
+| β β βββ `tasks.yaml` | YAML file defining the tasks for "poem_crew". |
+| β βββ `poem_crew.py` | Script for "poem_crew" functionality. |
+| βββ `tools/` | Directory for additional tools used in the flow. |
+| β βββ `custom_tool.py` | Custom tool implementation. |
+| βββ `main.py` | Main script for running the flow. |
+| βββ `README.md` | Project description and instructions. |
+| βββ `pyproject.toml` | Configuration file for project dependencies and settings. |
+| βββ `.gitignore` | Specifies files and directories to ignore in version control. |
+
+
+### Building Your Crews
+
+In the `crews` folder, you can define multiple crews. Each crew will have its own folder containing configuration files and the crew definition file. For example, the `poem_crew` folder contains:
+
+- `config/agents.yaml`: Defines the agents for the crew.
+- `config/tasks.yaml`: Defines the tasks for the crew.
+- `poem_crew.py`: Contains the crew definition, including agents, tasks, and the crew itself.
+
+You can copy, paste, and edit the `poem_crew` to create other crews.
+
+### Connecting Crews in `main.py`
+
+The `main.py` file is where you create your flow and connect the crews together. You can define your flow by using the `Flow` class and the decorators `@start` and `@listen` to specify the flow of execution.
+
+Here's an example of how you can connect the `poem_crew` in the `main.py` file:
+
+```python Code
+#!/usr/bin/env python
+import asyncio
+from random import randint
+
+from pydantic import BaseModel
+from crewai.flow.flow import Flow, listen, start
+from .crews.poem_crew.poem_crew import PoemCrew
+
+class PoemState(BaseModel):
+ sentence_count: int = 1
+ poem: str = ""
+
+class PoemFlow(Flow[PoemState]):
+
+ @start()
+ def generate_sentence_count(self):
+ print("Generating sentence count")
+ # Generate a number between 1 and 5
+ self.state.sentence_count = randint(1, 5)
+
+ @listen(generate_sentence_count)
+ def generate_poem(self):
+ print("Generating poem")
+ poem_crew = PoemCrew().crew()
+ result = poem_crew.kickoff(inputs={"sentence_count": self.state.sentence_count})
+
+ print("Poem generated", result.raw)
+ self.state.poem = result.raw
+
+ @listen(generate_poem)
+ def save_poem(self):
+ print("Saving poem")
+ with open("poem.txt", "w") as f:
+ f.write(self.state.poem)
+
+async def run():
+ """
+ Run the flow.
+ """
+ poem_flow = PoemFlow()
+ await poem_flow.kickoff()
+
+def main():
+ asyncio.run(run())
+
+if __name__ == "__main__":
+ main()
+```
+
+In this example, the `PoemFlow` class defines a flow that generates a sentence count, uses the `PoemCrew` to generate a poem, and then saves the poem to a file. The flow is kicked off by calling the `kickoff()` method.
+
+### Running the Flow
+
+Before running the flow, make sure to install the dependencies by running:
+
+```bash
+poetry install
+```
+
+Once all of the dependencies are installed, you need to activate the virtual environment by running:
+
+```bash
+poetry shell
+```
+
+After activating the virtual environment, you can run the flow by executing one of the following commands:
+
+```bash
+crewai flow run
+```
+
+or
+
+```bash
+poetry run run_flow
+```
+
+The flow will execute, and you should see the output in the console.
+
+## Plot Flows
+
+Visualizing your AI workflows can provide valuable insights into the structure and execution paths of your flows. CrewAI offers a powerful visualization tool that allows you to generate interactive plots of your flows, making it easier to understand and optimize your AI workflows.
+
+### What are Plots?
+
+Plots in CrewAI are graphical representations of your AI workflows. They display the various tasks, their connections, and the flow of data between them. This visualization helps in understanding the sequence of operations, identifying bottlenecks, and ensuring that the workflow logic aligns with your expectations.
+
+### How to Generate a Plot
+
+CrewAI provides two convenient methods to generate plots of your flows:
+
+#### Option 1: Using the `plot()` Method
+
+If you are working directly with a flow instance, you can generate a plot by calling the `plot()` method on your flow object. This method will create an HTML file containing the interactive plot of your flow.
+
+```python Code
+# Assuming you have a flow instance
+flow.plot("my_flow_plot")
+```
+
+This will generate a file named `my_flow_plot.html` in your current directory. You can open this file in a web browser to view the interactive plot.
+
+#### Option 2: Using the Command Line
+
+If you are working within a structured CrewAI project, you can generate a plot using the command line. This is particularly useful for larger projects where you want to visualize the entire flow setup.
+
+```bash
+crewai flow plot
+```
+
+This command will generate an HTML file with the plot of your flow, similar to the `plot()` method. The file will be saved in your project directory, and you can open it in a web browser to explore the flow.
+
+### Understanding the Plot
+
+The generated plot will display nodes representing the tasks in your flow, with directed edges indicating the flow of execution. The plot is interactive, allowing you to zoom in and out, and hover over nodes to see additional details.
+
+By visualizing your flows, you can gain a clearer understanding of the workflow's structure, making it easier to debug, optimize, and communicate your AI processes to others.
+
+### Conclusion
+
+Plotting your flows is a powerful feature of CrewAI that enhances your ability to design and manage complex AI workflows. Whether you choose to use the `plot()` method or the command line, generating plots will provide you with a visual representation of your workflows, aiding in both development and presentation.
+
+## Next Steps
+
+If you're interested in exploring additional examples of flows, we have a variety of recommendations in our examples repository. Here are four specific flow examples, each showcasing unique use cases to help you match your current problem type to a specific example:
+
+1. **Email Auto Responder Flow**: This example demonstrates an infinite loop where a background job continually runs to automate email responses. It's a great use case for tasks that need to be performed repeatedly without manual intervention. [View Example](https://github.com/crewAIInc/crewAI-examples/tree/main/email_auto_responder_flow)
+
+2. **Lead Score Flow**: This flow showcases adding human-in-the-loop feedback and handling different conditional branches using the router. It's an excellent example of how to incorporate dynamic decision-making and human oversight into your workflows. [View Example](https://github.com/crewAIInc/crewAI-examples/tree/main/lead-score-flow)
+
+3. **Write a Book Flow**: This example excels at chaining multiple crews together, where the output of one crew is used by another. Specifically, one crew outlines an entire book, and another crew generates chapters based on the outline. Eventually, everything is connected to produce a complete book. This flow is perfect for complex, multi-step processes that require coordination between different tasks. [View Example](https://github.com/crewAIInc/crewAI-examples/tree/main/write_a_book_with_flows)
+
+4. **Meeting Assistant Flow**: This flow demonstrates how to broadcast one event to trigger multiple follow-up actions. For instance, after a meeting is completed, the flow can update a Trello board, send a Slack message, and save the results. It's a great example of handling multiple outcomes from a single event, making it ideal for comprehensive task management and notification systems. [View Example](https://github.com/crewAIInc/crewAI-examples/tree/main/meeting_assistant_flow)
+
+By exploring these examples, you can gain insights into how to leverage CrewAI Flows for various use cases, from automating repetitive tasks to managing complex, multi-step processes with dynamic decision-making and human feedback.
\ No newline at end of file
diff --git a/docs/core-concepts/Using-LangChain-Tools.md b/docs/concepts/langchain-tools.mdx
similarity index 72%
rename from docs/core-concepts/Using-LangChain-Tools.md
rename to docs/concepts/langchain-tools.mdx
index 3ebb93467..538581aee 100644
--- a/docs/core-concepts/Using-LangChain-Tools.md
+++ b/docs/concepts/langchain-tools.mdx
@@ -1,13 +1,16 @@
---
title: Using LangChain Tools
description: Learn how to integrate LangChain tools with CrewAI agents to enhance search-based queries and more.
+icon: link
---
## Using LangChain Tools
-!!! info "LangChain Integration"
- CrewAI seamlessly integrates with LangChainβs comprehensive [list of tools](https://python.langchain.com/docs/integrations/tools/), all of which can be used with crewAI.
-```python
+
+ CrewAI seamlessly integrates with LangChainβs comprehensive [list of tools](https://python.langchain.com/docs/integrations/tools/), all of which can be used with CrewAI.
+
+
+```python Code
import os
from crewai import Agent
from langchain.agents import Tool
@@ -36,4 +39,7 @@ agent = Agent(
```
## Conclusion
-Tools are pivotal in extending the capabilities of CrewAI agents, enabling them to undertake a broad spectrum of tasks and collaborate effectively. When building solutions with CrewAI, leverage both custom and existing tools to empower your agents and enhance the AI ecosystem. Consider utilizing error handling, caching mechanisms, and the flexibility of tool arguments to optimize your agents' performance and capabilities.
\ No newline at end of file
+
+Tools are pivotal in extending the capabilities of CrewAI agents, enabling them to undertake a broad spectrum of tasks and collaborate effectively.
+When building solutions with CrewAI, leverage both custom and existing tools to empower your agents and enhance the AI ecosystem. Consider utilizing error handling, caching mechanisms,
+and the flexibility of tool arguments to optimize your agents' performance and capabilities.
\ No newline at end of file
diff --git a/docs/core-concepts/Using-LlamaIndex-Tools.md b/docs/concepts/llamaindex-tools.mdx
similarity index 66%
rename from docs/core-concepts/Using-LlamaIndex-Tools.md
rename to docs/concepts/llamaindex-tools.mdx
index 96199d92f..3a5ec1412 100644
--- a/docs/core-concepts/Using-LlamaIndex-Tools.md
+++ b/docs/concepts/llamaindex-tools.mdx
@@ -1,14 +1,18 @@
---
title: Using LlamaIndex Tools
description: Learn how to integrate LlamaIndex tools with CrewAI agents to enhance search-based queries and more.
+icon: toolbox
---
## Using LlamaIndex Tools
-!!! info "LlamaIndex Integration"
- CrewAI seamlessly integrates with LlamaIndexβs comprehensive toolkit for RAG (Retrieval-Augmented Generation) and agentic pipelines, enabling advanced search-based queries and more. Here are the available built-in tools offered by LlamaIndex.
+
+ CrewAI seamlessly integrates with LlamaIndexβs comprehensive toolkit for RAG (Retrieval-Augmented Generation) and agentic pipelines, enabling advanced search-based queries and more.
+
-```python
+Here are the available built-in tools offered by LlamaIndex.
+
+```python Code
from crewai import Agent
from crewai_tools import LlamaIndexTool
@@ -16,7 +20,11 @@ from crewai_tools import LlamaIndexTool
from llama_index.core.tools import FunctionTool
your_python_function = lambda ...: ...
-og_tool = FunctionTool.from_defaults(your_python_function, name="", description='')
+og_tool = FunctionTool.from_defaults(
+ your_python_function,
+ name="",
+ description=''
+)
tool = LlamaIndexTool.from_tool(og_tool)
# Example 2: Initialize from LlamaHub Tools
@@ -48,10 +56,16 @@ agent = Agent(
To effectively use the LlamaIndexTool, follow these steps:
-1. **Package Installation**: Confirm that the `crewai[tools]` package is installed in your Python environment.
-
- ```shell
- pip install 'crewai[tools]'
- ```
-
-2. **Install and Use LlamaIndex**: Follow the LlamaIndex documentation [LlamaIndex Documentation](https://docs.llamaindex.ai/) to set up a RAG/agent pipeline.
\ No newline at end of file
+
+
+ Make sure that `crewai[tools]` package is installed in your Python environment:
+
+ ```shell Terminal
+ pip install 'crewai[tools]'
+ ```
+
+
+
+ Follow the LlamaIndex documentation [LlamaIndex Documentation](https://docs.llamaindex.ai/) to set up a RAG/agent pipeline.
+
+
\ No newline at end of file
diff --git a/docs/concepts/llms.mdx b/docs/concepts/llms.mdx
new file mode 100644
index 000000000..728c88c36
--- /dev/null
+++ b/docs/concepts/llms.mdx
@@ -0,0 +1,158 @@
+---
+title: LLMs
+description: Learn how to configure and optimize LLMs for your CrewAI projects.
+icon: microchip-ai
+---
+
+# Large Language Models (LLMs) in CrewAI
+
+Large Language Models (LLMs) are the backbone of intelligent agents in the CrewAI framework. This guide will help you understand, configure, and optimize LLM usage for your CrewAI projects.
+
+## Key Concepts
+
+- **LLM**: Large Language Model, the AI powering agent intelligence
+- **Agent**: A CrewAI entity that uses an LLM to perform tasks
+- **Provider**: A service that offers LLM capabilities (e.g., OpenAI, Anthropic, Ollama, [more providers](https://docs.litellm.ai/docs/providers))
+
+## Configuring LLMs for Agents
+
+CrewAI offers flexible options for setting up LLMs:
+
+### 1. Default Configuration
+
+By default, CrewAI uses the `gpt-4o-mini` model. It uses environment variables if no LLM is specified:
+- `OPENAI_MODEL_NAME` (defaults to "gpt-4o-mini" if not set)
+- `OPENAI_API_BASE`
+- `OPENAI_API_KEY`
+
+### 2. String Identifier
+
+```python Code
+agent = Agent(llm="gpt-4o", ...)
+```
+
+### 3. LLM Instance
+
+List of [more providers](https://docs.litellm.ai/docs/providers).
+
+```python Code
+from crewai import LLM
+
+llm = LLM(model="gpt-4", temperature=0.7)
+agent = Agent(llm=llm, ...)
+```
+
+### 4. Custom LLM Objects
+
+Pass a custom LLM implementation or object from another library.
+
+## Connecting to OpenAI-Compatible LLMs
+
+You can connect to OpenAI-compatible LLMs using either environment variables or by setting specific attributes on the LLM class:
+
+1. Using environment variables:
+
+```python Code
+import os
+
+os.environ["OPENAI_API_KEY"] = "your-api-key"
+os.environ["OPENAI_API_BASE"] = "https://api.your-provider.com/v1"
+```
+
+2. Using LLM class attributes:
+
+```python Code
+llm = LLM(
+ model="custom-model-name",
+ api_key="your-api-key",
+ base_url="https://api.your-provider.com/v1"
+)
+agent = Agent(llm=llm, ...)
+```
+
+## LLM Configuration Options
+
+When configuring an LLM for your agent, you have access to a wide range of parameters:
+
+| Parameter | Type | Description |
+|:------------------|:---------------:|:-------------------------------------------------------------------------------------------------|
+| **model** | `str` | Name of the model to use (e.g., "gpt-4", "gpt-3.5-turbo", "ollama/llama3.1"). For more options, visit the providers documentation. |
+| **timeout** | `float, int` | Maximum time (in seconds) to wait for a response. |
+| **temperature** | `float` | Controls randomness in output (0.0 to 1.0). |
+| **top_p** | `float` | Controls diversity of output (0.0 to 1.0). |
+| **n** | `int` | Number of completions to generate. |
+| **stop** | `str, List[str]` | Sequence(s) where generation should stop. |
+| **max_tokens** | `int` | Maximum number of tokens to generate. |
+| **presence_penalty** | `float` | Penalizes new tokens based on their presence in prior text. |
+| **frequency_penalty**| `float` | Penalizes new tokens based on their frequency in prior text. |
+| **logit_bias** | `Dict[int, float]`| Modifies likelihood of specified tokens appearing. |
+| **response_format** | `Dict[str, Any]` | Specifies the format of the response (e.g., JSON object). |
+| **seed** | `int` | Sets a random seed for deterministic results. |
+| **logprobs** | `bool` | Returns log probabilities of output tokens if enabled. |
+| **top_logprobs** | `int` | Number of most likely tokens for which to return log probabilities. |
+| **base_url** | `str` | The base URL for the API endpoint. |
+| **api_version** | `str` | Version of the API to use. |
+| **api_key** | `str` | Your API key for authentication. |
+
+
+Example:
+
+```python Code
+llm = LLM(
+ model="gpt-4",
+ temperature=0.8,
+ max_tokens=150,
+ top_p=0.9,
+ frequency_penalty=0.1,
+ presence_penalty=0.1,
+ stop=["END"],
+ seed=42,
+ base_url="https://api.openai.com/v1",
+ api_key="your-api-key-here"
+)
+agent = Agent(llm=llm, ...)
+```
+## Using Ollama (Local LLMs)
+
+crewAI supports using Ollama for running open-source models locally:
+
+1. Install Ollama: [ollama.ai](https://ollama.ai/)
+2. Run a model: `ollama run llama2`
+3. Configure agent:
+
+```python Code
+agent = Agent(
+ llm=LLM(model="ollama/llama3.1", base_url="http://localhost:11434"),
+ ...
+)
+```
+
+## Changing the Base API URL
+
+You can change the base API URL for any LLM provider by setting the `base_url` parameter:
+
+```python Code
+llm = LLM(
+ model="custom-model-name",
+ base_url="https://api.your-provider.com/v1",
+ api_key="your-api-key"
+)
+agent = Agent(llm=llm, ...)
+```
+
+This is particularly useful when working with OpenAI-compatible APIs or when you need to specify a different endpoint for your chosen provider.
+
+## Best Practices
+
+1. **Choose the right model**: Balance capability and cost.
+2. **Optimize prompts**: Clear, concise instructions improve output.
+3. **Manage tokens**: Monitor and limit token usage for efficiency.
+4. **Use appropriate temperature**: Lower for factual tasks, higher for creative ones.
+5. **Implement error handling**: Gracefully manage API errors and rate limits.
+
+## Troubleshooting
+
+- **API Errors**: Check your API key, network connection, and rate limits.
+- **Unexpected Outputs**: Refine your prompts and adjust temperature or top_p.
+- **Performance Issues**: Consider using a more powerful model or optimizing your queries.
+- **Timeout Errors**: Increase the `timeout` parameter or optimize your input.
\ No newline at end of file
diff --git a/docs/core-concepts/Memory.md b/docs/concepts/memory.mdx
similarity index 55%
rename from docs/core-concepts/Memory.md
rename to docs/concepts/memory.mdx
index 2b9d7160b..eb117f9c1 100644
--- a/docs/core-concepts/Memory.md
+++ b/docs/concepts/memory.mdx
@@ -1,21 +1,23 @@
---
-title: crewAI Memory Systems
-description: Leveraging memory systems in the crewAI framework to enhance agent capabilities.
+title: Memory
+description: Leveraging memory systems in the CrewAI framework to enhance agent capabilities.
+icon: database
---
-## Introduction to Memory Systems in crewAI
+## Introduction to Memory Systems in CrewAI
-!!! note "Enhancing Agent Intelligence"
- The crewAI framework introduces a sophisticated memory system designed to significantly enhance the capabilities of AI agents. This system comprises short-term memory, long-term memory, entity memory, and contextual memory, each serving a unique purpose in aiding agents to remember, reason, and learn from past interactions.
+The crewAI framework introduces a sophisticated memory system designed to significantly enhance the capabilities of AI agents.
+This system comprises `short-term memory`, `long-term memory`, `entity memory`, and `contextual memory`, each serving a unique purpose in aiding agents to remember,
+reason, and learn from past interactions.
## Memory System Components
-| Component | Description |
-| :------------------- | :---------------------------------------------------------------------------------------------------------------------- |
-| **Short-Term Memory**| Temporarily stores recent interactions and outcomes using `RAG`, enabling agents to recall and utilize information relevant to their current context during the current executions.|
-| **Long-Term Memory** | Preserves valuable insights and learnings from past executions, allowing agents to build and refine their knowledge over time. |
-| **Entity Memory** | Captures and organizes information about entities (people, places, concepts) encountered during tasks, facilitating deeper understanding and relationship mapping. Uses `RAG` for storing entity information. |
-| **Contextual Memory**| Maintains the context of interactions by combining `ShortTermMemory`, `LongTermMemory`, and `EntityMemory`, aiding in the coherence and relevance of agent responses over a sequence of tasks or a conversation. |
+| Component | Description |
+| :-------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
+| **Short-Term Memory** | Temporarily stores recent interactions and outcomes using `RAG`, enabling agents to recall and utilize information relevant to their current context during the current executions. |
+| **Long-Term Memory** | Preserves valuable insights and learnings from past executions, allowing agents to build and refine their knowledge over time. |
+| **Entity Memory** | Captures and organizes information about entities (people, places, concepts) encountered during tasks, facilitating deeper understanding and relationship mapping. Uses `RAG` for storing entity information. |
+| **Contextual Memory** | Maintains the context of interactions by combining `ShortTermMemory`, `LongTermMemory`, and `EntityMemory`, aiding in the coherence and relevance of agent responses over a sequence of tasks or a conversation. |
## How Memory Systems Empower Agents
@@ -28,7 +30,9 @@ description: Leveraging memory systems in the crewAI framework to enhance agent
## Implementing Memory in Your Crew
When configuring a crew, you can enable and customize each memory component to suit the crew's objectives and the nature of tasks it will perform.
-By default, the memory system is disabled, and you can ensure it is active by setting `memory=True` in the crew configuration. The memory will use OpenAI embeddings by default, but you can change it by setting `embedder` to a different model. It's also possible to initialize the memory instance with your own instance.
+By default, the memory system is disabled, and you can ensure it is active by setting `memory=True` in the crew configuration.
+The memory will use OpenAI embeddings by default, but you can change it by setting `embedder` to a different model.
+It's also possible to initialize the memory instance with your own instance.
The 'embedder' only applies to **Short-Term Memory** which uses Chroma for RAG using the EmbedChain package.
The **Long-Term Memory** uses SQLite3 to store task results. Currently, there is no way to override these storage implementations.
@@ -37,7 +41,7 @@ and the name of the project can be overridden using the **CREWAI_STORAGE_DIR** e
### Example: Configuring Memory for a Crew
-```python
+```python Code
from crewai import Crew, Agent, Task, Process
# Assemble your crew with memory capabilities
@@ -52,7 +56,7 @@ my_crew = Crew(
### Example: Use Custom Memory Instances e.g FAISS as the VectorDB
-```python
+```python Code
from crewai import Crew, Agent, Task, Process
# Assemble your crew with memory capabilities
@@ -88,11 +92,11 @@ my_crew = Crew(
)
```
-
## Additional Embedding Providers
### Using OpenAI embeddings (already default)
-```python
+
+```python Code
from crewai import Crew, Agent, Task, Process
my_crew = Crew(
@@ -111,7 +115,8 @@ my_crew = Crew(
```
### Using Google AI embeddings
-```python
+
+```python Code
from crewai import Crew, Agent, Task, Process
my_crew = Crew(
@@ -132,7 +137,8 @@ my_crew = Crew(
```
### Using Azure OpenAI embeddings
-```python
+
+```python Code
from crewai import Crew, Agent, Task, Process
my_crew = Crew(
@@ -152,7 +158,8 @@ my_crew = Crew(
```
### Using GPT4ALL embeddings
-```python
+
+```python Code
from crewai import Crew, Agent, Task, Process
my_crew = Crew(
@@ -168,7 +175,8 @@ my_crew = Crew(
```
### Using Vertex AI embeddings
-```python
+
+```python Code
from crewai import Crew, Agent, Task, Process
my_crew = Crew(
@@ -187,7 +195,8 @@ my_crew = Crew(
```
### Using Cohere embeddings
-```python
+
+```python Code
from crewai import Crew, Agent, Task, Process
my_crew = Crew(
@@ -207,59 +216,28 @@ my_crew = Crew(
```
### Resetting Memory
-```sh
-crewai reset_memories [OPTIONS]
+
+```shell
+crewai reset-memories [OPTIONS]
```
#### Resetting Memory Options
-- **`-l, --long`**
- - **Description:** Reset LONG TERM memory.
- - **Type:** Flag (boolean)
- - **Default:** False
-- **`-s, --short`**
- - **Description:** Reset SHORT TERM memory.
- - **Type:** Flag (boolean)
- - **Default:** False
+| Option | Description | Type | Default |
+| :------------------------ | :--------------------------------- | :------------- | :------ |
+| `-l`, `--long` | Reset LONG TERM memory. | Flag (boolean) | False |
+| `-s`, `--short` | Reset SHORT TERM memory. | Flag (boolean) | False |
+| `-e`, `--entities` | Reset ENTITIES memory. | Flag (boolean) | False |
+| `-k`, `--kickoff-outputs` | Reset LATEST KICKOFF TASK OUTPUTS. | Flag (boolean) | False |
+| `-a`, `--all` | Reset ALL memories. | Flag (boolean) | False |
-- **`-e, --entities`**
- - **Description:** Reset ENTITIES memory.
- - **Type:** Flag (boolean)
- - **Default:** False
+## Benefits of Using CrewAI's Memory System
-- **`-k, --kickoff-outputs`**
- - **Description:** Reset LATEST KICKOFF TASK OUTPUTS.
- - **Type:** Flag (boolean)
- - **Default:** False
+- π¦Ύ **Adaptive Learning:** Crews become more efficient over time, adapting to new information and refining their approach to tasks.
+- π«‘ **Enhanced Personalization:** Memory enables agents to remember user preferences and historical interactions, leading to personalized experiences.
+- π§ **Improved Problem Solving:** Access to a rich memory store aids agents in making more informed decisions, drawing on past learnings and contextual insights.
-- **`-a, --all`**
- - **Description:** Reset ALL memories.
- - **Type:** Flag (boolean)
- - **Default:** False
+## Conclusion
-## Use Mem0 to store memories
-[Mem0](https://www.mem0.ai/) enhances AI assistants and agents with an intelligent memory layer, enabling personalized AI interactions. Mem0 remembers user preferences, adapts to individual needs, and continuously improves over time, making it ideal for customer support chatbots, AI assistants, and autonomous systems.
-
-In order to use Mem0 as the memory provider for your crew, you will have to set `MEM0_API_KEY` as an environment variable. Refer to the [Mem0 documentation](https://docs.mem0.ai/platform/quickstart) for more information on how to obtain an API key.
-
-### Example: Using Mem0 as the Memory Provider
-```python
-from crewai import Crew, Agent, Task, Process
-
-my_crew = Crew(
- agents=[...],
- tasks=[...],
- process=Process.sequential,
- memory=True,
- verbose=True,
- memory_provider="mem0"
-)
-```
-
-## Benefits of Using crewAI's Memory System
-- **Adaptive Learning:** Crews become more efficient over time, adapting to new information and refining their approach to tasks.
-- **Enhanced Personalization:** Memory enables agents to remember user preferences and historical interactions, leading to personalized experiences.
-- **Improved Problem Solving:** Access to a rich memory store aids agents in making more informed decisions, drawing on past learnings and contextual insights.
-
-## Getting Started
-Integrating crewAI's memory system into your projects is straightforward. By leveraging the provided memory components and configurations, you can quickly empower your agents with the ability to remember, reason, and learn from their interactions, unlocking new levels of intelligence and capability.
\ No newline at end of file
+Integrating CrewAI's memory system into your projects is straightforward. By leveraging the provided memory components and configurations,
+you can quickly empower your agents with the ability to remember, reason, and learn from their interactions, unlocking new levels of intelligence and capability.
diff --git a/docs/core-concepts/Pipeline.md b/docs/concepts/pipeline.mdx
similarity index 90%
rename from docs/core-concepts/Pipeline.md
rename to docs/concepts/pipeline.mdx
index 26000f809..67dae8cc0 100644
--- a/docs/core-concepts/Pipeline.md
+++ b/docs/concepts/pipeline.mdx
@@ -1,11 +1,12 @@
---
-title: crewAI Pipelines
+title: Pipelines
description: Understanding and utilizing pipelines in the crewAI framework for efficient multi-stage task processing.
+icon: timeline-arrow
---
## What is a Pipeline?
-A pipeline in crewAI represents a structured workflow that allows for the sequential or parallel execution of multiple crews. It provides a way to organize complex processes involving multiple stages, where the output of one stage can serve as input for subsequent stages.
+A pipeline in CrewAI represents a structured workflow that allows for the sequential or parallel execution of multiple crews. It provides a way to organize complex processes involving multiple stages, where the output of one stage can serve as input for subsequent stages.
## Key Terminology
@@ -18,7 +19,7 @@ Understanding the following terms is crucial for working effectively with pipeli
Example pipeline structure:
-```
+```bash Pipeline
crew1 >> [crew2, crew3] >> crew4
```
@@ -38,7 +39,8 @@ Each input creates its own kickoff, flowing through all stages of the pipeline.
## Creating a Pipeline
-When creating a pipeline, you define a series of stages, each consisting of either a single crew or a list of crews for parallel execution. The pipeline ensures that each stage is executed in order, with the output of one stage feeding into the next.
+When creating a pipeline, you define a series of stages, each consisting of either a single crew or a list of crews for parallel execution.
+The pipeline ensures that each stage is executed in order, with the output of one stage feeding into the next.
### Example: Assembling a Pipeline
@@ -79,8 +81,8 @@ my_pipeline = Pipeline(
## Pipeline Output
-!!! note "Understanding Pipeline Outputs"
-The output of a pipeline in the crewAI framework is encapsulated within the `PipelineKickoffResult` class. This class provides a structured way to access the results of the pipeline's execution, including various formats such as raw strings, JSON, and Pydantic models.
+The output of a pipeline in the CrewAI framework is encapsulated within the `PipelineKickoffResult` class.
+This class provides a structured way to access the results of the pipeline's execution, including various formats such as raw strings, JSON, and Pydantic models.
### Pipeline Output Attributes
@@ -117,13 +119,17 @@ The output of a pipeline in the crewAI framework is encapsulated within the `Pip
### Accessing Pipeline Outputs
-Once a pipeline has been executed, its output can be accessed through the `PipelineOutput` object returned by the `process_runs` method. The `PipelineOutput` class provides access to individual `PipelineRunResult` objects, each representing a single run through the pipeline.
+Once a pipeline has been executed, its output can be accessed through the `PipelineOutput` object returned by the `process_runs` method.
+The `PipelineOutput` class provides access to individual `PipelineRunResult` objects, each representing a single run through the pipeline.
#### Example
```python
# Define input data for the pipeline
-input_data = [{"initial_query": "Latest advancements in AI"}, {"initial_query": "Future of robotics"}]
+input_data = [
+ {"initial_query": "Latest advancements in AI"},
+ {"initial_query": "Future of robotics"}
+]
# Execute the pipeline
pipeline_output = await my_pipeline.process_runs(input_data)
@@ -191,11 +197,13 @@ my_pipeline = Pipeline(
### Routers in Pipelines
-Routers are a powerful feature in crewAI pipelines that allow for dynamic decision-making and branching within your workflow. They enable you to direct the flow of execution based on specific conditions or criteria, making your pipelines more flexible and adaptive.
+Routers are a powerful feature in crewAI pipelines that allow for dynamic decision-making and branching within your workflow.
+They enable you to direct the flow of execution based on specific conditions or criteria, making your pipelines more flexible and adaptive.
#### What is a Router?
-A router in crewAI is a special component that can be included as a stage in your pipeline. It evaluates the input data and determines which path the execution should take next. This allows for conditional branching in your pipeline, where different crews or sub-pipelines can be executed based on the router's decision.
+A router in crewAI is a special component that can be included as a stage in your pipeline. It evaluates the input data and determines which path the execution should take next.
+This allows for conditional branching in your pipeline, where different crews or sub-pipelines can be executed based on the router's decision.
#### Key Components of a Router
@@ -251,7 +259,8 @@ inputs = [{"email": "..."}, {"email": "..."}] # List of email data
main_pipeline.kickoff(inputs=inputs)
```
-In this example, the router decides between an urgent pipeline and a normal pipeline based on the urgency score of the email. If the urgency score is greater than 7, it routes to the urgent pipeline; otherwise, it uses the normal pipeline. If the input doesn't include an urgency score, it defaults to just the classification crew.
+In this example, the router decides between an urgent pipeline and a normal pipeline based on the urgency score of the email. If the urgency score is greater than 7,
+it routes to the urgent pipeline; otherwise, it uses the normal pipeline. If the input doesn't include an urgency score, it defaults to just the classification crew.
#### Benefits of Using Routers
@@ -265,4 +274,4 @@ In this example, the router decides between an urgent pipeline and a normal pipe
The `Pipeline` class includes validation mechanisms to ensure the robustness of the pipeline structure:
- Validates that stages contain only Crew instances or lists of Crew instances.
-- Prevents double nesting of stages to maintain a clear structure.
+- Prevents double nesting of stages to maintain a clear structure.
\ No newline at end of file
diff --git a/docs/core-concepts/Planning.md b/docs/concepts/planning.mdx
similarity index 88%
rename from docs/core-concepts/Planning.md
rename to docs/concepts/planning.mdx
index dcb53ac15..37055c7dc 100644
--- a/docs/core-concepts/Planning.md
+++ b/docs/concepts/planning.mdx
@@ -1,15 +1,20 @@
---
-title: crewAI Planning
-description: Learn how to add planning to your crewAI Crew and improve their performance.
+title: Planning
+description: Learn how to add planning to your CrewAI Crew and improve their performance.
+icon: brain
---
## Introduction
-The planning feature in CrewAI allows you to add planning capability to your crew. When enabled, before each Crew iteration, all Crew information is sent to an AgentPlanner that will plan the tasks step by step, and this plan will be added to each task description.
+
+The planning feature in CrewAI allows you to add planning capability to your crew. When enabled, before each Crew iteration,
+all Crew information is sent to an AgentPlanner that will plan the tasks step by step, and this plan will be added to each task description.
### Using the Planning Feature
+
Getting started with the planning feature is very easy, the only step required is to add `planning=True` to your Crew:
-```python
+
+```python Code
from crewai import Crew, Agent, Task, Process
# Assemble your crew with planning capabilities
@@ -20,6 +25,7 @@ my_crew = Crew(
planning=True,
)
```
+
From this point on, your crew will have planning enabled, and the tasks will be planned before each iteration.
@@ -27,7 +33,11 @@ From this point on, your crew will have planning enabled, and the tasks will be
Now you can define the LLM that will be used to plan the tasks. You can use any ChatOpenAI LLM model available.
-```python
+When running the base case example, you will see something like the output below, which represents the output of the `AgentPlanner`
+responsible for creating the step-by-step logic to add to the Agents' tasks.
+
+
+```python Code
from crewai import Crew, Agent, Task, Process
from langchain_openai import ChatOpenAI
@@ -39,13 +49,12 @@ my_crew = Crew(
planning=True,
planning_llm=ChatOpenAI(model="gpt-4o")
)
+
+# Run the crew
+my_crew.kickoff()
```
-### Example
-
-When running the base case example, you will see something like the following output, which represents the output of the AgentPlanner responsible for creating the step-by-step logic to add to the Agents' tasks.
-
-```
+```markdown Result
[2024-07-15 16:49:11][INFO]: Planning the crew execution
**Step-by-Step Plan for Task Execution**
@@ -64,28 +73,35 @@ When running the base case example, you will see something like the following ou
**Step-by-Step Plan:**
1. **Define Research Scope:**
+
- Determine the specific areas of AI LLMs to focus on, such as advancements in architecture, use cases, ethical considerations, and performance metrics.
2. **Identify Reliable Sources:**
+
- List reputable sources for AI research, including academic journals, industry reports, conferences (e.g., NeurIPS, ACL), AI research labs (e.g., OpenAI, Google AI), and online databases (e.g., IEEE Xplore, arXiv).
3. **Collect Data:**
+
- Search for the latest papers, articles, and reports published in 2023 and early 2024.
- Use keywords like "Large Language Models 2024", "AI LLM advancements", "AI ethics 2024", etc.
4. **Analyze Findings:**
+
- Read and summarize the key points from each source.
- Highlight new techniques, models, and applications introduced in the past year.
5. **Organize Information:**
+
- Categorize the information into relevant topics (e.g., new architectures, ethical implications, real-world applications).
- Ensure each bullet point is concise but informative.
6. **Create the List:**
+
- Compile the 10 most relevant pieces of information into a bullet point list.
- Review the list to ensure clarity and relevance.
**Expected Output:**
+
A list with 10 bullet points of the most relevant information about AI LLMs.
---
@@ -131,3 +147,5 @@ A list with 10 bullet points of the most relevant information about AI LLMs.
**Expected Output:**
A fully fledged report with the main topics, each with a full section of information. Formatted as markdown without '```'.
+```
+
\ No newline at end of file
diff --git a/docs/core-concepts/Processes.md b/docs/concepts/processes.mdx
similarity index 85%
rename from docs/core-concepts/Processes.md
rename to docs/concepts/processes.mdx
index 6a7a1a64f..e109e6449 100644
--- a/docs/core-concepts/Processes.md
+++ b/docs/concepts/processes.mdx
@@ -1,11 +1,14 @@
---
-title: Managing Processes in CrewAI
+title: Processes
description: Detailed guide on workflow management through processes in CrewAI, with updated implementation details.
+icon: bars-staggered
---
## Understanding Processes
-!!! note "Core Concept"
- In CrewAI, processes orchestrate the execution of tasks by agents, akin to project management in human teams. These processes ensure tasks are distributed and executed efficiently, in alignment with a predefined strategy.
+
+ Processes orchestrate the execution of tasks by agents, akin to project management in human teams.
+ These processes ensure tasks are distributed and executed efficiently, in alignment with a predefined strategy.
+
## Process Implementations
@@ -45,15 +48,20 @@ crew = Crew(
**Note:** Ensure `my_agents` and `my_tasks` are defined prior to creating a `Crew` object, and for the hierarchical process, either `manager_llm` or `manager_agent` is also required.
## Sequential Process
+
This method mirrors dynamic team workflows, progressing through tasks in a thoughtful and systematic manner. Task execution follows the predefined order in the task list, with the output of one task serving as context for the next.
To customize task context, utilize the `context` parameter in the `Task` class to specify outputs that should be used as context for subsequent tasks.
## Hierarchical Process
+
Emulates a corporate hierarchy, CrewAI allows specifying a custom manager agent or automatically creates one, requiring the specification of a manager language model (`manager_llm`). This agent oversees task execution, including planning, delegation, and validation. Tasks are not pre-assigned; the manager allocates tasks to agents based on their capabilities, reviews outputs, and assesses task completion.
## Process Class: Detailed Overview
+
The `Process` class is implemented as an enumeration (`Enum`), ensuring type safety and restricting process values to the defined types (`sequential`, `hierarchical`). The consensual process is planned for future inclusion, emphasizing our commitment to continuous development and innovation.
## Conclusion
-The structured collaboration facilitated by processes within CrewAI is crucial for enabling systematic teamwork among agents. This documentation has been updated to reflect the latest features, enhancements, and the planned integration of the Consensual Process, ensuring users have access to the most current and comprehensive information.
\ No newline at end of file
+
+The structured collaboration facilitated by processes within CrewAI is crucial for enabling systematic teamwork among agents.
+This documentation has been updated to reflect the latest features, enhancements, and the planned integration of the Consensual Process, ensuring users have access to the most current and comprehensive information.
\ No newline at end of file
diff --git a/docs/core-concepts/Tasks.md b/docs/concepts/tasks.mdx
similarity index 89%
rename from docs/core-concepts/Tasks.md
rename to docs/concepts/tasks.mdx
index 38d3a21a0..884c8fd27 100644
--- a/docs/core-concepts/Tasks.md
+++ b/docs/concepts/tasks.mdx
@@ -1,14 +1,17 @@
---
-title: crewAI Tasks
-description: Detailed guide on managing and creating tasks within the crewAI framework, reflecting the latest codebase updates.
+title: Tasks
+description: Detailed guide on managing and creating tasks within the CrewAI framework, reflecting the latest codebase updates.
+icon: list-check
---
## Overview of a Task
-!!! note "What is a Task?"
-In the crewAI framework, tasks are specific assignments completed by agents. They provide all necessary details for execution, such as a description, the agent responsible, required tools, and more, facilitating a wide range of action complexities.
+In the CrewAI framework, a `Task` is a specific assignment completed by an `Agent`.
-Tasks within crewAI can be collaborative, requiring multiple agents to work together. This is managed through the task properties and orchestrated by the Crew's process, enhancing teamwork and efficiency.
+They provide all necessary details for execution, such as a description, the agent responsible, required tools, and more, facilitating a wide range of action complexities.
+
+
+Tasks within CrewAI can be collaborative, requiring multiple agents to work together. This is managed through the task properties and orchestrated by the Crew's process, enhancing teamwork and efficiency.
## Task Attributes
@@ -33,7 +36,7 @@ Tasks within crewAI can be collaborative, requiring multiple agents to work toge
Creating a task involves defining its scope, responsible agent, and any additional attributes for flexibility:
-```python
+```python Code
from crewai import Task
task = Task(
@@ -43,13 +46,14 @@ task = Task(
)
```
-!!! note "Task Assignment"
-Directly specify an `agent` for assignment or let the `hierarchical` CrewAI's process decide based on roles, availability, etc.
+
+ Directly specify an `agent` for assignment or let the `hierarchical` CrewAI's process decide based on roles, availability, etc.
+
## Task Output
-!!! note "Understanding Task Outputs"
-The output of a task in the crewAI framework is encapsulated within the `TaskOutput` class. This class provides a structured way to access results of a task, including various formats such as raw output, JSON, and Pydantic models.
+The output of a task in CrewAI framework is encapsulated within the `TaskOutput` class. This class provides a structured way to access results of a task, including various formats such as raw output, JSON, and Pydantic models.
+
By default, the `TaskOutput` will only include the `raw` output. A `TaskOutput` will only include the `pydantic` or `json_dict` output if the original `Task` object was configured with `output_pydantic` or `output_json`, respectively.
### Task Output Attributes
@@ -78,7 +82,7 @@ Once a task has been executed, its output can be accessed through the `output` a
#### Example
-```python
+```python Code
# Example task
task = Task(
description='Find and summarize the latest AI news',
@@ -110,11 +114,11 @@ if task_output.pydantic:
## Integrating Tools with Tasks
-Leverage tools from the [crewAI Toolkit](https://github.com/joaomdmoura/crewai-tools) and [LangChain Tools](https://python.langchain.com/docs/integrations/tools) for enhanced task performance and agent interaction.
+Leverage tools from the [CrewAI Toolkit](https://github.com/joaomdmoura/crewai-tools) and [LangChain Tools](https://python.langchain.com/docs/integrations/tools) for enhanced task performance and agent interaction.
## Creating a Task with Tools
-```python
+```python Code
import os
os.environ["OPENAI_API_KEY"] = "Your Key"
os.environ["SERPER_API_KEY"] = "Your Key" # serper.dev API key
@@ -155,11 +159,11 @@ This demonstrates how tasks with specific tools can override an agent's default
## Referring to Other Tasks
-In crewAI, the output of one task is automatically relayed into the next one, but you can specifically define what tasks' output, including multiple, should be used as context for another task.
+In CrewAI, the output of one task is automatically relayed into the next one, but you can specifically define what tasks' output, including multiple, should be used as context for another task.
This is useful when you have a task that depends on the output of another task that is not performed immediately after it. This is done through the `context` attribute of the task:
-```python
+```python Code
# ...
research_ai_task = Task(
@@ -194,7 +198,7 @@ You can define a task to be executed asynchronously. This means that the crew wi
You can then use the `context` attribute to define in a future task that it should wait for the output of the asynchronous task to be completed.
-```python
+```python Code
#...
list_ideas = Task(
@@ -225,7 +229,7 @@ write_article = Task(
The callback function is executed after the task is completed, allowing for actions or notifications to be triggered based on the task's outcome.
-```python
+```python Code
# ...
def callback_function(output: TaskOutput):
@@ -252,7 +256,7 @@ research_task = Task(
Once a crew finishes running, you can access the output of a specific task by using the `output` attribute of the task object:
-```python
+```python Code
# ...
task1 = Task(
description='Find and summarize the latest AI news',
@@ -296,7 +300,7 @@ These validations help in maintaining the consistency and reliability of task ex
You can now specify if a task should create directories when saving its output to a file. This is particularly useful for organizing outputs and ensuring that file paths are correctly structured.
-```python
+```python Code
# ...
save_output_task = Task(
@@ -313,4 +317,7 @@ save_output_task = Task(
## Conclusion
-Tasks are the driving force behind the actions of agents in crewAI. By properly defining tasks and their outcomes, you set the stage for your AI agents to work effectively, either independently or as a collaborative unit. Equipping tasks with appropriate tools, understanding the execution process, and following robust validation practices are crucial for maximizing CrewAI's potential, ensuring agents are effectively prepared for their assignments and that tasks are executed as intended.
+Tasks are the driving force behind the actions of agents in CrewAI.
+By properly defining tasks and their outcomes, you set the stage for your AI agents to work effectively, either independently or as a collaborative unit.
+Equipping tasks with appropriate tools, understanding the execution process, and following robust validation practices are crucial for maximizing CrewAI's potential,
+ensuring agents are effectively prepared for their assignments and that tasks are executed as intended.
\ No newline at end of file
diff --git a/docs/concepts/testing.mdx b/docs/concepts/testing.mdx
new file mode 100644
index 000000000..ec6edda02
--- /dev/null
+++ b/docs/concepts/testing.mdx
@@ -0,0 +1,48 @@
+---
+title: Testing
+description: Learn how to test your CrewAI Crew and evaluate their performance.
+icon: vial
+---
+
+## Introduction
+
+Testing is a crucial part of the development process, and it is essential to ensure that your crew is performing as expected. With crewAI, you can easily test your crew and evaluate its performance using the built-in testing capabilities.
+
+### Using the Testing Feature
+
+We added the CLI command `crewai test` to make it easy to test your crew. This command will run your crew for a specified number of iterations and provide detailed performance metrics. The parameters are `n_iterations` and `model`, which are optional and default to 2 and `gpt-4o-mini` respectively. For now, the only provider available is OpenAI.
+
+```bash
+crewai test
+```
+
+If you want to run more iterations or use a different model, you can specify the parameters like this:
+
+```bash
+crewai test --n_iterations 5 --model gpt-4o
+```
+
+or using the short forms:
+
+```bash
+crewai test -n 5 -m gpt-4o
+```
+
+When you run the `crewai test` command, the crew will be executed for the specified number of iterations, and the performance metrics will be displayed at the end of the run.
+
+A table of scores at the end will show the performance of the crew in terms of the following metrics:
+
+
**Tasks Scores (1-10 Higher is better)**
+
+| Tasks/Crew/Agents | Run 1 | Run 2 | Avg. Total | Agents | Additional Info |
+|:------------------|:-----:|:-----:|:----------:|:------------------------------:|:---------------------------------|
+| Task 1 | 9.0 | 9.5 | **9.2** | Professional Insights | |
+| | | | | Researcher | |
+| Task 2 | 9.0 | 10.0 | **9.5** | Company Profile Investigator | |
+| Task 3 | 9.0 | 9.0 | **9.0** | Automation Insights | |
+| | | | | Specialist | |
+| Task 4 | 9.0 | 9.0 | **9.0** | Final Report Compiler | Automation Insights Specialist |
+| Crew | 9.00 | 9.38 | **9.2** | | |
+| Execution Time (s) | 126 | 145 | **135** | | |
+
+The example above shows the test results for two runs of the crew with two tasks, with the average total score for each task and the crew as a whole.
diff --git a/docs/core-concepts/Tools.md b/docs/concepts/tools.mdx
similarity index 85%
rename from docs/core-concepts/Tools.md
rename to docs/concepts/tools.mdx
index 45aa77c6a..12ab96c6e 100644
--- a/docs/core-concepts/Tools.md
+++ b/docs/concepts/tools.mdx
@@ -1,14 +1,18 @@
---
-title: crewAI Tools
-description: Understanding and leveraging tools within the crewAI framework for agent collaboration and task execution.
+title: Tools
+description: Understanding and leveraging tools within the CrewAI framework for agent collaboration and task execution.
+icon: screwdriver-wrench
---
## Introduction
-CrewAI tools empower agents with capabilities ranging from web searching and data analysis to collaboration and delegating tasks among coworkers. This documentation outlines how to create, integrate, and leverage these tools within the CrewAI framework, including a new focus on collaboration tools.
+CrewAI tools empower agents with capabilities ranging from web searching and data analysis to collaboration and delegating tasks among coworkers.
+This documentation outlines how to create, integrate, and leverage these tools within the CrewAI framework, including a new focus on collaboration tools.
## What is a Tool?
-!!! note "Definition"
- A tool in CrewAI is a skill or function that agents can utilize to perform various actions. This includes tools from the [crewAI Toolkit](https://github.com/joaomdmoura/crewai-tools) and [LangChain Tools](https://python.langchain.com/docs/integrations/tools), enabling everything from simple searches to complex interactions and effective teamwork among agents.
+
+A tool in CrewAI is a skill or function that agents can utilize to perform various actions.
+This includes tools from the [CrewAI Toolkit](https://github.com/joaomdmoura/crewai-tools) and [LangChain Tools](https://python.langchain.com/docs/integrations/tools),
+enabling everything from simple searches to complex interactions and effective teamwork among agents.
## Key Characteristics of Tools
@@ -18,7 +22,7 @@ CrewAI tools empower agents with capabilities ranging from web searching and dat
- **Error Handling**: Incorporates robust error handling mechanisms to ensure smooth operation.
- **Caching Mechanism**: Features intelligent caching to optimize performance and reduce redundant operations.
-## Using crewAI Tools
+## Using CrewAI Tools
To enhance your agents' capabilities with crewAI tools, begin by installing our extra tools package:
@@ -28,7 +32,7 @@ pip install 'crewai[tools]'
Here's an example demonstrating their use:
-```python
+```python Code
import os
from crewai import Agent, Task, Crew
# Importing crewAI tools
@@ -92,7 +96,7 @@ crew = Crew(
crew.kickoff()
```
-## Available crewAI Tools
+## Available CrewAI Tools
- **Error Handling**: All tools are built with error handling capabilities, allowing agents to gracefully manage exceptions and continue their tasks.
- **Caching Mechanism**: All tools support caching, enabling agents to efficiently reuse previously obtained results, reducing the load on external resources and speeding up the execution time. You can also define finer control over the caching mechanism using the `cache_function` attribute on the tool.
@@ -134,20 +138,21 @@ Here is a list of the available tools and their descriptions:
## Creating your own Tools
-!!! example "Custom Tool Creation"
- Developers can craft custom tools tailored for their agentβs needs or utilize pre-built options:
+
+ Developers can craft `custom tools` tailored for their agentβs needs or utilize pre-built options.
+
-To create your own crewAI tools you will need to install our extra tools package:
+To create your own CrewAI tools you will need to install our extra tools package:
```bash
pip install 'crewai[tools]'
```
-Once you do that there are two main ways for one to create a crewAI tool:
+Once you do that there are two main ways for one to create a CrewAI tool:
### Subclassing `BaseTool`
-```python
+```python Code
from crewai_tools import BaseTool
class MyCustomTool(BaseTool):
@@ -161,7 +166,7 @@ class MyCustomTool(BaseTool):
### Utilizing the `tool` Decorator
-```python
+```python Code
from crewai_tools import tool
@tool("Name of my tool")
def my_tool(question: str) -> str:
@@ -171,10 +176,12 @@ def my_tool(question: str) -> str:
```
### Custom Caching Mechanism
-!!! note "Caching"
- Tools can optionally implement a `cache_function` to fine-tune caching behavior. This function determines when to cache results based on specific conditions, offering granular control over caching logic.
-```python
+
+ Tools can optionally implement a `cache_function` to fine-tune caching behavior. This function determines when to cache results based on specific conditions, offering granular control over caching logic.
+
+
+```python Code
from crewai_tools import tool
@tool
@@ -200,4 +207,7 @@ writer1 = Agent(
```
## Conclusion
-Tools are pivotal in extending the capabilities of CrewAI agents, enabling them to undertake a broad spectrum of tasks and collaborate effectively. When building solutions with CrewAI, leverage both custom and existing tools to empower your agents and enhance the AI ecosystem. Consider utilizing error handling, caching mechanisms, and the flexibility of tool arguments to optimize your agents' performance and capabilities.
\ No newline at end of file
+
+Tools are pivotal in extending the capabilities of CrewAI agents, enabling them to undertake a broad spectrum of tasks and collaborate effectively.
+When building solutions with CrewAI, leverage both custom and existing tools to empower your agents and enhance the AI ecosystem. Consider utilizing error handling,
+caching mechanisms, and the flexibility of tool arguments to optimize your agents' performance and capabilities.
\ No newline at end of file
diff --git a/docs/core-concepts/Training-Crew.md b/docs/concepts/training.mdx
similarity index 71%
rename from docs/core-concepts/Training-Crew.md
rename to docs/concepts/training.mdx
index 351155bf7..549763fde 100644
--- a/docs/core-concepts/Training-Crew.md
+++ b/docs/concepts/training.mdx
@@ -1,14 +1,19 @@
---
-title: crewAI Train
-description: Learn how to train your crewAI agents by giving them feedback early on and get consistent results.
+title: Training
+description: Learn how to train your CrewAI agents by giving them feedback early on and get consistent results.
+icon: dumbbell
---
## Introduction
-The training feature in CrewAI allows you to train your AI agents using the command-line interface (CLI). By running the command `crewai train -n `, you can specify the number of iterations for the training process.
-During training, CrewAI utilizes techniques to optimize the performance of your agents along with human feedback. This helps the agents improve their understanding, decision-making, and problem-solving abilities.
+The training feature in CrewAI allows you to train your AI agents using the command-line interface (CLI).
+By running the command `crewai train -n `, you can specify the number of iterations for the training process.
+
+During training, CrewAI utilizes techniques to optimize the performance of your agents along with human feedback.
+This helps the agents improve their understanding, decision-making, and problem-solving abilities.
### Training Your Crew Using the CLI
+
To use the training feature, follow these steps:
1. Open your terminal or command prompt.
@@ -18,29 +23,36 @@ To use the training feature, follow these steps:
```shell
crewai train -n (optional)
```
-
-!!! note "Replace `` with the desired number of training iterations and `` with the appropriate filename ending with `.pkl`."
+
+ Replace `` with the desired number of training iterations and `` with the appropriate filename ending with `.pkl`.
+
### Training Your Crew Programmatically
+
To train your crew programmatically, use the following steps:
1. Define the number of iterations for training.
2. Specify the input parameters for the training process.
3. Execute the training command within a try-except block to handle potential errors.
-```python
+```python Code
n_iterations = 2
inputs = {"topic": "CrewAI Training"}
filename = "your_model.pkl"
try:
- YourCrewName_Crew().crew().train(n_iterations=n_iterations, inputs=inputs, filename=filename)
+ YourCrewName_Crew().crew().train(
+ n_iterations=n_iterations,
+ inputs=inputs,
+ filename=filename
+ )
except Exception as e:
raise Exception(f"An error occurred while training the crew: {e}")
```
-### Key Points to Note:
+### Key Points to Note
+
- **Positive Integer Requirement:** Ensure that the number of iterations (`n_iterations`) is a positive integer. The code will raise a `ValueError` if this condition is not met.
- **Filename Requirement:** Ensure that the filename ends with `.pkl`. The code will raise a `ValueError` if this condition is not met.
- **Error Handling:** The code handles subprocess errors and unexpected exceptions, providing error messages to the user.
@@ -51,4 +63,5 @@ Once the training is complete, your agents will be equipped with enhanced capabi
Remember to regularly update and retrain your agents to ensure they stay up-to-date with the latest information and advancements in the field.
-Happy training with CrewAI!
\ No newline at end of file
+Happy training with CrewAI! π
+
\ No newline at end of file
diff --git a/docs/core-concepts/Collaboration.md b/docs/core-concepts/Collaboration.md
deleted file mode 100644
index 0f28288bb..000000000
--- a/docs/core-concepts/Collaboration.md
+++ /dev/null
@@ -1,45 +0,0 @@
----
-title: How Agents Collaborate in CrewAI
-description: Exploring the dynamics of agent collaboration within the CrewAI framework, focusing on the newly integrated features for enhanced functionality.
----
-
-## Collaboration Fundamentals
-!!! note "Core of Agent Interaction"
- Collaboration in CrewAI is fundamental, enabling agents to combine their skills, share information, and assist each other in task execution, embodying a truly cooperative ecosystem.
-
-- **Information Sharing**: Ensures all agents are well-informed and can contribute effectively by sharing data and findings.
-- **Task Assistance**: Allows agents to seek help from peers with the required expertise for specific tasks.
-- **Resource Allocation**: Optimizes task execution through the efficient distribution and sharing of resources among agents.
-
-## Enhanced Attributes for Improved Collaboration
-The `Crew` class has been enriched with several attributes to support advanced functionalities:
-
-- **Language Model Management (`manager_llm`, `function_calling_llm`)**: Manages language models for executing tasks and tools, facilitating sophisticated agent-tool interactions. Note that while `manager_llm` is mandatory for hierarchical processes to ensure proper execution flow, `function_calling_llm` is optional, with a default value provided for streamlined tool interaction.
-- **Custom Manager Agent (`manager_agent`)**: Allows specifying a custom agent as the manager instead of using the default manager provided by CrewAI.
-- **Process Flow (`process`)**: Defines the execution logic (e.g., sequential, hierarchical) to streamline task distribution and execution.
-- **Verbose Logging (`verbose`)**: Offers detailed logging capabilities for monitoring and debugging purposes. It supports both integer and boolean types to indicate the verbosity level. For example, setting `verbose` to 1 might enable basic logging, whereas setting it to True enables more detailed logs.
-- **Rate Limiting (`max_rpm`)**: Ensures efficient utilization of resources by limiting requests per minute. Guidelines for setting `max_rpm` should consider the complexity of tasks and the expected load on resources.
-- **Internationalization / Customization Support (`language`, `prompt_file`)**: Facilitates full customization of the inner prompts, enhancing global usability. Supported languages and the process for utilizing the `prompt_file` attribute for customization should be clearly documented. [Example of file](https://github.com/joaomdmoura/crewAI/blob/main/src/crewai/translations/en.json)
-- **Execution and Output Handling (`full_output`)**: Distinguishes between full and final outputs for nuanced control over task results. Examples showcasing the difference in outputs can aid in understanding the practical implications of this attribute.
-- **Callback and Telemetry (`step_callback`, `task_callback`)**: Integrates callbacks for step-wise and task-level execution monitoring, alongside telemetry for performance analytics. The purpose and usage of `task_callback` alongside `step_callback` for granular monitoring should be clearly explained.
-- **Crew Sharing (`share_crew`)**: Enables sharing of crew information with CrewAI for continuous improvement and training models. The privacy implications and benefits of this feature, including how it contributes to model improvement, should be outlined.
-- **Usage Metrics (`usage_metrics`)**: Stores all metrics for the language model (LLM) usage during all tasks' execution, providing insights into operational efficiency and areas for improvement. Detailed information on accessing and interpreting these metrics for performance analysis should be provided.
-- **Memory Usage (`memory`)**: Indicates whether the crew should use memory to store memories of its execution, enhancing task execution and agent learning.
-- **Memory Provider (`memory_provider`)**: Specifies the memory provider to be used by the crew for storing memories.
-- **Embedder Configuration (`embedder`)**: Specifies the configuration for the embedder to be used by the crew for understanding and generating language. This attribute supports customization of the language model provider.
-- **Cache Management (`cache`)**: Determines whether the crew should use a cache to store the results of tool executions, optimizing performance.
-- **Output Logging (`output_log_file`)**: Specifies the file path for logging the output of the crew's execution.
-- **Planning Mode (`planning`)**: Allows crews to plan their actions before executing tasks by setting `planning=True` when creating the `Crew` instance. This feature enhances coordination and efficiency.
-- **Replay Feature**: Introduces a new CLI for listing tasks from the last run and replaying from a specific task, enhancing task management and troubleshooting.
-
-## Delegation: Dividing to Conquer
-Delegation enhances functionality by allowing agents to intelligently assign tasks or seek help, thereby amplifying the crew's overall capability.
-
-## Implementing Collaboration and Delegation
-Setting up a crew involves defining the roles and capabilities of each agent. CrewAI seamlessly manages their interactions, ensuring efficient collaboration and delegation, with enhanced customization and monitoring features to adapt to various operational needs.
-
-## Example Scenario
-Consider a crew with a researcher agent tasked with data gathering and a writer agent responsible for compiling reports. The integration of advanced language model management and process flow attributes allows for more sophisticated interactions, such as the writer delegating complex research tasks to the researcher or querying specific information, thereby facilitating a seamless workflow.
-
-## Conclusion
-The integration of advanced attributes and functionalities into the CrewAI framework significantly enriches the agent collaboration ecosystem. These enhancements not only simplify interactions but also offer unprecedented flexibility and control, paving the way for sophisticated AI-driven solutions capable of tackling complex tasks through intelligent collaboration and delegation.
\ No newline at end of file
diff --git a/docs/core-concepts/LLMs.md b/docs/core-concepts/LLMs.md
deleted file mode 100644
index 7ae3e6948..000000000
--- a/docs/core-concepts/LLMs.md
+++ /dev/null
@@ -1,155 +0,0 @@
-# Large Language Models (LLMs) in crewAI
-
-## Introduction
-Large Language Models (LLMs) are the backbone of intelligent agents in the crewAI framework. This guide will help you understand, configure, and optimize LLM usage for your crewAI projects.
-
-## Table of Contents
-- [Key Concepts](#key-concepts)
-- [Configuring LLMs for Agents](#configuring-llms-for-agents)
- - [1. Default Configuration](#1-default-configuration)
- - [2. String Identifier](#2-string-identifier)
- - [3. LLM Instance](#3-llm-instance)
- - [4. Custom LLM Objects](#4-custom-llm-objects)
-- [Connecting to OpenAI-Compatible LLMs](#connecting-to-openai-compatible-llms)
-- [LLM Configuration Options](#llm-configuration-options)
-- [Using Ollama (Local LLMs)](#using-ollama-local-llms)
-- [Changing the Base API URL](#changing-the-base-api-url)
-- [Best Practices](#best-practices)
-- [Troubleshooting](#troubleshooting)
-
-## Key Concepts
-- **LLM**: Large Language Model, the AI powering agent intelligence
-- **Agent**: A crewAI entity that uses an LLM to perform tasks
-- **Provider**: A service that offers LLM capabilities (e.g., OpenAI, Anthropic, Ollama, [more providers](https://docs.litellm.ai/docs/providers))
-
-## Configuring LLMs for Agents
-
-crewAI offers flexible options for setting up LLMs:
-
-### 1. Default Configuration
-By default, crewAI uses the `gpt-4o-mini` model. It uses environment variables if no LLM is specified:
-- `OPENAI_MODEL_NAME` (defaults to "gpt-4o-mini" if not set)
-- `OPENAI_API_BASE`
-- `OPENAI_API_KEY`
-
-### 2. String Identifier
-```python
-agent = Agent(llm="gpt-4o", ...)
-```
-
-### 3. LLM Instance
-List of [more providers](https://docs.litellm.ai/docs/providers).
-```python
-from crewai import LLM
-
-llm = LLM(model="gpt-4", temperature=0.7)
-agent = Agent(llm=llm, ...)
-```
-
-### 4. Custom LLM Objects
-Pass a custom LLM implementation or object from another library.
-
-## Connecting to OpenAI-Compatible LLMs
-
-You can connect to OpenAI-compatible LLMs using either environment variables or by setting specific attributes on the LLM class:
-
-1. Using environment variables:
-```python
-import os
-
-os.environ["OPENAI_API_KEY"] = "your-api-key"
-os.environ["OPENAI_API_BASE"] = "https://api.your-provider.com/v1"
-```
-
-2. Using LLM class attributes:
-```python
-llm = LLM(
- model="custom-model-name",
- api_key="your-api-key",
- base_url="https://api.your-provider.com/v1"
-)
-agent = Agent(llm=llm, ...)
-```
-
-## LLM Configuration Options
-
-When configuring an LLM for your agent, you have access to a wide range of parameters:
-
-| Parameter | Type | Description |
-|-----------|------|-------------|
-| `model` | str | The name of the model to use (e.g., "gpt-4", "gpt-3.5-turbo", "ollama/llama3.1", [more providers](https://docs.litellm.ai/docs/providers)) |
-| `timeout` | float, int | Maximum time (in seconds) to wait for a response |
-| `temperature` | float | Controls randomness in output (0.0 to 1.0) |
-| `top_p` | float | Controls diversity of output (0.0 to 1.0) |
-| `n` | int | Number of completions to generate |
-| `stop` | str, List[str] | Sequence(s) to stop generation |
-| `max_tokens` | int | Maximum number of tokens to generate |
-| `presence_penalty` | float | Penalizes new tokens based on their presence in the text so far |
-| `frequency_penalty` | float | Penalizes new tokens based on their frequency in the text so far |
-| `logit_bias` | Dict[int, float] | Modifies likelihood of specified tokens appearing in the completion |
-| `response_format` | Dict[str, Any] | Specifies the format of the response (e.g., {"type": "json_object"}) |
-| `seed` | int | Sets a random seed for deterministic results |
-| `logprobs` | bool | Whether to return log probabilities of the output tokens |
-| `top_logprobs` | int | Number of most likely tokens to return the log probabilities for |
-| `base_url` | str | The base URL for the API endpoint |
-| `api_version` | str | The version of the API to use |
-| `api_key` | str | Your API key for authentication |
-
-Example:
-```python
-llm = LLM(
- model="gpt-4",
- temperature=0.8,
- max_tokens=150,
- top_p=0.9,
- frequency_penalty=0.1,
- presence_penalty=0.1,
- stop=["END"],
- seed=42,
- base_url="https://api.openai.com/v1",
- api_key="your-api-key-here"
-)
-agent = Agent(llm=llm, ...)
-```
-
-## Using Ollama (Local LLMs)
-
-crewAI supports using Ollama for running open-source models locally:
-
-1. Install Ollama: [ollama.ai](https://ollama.ai/)
-2. Run a model: `ollama run llama2`
-3. Configure agent:
-```python
-agent = Agent(
- llm=LLM(model="ollama/llama3.1", base_url="http://localhost:11434"),
- ...
-)
-```
-
-## Changing the Base API URL
-
-You can change the base API URL for any LLM provider by setting the `base_url` parameter:
-
-```python
-llm = LLM(
- model="custom-model-name",
- base_url="https://api.your-provider.com/v1",
- api_key="your-api-key"
-)
-agent = Agent(llm=llm, ...)
-```
-
-This is particularly useful when working with OpenAI-compatible APIs or when you need to specify a different endpoint for your chosen provider.
-
-## Best Practices
-1. **Choose the right model**: Balance capability and cost.
-2. **Optimize prompts**: Clear, concise instructions improve output.
-3. **Manage tokens**: Monitor and limit token usage for efficiency.
-4. **Use appropriate temperature**: Lower for factual tasks, higher for creative ones.
-5. **Implement error handling**: Gracefully manage API errors and rate limits.
-
-## Troubleshooting
-- **API Errors**: Check your API key, network connection, and rate limits.
-- **Unexpected Outputs**: Refine your prompts and adjust temperature or top_p.
-- **Performance Issues**: Consider using a more powerful model or optimizing your queries.
-- **Timeout Errors**: Increase the `timeout` parameter or optimize your input.
\ No newline at end of file
diff --git a/docs/core-concepts/Testing.md b/docs/core-concepts/Testing.md
deleted file mode 100644
index b00d5f07d..000000000
--- a/docs/core-concepts/Testing.md
+++ /dev/null
@@ -1,56 +0,0 @@
----
-title: crewAI Testing
-description: Learn how to test your crewAI Crew and evaluate their performance.
----
-
-## Introduction
-
-Testing is a crucial part of the development process, and it is essential to ensure that your crew is performing as expected. With crewAI, you can easily test your crew and evaluate its performance using the built-in testing capabilities.
-
-### Using the Testing Feature
-
-We added the CLI command `crewai test` to make it easy to test your crew. This command will run your crew for a specified number of iterations and provide detailed performance metrics. The parameters are `n_iterations` and `model`, which are optional and default to 2 and `gpt-4o-mini` respectively. For now, the only provider available is OpenAI.
-
-```bash
-crewai test
-```
-
-If you want to run more iterations or use a different model, you can specify the parameters like this:
-
-```bash
-crewai test --n_iterations 5 --model gpt-4o
-```
-
-or using the short forms:
-
-```bash
-crewai test -n 5 -m gpt-4o
-```
-
-When you run the `crewai test` command, the crew will be executed for the specified number of iterations, and the performance metrics will be displayed at the end of the run.
-
-A table of scores at the end will show the performance of the crew in terms of the following metrics:
-
-```
- Tasks Scores
- (1-10 Higher is better)
-ββββββββββββββββββββββ―ββββββββ―ββββββββ―βββββββββββββ―βββββββββββββββββββββββββββββββββ―ββββββββββββββββββββββββββββββββββ
-β Tasks/Crew/Agents β Run 1 β Run 2 β Avg. Total β Agents β β
-β βββββββββββββββββββββΌββββββββΌββββββββΌβββββββββββββΌβββββββββββββββββββββββββββββββββΌββββββββββββββββββββββββββββββββββ¨
-β Task 1 β 9.0 β 9.5 β 9.2 β - Professional Insights β β
-β β β β β Researcher β β
-β β β β β β β
-β Task 2 β 9.0 β 10.0 β 9.5 β - Company Profile Investigator β β
-β β β β β β β
-β Task 3 β 9.0 β 9.0 β 9.0 β - Automation Insights β β
-β β β β β Specialist β β
-β β β β β β β
-β Task 4 β 9.0 β 9.0 β 9.0 β - Final Report Compiler β β
-β β β β β β - Automation Insights β
-β β β β β β Specialist β
-β Crew β 9.00 β 9.38 β 9.2 β β β
-β Execution Time (s) β 126 β 145 β 135 β β β
-ββββββββββββββββββββββ·ββββββββ·ββββββββ·βββββββββββββ·βββββββββββββββββββββββββββββββββ·ββββββββββββββββββββββββββββββββββ
-```
-
-The example above shows the test results for two runs of the crew with two tasks, with the average total score for each task and the crew as a whole.
diff --git a/docs/examples/example.mdx b/docs/examples/example.mdx
new file mode 100644
index 000000000..f92da4a2c
--- /dev/null
+++ b/docs/examples/example.mdx
@@ -0,0 +1,62 @@
+---
+title: CrewAI Examples
+description: A collection of examples that show how to use CrewAI framework to automate workflows.
+icon: rocket-launch
+---
+
+
+
+ Automate marketing strategy creation with CrewAI.
+
+
+ Create a surprise trip itinerary with CrewAI.
+
+
+ Match a profile to jobpositions with CrewAI.
+
+
+ Create a job posting with CrewAI.
+
+
+ Create a game with CrewAI.
+
+
+ Find job candidates with CrewAI.
+
+
diff --git a/docs/favicon.svg b/docs/favicon.svg
new file mode 100644
index 000000000..495491f39
--- /dev/null
+++ b/docs/favicon.svg
@@ -0,0 +1,18 @@
+
+
+
diff --git a/docs/getting-started/Create-a-New-CrewAI-Pipeline-Template-Method.md b/docs/getting-started/Create-a-New-CrewAI-Pipeline-Template-Method.md
deleted file mode 100644
index 558cbd61d..000000000
--- a/docs/getting-started/Create-a-New-CrewAI-Pipeline-Template-Method.md
+++ /dev/null
@@ -1,163 +0,0 @@
-# Creating a CrewAI Pipeline Project
-
-Welcome to the comprehensive guide for creating a new CrewAI pipeline project. This document will walk you through the steps to create, customize, and run your CrewAI pipeline project, ensuring you have everything you need to get started.
-
-To learn more about CrewAI pipelines, visit the [CrewAI documentation](https://docs.crewai.com/core-concepts/Pipeline/).
-
-## Prerequisites
-
-Before getting started with CrewAI pipelines, make sure that you have installed CrewAI via pip:
-
-```shell
-$ pip install crewai crewai-tools
-```
-
-The same prerequisites for virtual environments and Code IDEs apply as in regular CrewAI projects.
-
-## Creating a New Pipeline Project
-
-To create a new CrewAI pipeline project, you have two options:
-
-1. For a basic pipeline template:
-
-```shell
-$ crewai create pipeline
-```
-
-2. For a pipeline example that includes a router:
-
-```shell
-$ crewai create pipeline --router
-```
-
-These commands will create a new project folder with the following structure:
-
-```
-/
-βββ README.md
-βββ poetry.lock
-βββ pyproject.toml
-βββ src/
-β βββ /
-β βββ __init__.py
-β βββ main.py
-β βββ crews/
-β β βββ crew1/
-β β β βββ crew1.py
-β β β βββ config/
-β β β βββ agents.yaml
-β β β βββ tasks.yaml
-β β βββ crew2/
-β β β βββ crew2.py
-β β β βββ config/
-β β β βββ agents.yaml
-β β β βββ tasks.yaml
-β βββ pipelines/
-β β βββ __init__.py
-β β βββ pipeline1.py
-β β βββ pipeline2.py
-β βββ tools/
-β βββ __init__.py
-β βββ custom_tool.py
-βββ tests/
-```
-
-## Customizing Your Pipeline Project
-
-To customize your pipeline project, you can:
-
-1. Modify the crew files in `src//crews/` to define your agents and tasks for each crew.
-2. Modify the pipeline files in `src//pipelines/` to define your pipeline structure.
-3. Modify `src//main.py` to set up and run your pipelines.
-4. Add your environment variables into the `.env` file.
-
-## Example 1: Defining a Two-Stage Sequential Pipeline
-
-Here's an example of how to define a pipeline with sequential stages in `src//pipelines/pipeline.py`:
-
-```python
-from crewai import Pipeline
-from crewai.project import PipelineBase
-from ..crews.research_crew.research_crew import ResearchCrew
-from ..crews.write_x_crew.write_x_crew import WriteXCrew
-
-@PipelineBase
-class SequentialPipeline:
- def __init__(self):
- # Initialize crews
- self.research_crew = ResearchCrew().crew()
- self.write_x_crew = WriteXCrew().crew()
-
- def create_pipeline(self):
- return Pipeline(
- stages=[
- self.research_crew,
- self.write_x_crew
- ]
- )
-
- async def kickoff(self, inputs):
- pipeline = self.create_pipeline()
- results = await pipeline.kickoff(inputs)
- return results
-```
-
-## Example 2: Defining a Two-Stage Pipeline with Parallel Execution
-
-```python
-from crewai import Pipeline
-from crewai.project import PipelineBase
-from ..crews.research_crew.research_crew import ResearchCrew
-from ..crews.write_x_crew.write_x_crew import WriteXCrew
-from ..crews.write_linkedin_crew.write_linkedin_crew import WriteLinkedInCrew
-
-@PipelineBase
-class ParallelExecutionPipeline:
- def __init__(self):
- # Initialize crews
- self.research_crew = ResearchCrew().crew()
- self.write_x_crew = WriteXCrew().crew()
- self.write_linkedin_crew = WriteLinkedInCrew().crew()
-
- def create_pipeline(self):
- return Pipeline(
- stages=[
- self.research_crew,
- [self.write_x_crew, self.write_linkedin_crew] # Parallel execution
- ]
- )
-
- async def kickoff(self, inputs):
- pipeline = self.create_pipeline()
- results = await pipeline.kickoff(inputs)
- return results
-```
-
-### Annotations
-
-The main annotation you'll use for pipelines is `@PipelineBase`. This annotation is used to decorate your pipeline classes, similar to how `@CrewBase` is used for crews.
-
-## Installing Dependencies
-
-To install the dependencies for your project, use Poetry:
-
-```shell
-$ cd
-$ crewai install
-```
-
-## Running Your Pipeline Project
-
-To run your pipeline project, use the following command:
-
-```shell
-$ crewai run
-```
-
-This will initialize your pipeline and begin task execution as defined in your `main.py` file.
-
-## Deploying Your Pipeline Project
-
-Pipelines can be deployed in the same way as regular CrewAI projects. The easiest way is through [CrewAI+](https://www.crewai.com/crewaiplus), where you can deploy your pipeline in a few clicks.
-
-Remember, when working with pipelines, you're orchestrating multiple crews to work together in a sequence or parallel fashion. This allows for more complex workflows and information processing tasks.
\ No newline at end of file
diff --git a/docs/getting-started/Installing-CrewAI.md b/docs/getting-started/Installing-CrewAI.md
deleted file mode 100644
index 8bf58ee01..000000000
--- a/docs/getting-started/Installing-CrewAI.md
+++ /dev/null
@@ -1,24 +0,0 @@
----
-title: Installing crewAI
-description: A comprehensive guide to installing crewAI and its dependencies, including the latest updates and installation methods.
----
-
-# Installing crewAI
-
-Welcome to crewAI! This guide will walk you through the installation process for crewAI and its dependencies. crewAI is a flexible and powerful AI framework that enables you to create and manage AI agents, tools, and tasks efficiently. Let's get started!
-
-## Installation
-
-To install crewAI, you need to have Python >=3.10 and <=3.13 installed on your system:
-
-```shell
-# Install the main crewAI package
-pip install crewai
-
-# Install the main crewAI package and the tools package
-# that includes a series of helpful tools for your agents
-pip install 'crewai[tools]'
-
-# Alternatively, you can also use:
-pip install crewai crewai-tools
-```
\ No newline at end of file
diff --git a/docs/getting-started/Start-a-New-CrewAI-Project-Template-Method.md b/docs/getting-started/Start-a-New-CrewAI-Project-Template-Method.md
deleted file mode 100644
index dc0e539f2..000000000
--- a/docs/getting-started/Start-a-New-CrewAI-Project-Template-Method.md
+++ /dev/null
@@ -1,236 +0,0 @@
----
-
-title: Starting a New CrewAI Project - Using Template
-
-description: A comprehensive guide to starting a new CrewAI project, including the latest updates and project setup methods.
----
-
-# Starting Your CrewAI Project
-
-Welcome to the ultimate guide for starting a new CrewAI project. This document will walk you through the steps to create, customize, and run your CrewAI project, ensuring you have everything you need to get started.
-
-Before we start, there are a couple of things to note:
-
-1. CrewAI is a Python package and requires Python >=3.10 and <=3.13 to run.
-2. The preferred way of setting up CrewAI is using the `crewai create crew` command. This will create a new project folder and install a skeleton template for you to work on.
-
-## Prerequisites
-
-Before getting started with CrewAI, make sure that you have installed it via pip:
-
-```shell
-$ pip install 'crewai[tools]'
-```
-
-## Creating a New Project
-
-In this example, we will be using poetry as our virtual environment manager.
-
-To create a new CrewAI project, run the following CLI command:
-
-```shell
-$ crewai create crew
-```
-
-This command will create a new project folder with the following structure:
-
-```shell
-my_project/
-βββ .gitignore
-βββ pyproject.toml
-βββ README.md
-βββ src/
- βββ my_project/
- βββ __init__.py
- βββ main.py
- βββ crew.py
- βββ tools/
- β βββ custom_tool.py
- β βββ __init__.py
- βββ config/
- βββ agents.yaml
- βββ tasks.yaml
-```
-
-You can now start developing your project by editing the files in the `src/my_project` folder. The `main.py` file is the entry point of your project, and the `crew.py` file is where you define your agents and tasks.
-
-## Customizing Your Project
-
-To customize your project, you can:
-- Modify `src/my_project/config/agents.yaml` to define your agents.
-- Modify `src/my_project/config/tasks.yaml` to define your tasks.
-- Modify `src/my_project/crew.py` to add your own logic, tools, and specific arguments.
-- Modify `src/my_project/main.py` to add custom inputs for your agents and tasks.
-- Add your environment variables into the `.env` file.
-
-### Example: Defining Agents and Tasks
-
-#### agents.yaml
-
-```yaml
-researcher:
- role: >
- Job Candidate Researcher
- goal: >
- Find potential candidates for the job
- backstory: >
- You are adept at finding the right candidates by exploring various online
- resources. Your skill in identifying suitable candidates ensures the best
- match for job positions.
-```
-
-#### tasks.yaml
-
-```yaml
-research_candidates_task:
- description: >
- Conduct thorough research to find potential candidates for the specified job.
- Utilize various online resources and databases to gather a comprehensive list of potential candidates.
- Ensure that the candidates meet the job requirements provided.
-
- Job Requirements:
- {job_requirements}
- expected_output: >
- A list of 10 potential candidates with their contact information and brief profiles highlighting their suitability.
- agent: researcher # THIS NEEDS TO MATCH THE AGENT NAME IN THE AGENTS.YAML FILE AND THE AGENT DEFINED IN THE crew.py FILE
- context: # THESE NEED TO MATCH THE TASK NAMES DEFINED ABOVE AND THE TASKS.YAML FILE AND THE TASK DEFINED IN THE crew.py FILE
- - researcher
-```
-
-### Referencing Variables:
-
-Your defined functions with the same name will be used. For example, you can reference the agent for specific tasks from `tasks.yaml` file. Ensure your annotated agent and function name are the same; otherwise, your task won't recognize the reference properly.
-
-#### Example References
-
-`agents.yaml`
-
-```yaml
-email_summarizer:
- role: >
- Email Summarizer
- goal: >
- Summarize emails into a concise and clear summary
- backstory: >
- You will create a 5 bullet point summary of the report
- llm: mixtal_llm
-```
-
-`tasks.yaml`
-
-```yaml
-email_summarizer_task:
- description: >
- Summarize the email into a 5 bullet point summary
- expected_output: >
- A 5 bullet point summary of the email
- agent: email_summarizer
- context:
- - reporting_task
- - research_task
-```
-
-Use the annotations to properly reference the agent and task in the `crew.py` file.
-
-### Annotations include:
-
-* `@agent`
-* `@task`
-* `@crew`
-* `@tool`
-* `@callback`
-* `@output_json`
-* `@output_pydantic`
-* `@cache_handler`
-
-`crew.py`
-
-```python
-# ...
-@agent
-def email_summarizer(self) -> Agent:
- return Agent(
- config=self.agents_config["email_summarizer"],
- )
-
-@task
-def email_summarizer_task(self) -> Task:
- return Task(
- config=self.tasks_config["email_summarizer_task"],
- )
-# ...
-```
-
-## Installing Dependencies
-
-To install the dependencies for your project, you can use Poetry. First, navigate to your project directory:
-
-```shell
-$ cd my_project
-$ crewai install
-```
-
-This will install the dependencies specified in the `pyproject.toml` file.
-
-## Interpolating Variables
-
-Any variable interpolated in your `agents.yaml` and `tasks.yaml` files like `{variable}` will be replaced by the value of the variable in the `main.py` file.
-
-#### tasks.yaml
-
-```yaml
-research_task:
- description: >
- Conduct a thorough research about the customer and competitors in the context
- of {customer_domain}.
- Make sure you find any interesting and relevant information given the
- current year is 2024.
- expected_output: >
- A complete report on the customer and their customers and competitors,
- including their demographics, preferences, market positioning and audience engagement.
-```
-
-#### main.py
-
-```python
-# main.py
-def run():
- inputs = {
- "customer_domain": "crewai.com"
- }
- MyProjectCrew(inputs).crew().kickoff(inputs=inputs)
-```
-
-## Running Your Project
-
-To run your project, use the following command:
-
-```shell
-$ crewai run
-```
-
-This will initialize your crew of AI agents and begin task execution as defined in your configuration in the `main.py` file.
-
-### Replay Tasks from Latest Crew Kickoff
-
-CrewAI now includes a replay feature that allows you to list the tasks from the last run and replay from a specific one. To use this feature, run:
-
-```shell
-$ crewai replay
-```
-
-Replace `` with the ID of the task you want to replay.
-
-### Reset Crew Memory
-
-If you need to reset the memory of your crew before running it again, you can do so by calling the reset memory feature:
-
-```shell
-$ crewai reset-memory
-```
-
-This will clear the crew's memory, allowing for a fresh start.
-
-## Deploying Your Project
-
-The easiest way to deploy your crew is through [CrewAI+](https://www.crewai.com/crewaiplus), where you can deploy your crew in a few clicks.
diff --git a/docs/how-to/AgentOps-Observability.md b/docs/how-to/AgentOps-Observability.md
deleted file mode 100644
index 4f517d007..000000000
--- a/docs/how-to/AgentOps-Observability.md
+++ /dev/null
@@ -1,86 +0,0 @@
----
-title: Agent Monitoring with AgentOps
-description: Understanding and logging your agent performance with AgentOps.
----
-
-# Intro
-Observability is a key aspect of developing and deploying conversational AI agents. It allows developers to understand how their agents are performing, how their agents are interacting with users, and how their agents use external tools and APIs. AgentOps is a product independent of CrewAI that provides a comprehensive observability solution for agents.
-
-## AgentOps
-
-[AgentOps](https://agentops.ai/?=crew) provides session replays, metrics, and monitoring for agents.
-
-At a high level, AgentOps gives you the ability to monitor cost, token usage, latency, agent failures, session-wide statistics, and more. For more info, check out the [AgentOps Repo](https://github.com/AgentOps-AI/agentops).
-
-### Overview
-AgentOps provides monitoring for agents in development and production. It provides a dashboard for tracking agent performance, session replays, and custom reporting.
-
-Additionally, AgentOps provides session drilldowns for viewing Crew agent interactions, LLM calls, and tool usage in real-time. This feature is useful for debugging and understanding how agents interact with users as well as other agents.
-
-
-
-
-
-### Features
-- **LLM Cost Management and Tracking**: Track spend with foundation model providers.
-- **Replay Analytics**: Watch step-by-step agent execution graphs.
-- **Recursive Thought Detection**: Identify when agents fall into infinite loops.
-- **Custom Reporting**: Create custom analytics on agent performance.
-- **Analytics Dashboard**: Monitor high-level statistics about agents in development and production.
-- **Public Model Testing**: Test your agents against benchmarks and leaderboards.
-- **Custom Tests**: Run your agents against domain-specific tests.
-- **Time Travel Debugging**: Restart your sessions from checkpoints.
-- **Compliance and Security**: Create audit logs and detect potential threats such as profanity and PII leaks.
-- **Prompt Injection Detection**: Identify potential code injection and secret leaks.
-
-### Using AgentOps
-
-1. **Create an API Key:**
- Create a user API key here: [Create API Key](https://app.agentops.ai/account)
-
-2. **Configure Your Environment:**
- Add your API key to your environment variables
-
- ```bash
- AGENTOPS_API_KEY=
- ```
-
-3. **Install AgentOps:**
- Install AgentOps with:
- ```bash
- pip install crewai[agentops]
- ```
- or
- ```bash
- pip install agentops
- ```
-
- Before using `Crew` in your script, include these lines:
-
- ```python
- import agentops
- agentops.init()
- ```
-
- This will initiate an AgentOps session as well as automatically track Crew agents. For further info on how to outfit more complex agentic systems, check out the [AgentOps documentation](https://docs.agentops.ai) or join the [Discord](https://discord.gg/j4f3KbeH).
-
-### Crew + AgentOps Examples
-- [Job Posting](https://github.com/joaomdmoura/crewAI-examples/tree/main/job-posting)
-- [Markdown Validator](https://github.com/joaomdmoura/crewAI-examples/tree/main/markdown_validator)
-- [Instagram Post](https://github.com/joaomdmoura/crewAI-examples/tree/main/instagram_post)
-
-### Further Information
-
-To get started, create an [AgentOps account](https://agentops.ai/?=crew).
-
-For feature requests or bug reports, please reach out to the AgentOps team on the [AgentOps Repo](https://github.com/AgentOps-AI/agentops).
-
-#### Extra links
-
-π¦ Twitter
- β’
-π’ Discord
- β’
-ποΈ AgentOps Dashboard
- β’
-π Documentation
diff --git a/docs/how-to/Customize-Prompts.md b/docs/how-to/Customize-Prompts.md
deleted file mode 100644
index 85cb530b2..000000000
--- a/docs/how-to/Customize-Prompts.md
+++ /dev/null
@@ -1,94 +0,0 @@
----
-title: Initial Support to Bring Your Own Prompts in CrewAI
-description: Enhancing customization and internationalization by allowing users to bring their own prompts in CrewAI.
-
----
-
-# Initial Support to Bring Your Own Prompts in CrewAI
-
-CrewAI now supports the ability to bring your own prompts, enabling extensive customization and internationalization. This feature allows users to tailor the inner workings of their agents to better suit specific needs, including support for multiple languages.
-
-## Internationalization and Customization Support
-
-### Custom Prompts with `prompt_file`
-
-The `prompt_file` attribute facilitates full customization of the agent prompts, enhancing the global usability of CrewAI. Users can specify their prompt templates, ensuring that the agents communicate in a manner that aligns with specific project requirements or language preferences.
-
-#### Example of a Custom Prompt File
-
-The custom prompts can be defined in a JSON file, similar to the example provided [here](https://github.com/joaomdmoura/crewAI/blob/main/src/crewai/translations/en.json).
-
-### Supported Languages
-
-CrewAI's custom prompt support includes internationalization, allowing prompts to be written in different languages. This is particularly useful for global teams or projects that require multilingual support.
-
-## How to Use the `prompt_file` Attribute
-
-To utilize the `prompt_file` attribute, include it in your crew definition. Below is an example demonstrating how to set up agents and tasks with custom prompts.
-
-### Example
-
-```python
-import os
-from crewai import Agent, Task, Crew
-
-# Define your agents
-researcher = Agent(
- role="Researcher",
- goal="Make the best research and analysis on content about AI and AI agents",
- backstory="You're an expert researcher, specialized in technology, software engineering, AI and startups. You work as a freelancer and is now working on doing research and analysis for a new customer.",
- allow_delegation=False,
-)
-
-writer = Agent(
- role="Senior Writer",
- goal="Write the best content about AI and AI agents.",
- backstory="You're a senior writer, specialized in technology, software engineering, AI and startups. You work as a freelancer and are now working on writing content for a new customer.",
- allow_delegation=False,
-)
-
-# Define your tasks
-tasks = [
- Task(
- description="Say Hi",
- expected_output="The word: Hi",
- agent=researcher,
- )
-]
-
-# Instantiate your crew with custom prompts
-crew = Crew(
- agents=[researcher],
- tasks=tasks,
- prompt_file="prompt.json", # Path to your custom prompt file
-)
-
-# Get your crew to work!
-crew.kickoff()
-```
-
-## Advanced Customization Features
-
-### `language` Attribute
-
-In addition to `prompt_file`, the `language` attribute can be used to specify the language for the agent's prompts. This ensures that the prompts are generated in the desired language, further enhancing the internationalization capabilities of CrewAI.
-
-### Creating Custom Prompt Files
-
-Custom prompt files should be structured in JSON format and include all necessary prompt templates. Below is a simplified example of a prompt JSON file:
-
-```json
-{
- "system": "You are a system template.",
- "prompt": "Here is your prompt template.",
- "response": "Here is your response template."
-}
-```
-
-### Benefits of Custom Prompts
-
-- **Enhanced Flexibility**: Tailor agent communication to specific project needs.
-- **Improved Usability**: Supports multiple languages, making it suitable for global projects.
-- **Consistency**: Ensures uniform prompt structures across different agents and tasks.
-
-By incorporating these updates, CrewAI provides users with the ability to fully customize and internationalize their agent prompts, making the platform more versatile and user-friendly.
\ No newline at end of file
diff --git a/docs/how-to/Customizing-Agents.md b/docs/how-to/Customizing-Agents.md
deleted file mode 100644
index 8aa86b792..000000000
--- a/docs/how-to/Customizing-Agents.md
+++ /dev/null
@@ -1,90 +0,0 @@
----
-title: Customizing Agents in CrewAI
-description: A comprehensive guide to tailoring agents for specific roles, tasks, and advanced customizations within the CrewAI framework.
----
-
-## Customizable Attributes
-Crafting an efficient CrewAI team hinges on the ability to dynamically tailor your AI agents to meet the unique requirements of any project. This section covers the foundational attributes you can customize.
-
-### Key Attributes for Customization
-- **Role**: Specifies the agent's job within the crew, such as 'Analyst' or 'Customer Service Rep'.
-- **Goal**: Defines what the agent aims to achieve, in alignment with its role and the overarching objectives of the crew.
-- **Backstory**: Provides depth to the agent's persona, enriching its motivations and engagements within the crew.
-- **Tools** *(Optional)*: Represents the capabilities or methods the agent uses to perform tasks, from simple functions to intricate integrations.
-- **Cache** *(Optional)*: Determines whether the agent should use a cache for tool usage.
-- **Max RPM**: Sets the maximum number of requests per minute (`max_rpm`). This attribute is optional and can be set to `None` for no limit, allowing for unlimited queries to external services if needed.
-- **Verbose** *(Optional)*: Enables detailed logging of an agent's actions, useful for debugging and optimization. Specifically, it provides insights into agent execution processes, aiding in the optimization of performance.
-- **Allow Delegation** *(Optional)*: `allow_delegation` controls whether the agent is allowed to delegate tasks to other agents. This attribute is now set to `False` by default.
-- **Max Iter** *(Optional)*: The `max_iter` attribute allows users to define the maximum number of iterations an agent can perform for a single task, preventing infinite loops or excessively long executions. The default value is set to 25, providing a balance between thoroughness and efficiency.
-- **Max Execution Time** *(Optional)*: `max_execution_time` Sets the maximum execution time for an agent to complete a task.
-- **System Template** *(Optional)*: `system_template` defines the system format for the agent.
-- **Prompt Template** *(Optional)*: `prompt_template` defines the prompt format for the agent.
-- **Response Template** *(Optional)*: `response_template` defines the response format for the agent.
-- **Use System Prompt** *(Optional)*: `use_system_prompt` controls whether the agent will use a system prompt for task execution. Agents can now operate without system prompts.
-- **Respect Context Window**: `respect_context_window` renames the sliding context window attribute and enables it by default to maintain context size.
-- **Max Retry Limit**: `max_retry_limit` defines the maximum number of retries for an agent to execute a task when an error occurs.
-
-## Advanced Customization Options
-Beyond the basic attributes, CrewAI allows for deeper customization to enhance an agent's behavior and capabilities significantly.
-
-### Language Model Customization
-Agents can be customized with specific language models (`llm`) and function-calling language models (`function_calling_llm`), offering advanced control over their processing and decision-making abilities. It's important to note that setting the `function_calling_llm` allows for overriding the default crew function-calling language model, providing a greater degree of customization.
-
-## Performance and Debugging Settings
-Adjusting an agent's performance and monitoring its operations are crucial for efficient task execution.
-
-### Verbose Mode and RPM Limit
-- **Verbose Mode**: Enables detailed logging of an agent's actions, useful for debugging and optimization. Specifically, it provides insights into agent execution processes, aiding in the optimization of performance.
-- **RPM Limit**: Sets the maximum number of requests per minute (`max_rpm`). This attribute is optional and can be set to `None` for no limit, allowing for unlimited queries to external services if needed.
-
-### Maximum Iterations for Task Execution
-The `max_iter` attribute allows users to define the maximum number of iterations an agent can perform for a single task, preventing infinite loops or excessively long executions. The default value is set to 25, providing a balance between thoroughness and efficiency. Once the agent approaches this number, it will try its best to give a good answer.
-
-## Customizing Agents and Tools
-Agents are customized by defining their attributes and tools during initialization. Tools are critical for an agent's functionality, enabling them to perform specialized tasks. The `tools` attribute should be an array of tools the agent can utilize, and it's initialized as an empty list by default. Tools can be added or modified post-agent initialization to adapt to new requirements.
-
-```shell
-pip install 'crewai[tools]'
-```
-
-### Example: Assigning Tools to an Agent
-```python
-import os
-from crewai import Agent
-from crewai_tools import SerperDevTool
-
-# Set API keys for tool initialization
-os.environ["OPENAI_API_KEY"] = "Your Key"
-os.environ["SERPER_API_KEY"] = "Your Key"
-
-# Initialize a search tool
-search_tool = SerperDevTool()
-
-# Initialize the agent with advanced options
-agent = Agent(
- role='Research Analyst',
- goal='Provide up-to-date market analysis',
- backstory='An expert analyst with a keen eye for market trends.',
- tools=[search_tool],
- memory=True, # Enable memory
- verbose=True,
- max_rpm=None, # No limit on requests per minute
- max_iter=25, # Default value for maximum iterations
-)
-```
-
-## Delegation and Autonomy
-Controlling an agent's ability to delegate tasks or ask questions is vital for tailoring its autonomy and collaborative dynamics within the CrewAI framework. By default, the `allow_delegation` attribute is now set to `False`, disabling agents to seek assistance or delegate tasks as needed. This default behavior can be changed to promote collaborative problem-solving and efficiency within the CrewAI ecosystem. If needed, delegation can be enabled to suit specific operational requirements.
-
-### Example: Disabling Delegation for an Agent
-```python
-agent = Agent(
- role='Content Writer',
- goal='Write engaging content on market trends',
- backstory='A seasoned writer with expertise in market analysis.',
- allow_delegation=True # Enabling delegation
-)
-```
-
-## Conclusion
-Customizing agents in CrewAI by setting their roles, goals, backstories, and tools, alongside advanced options like language model customization, memory, performance settings, and delegation preferences, equips a nuanced and capable AI team ready for complex challenges.
\ No newline at end of file
diff --git a/docs/how-to/Force-Tool-Ouput-as-Result.md b/docs/how-to/Force-Tool-Ouput-as-Result.md
deleted file mode 100644
index d4e9a3f9d..000000000
--- a/docs/how-to/Force-Tool-Ouput-as-Result.md
+++ /dev/null
@@ -1,36 +0,0 @@
----
-title: Forcing Tool Output as Result
-description: Learn how to force tool output as the result in an Agent's task in CrewAI.
----
-
-## Introduction
-In CrewAI, you can force the output of a tool as the result of an agent's task. This feature is useful when you want to ensure that the tool output is captured and returned as the task result, avoiding any agent modification during the task execution.
-
-## Forcing Tool Output as Result
-To force the tool output as the result of an agent's task, you need to set the `result_as_answer` parameter to `True` when adding a tool to the agent. This parameter ensures that the tool output is captured and returned as the task result, without any modifications by the agent.
-
-Here's an example of how to force the tool output as the result of an agent's task:
-
-```python
-# ...
-from crewai.agent import Agent
-from my_tool import MyCustomTool
-
-# Create a coding agent with the custom tool
-coding_agent = Agent(
- role="Data Scientist",
- goal="Produce amazing reports on AI",
- backstory="You work with data and AI",
- tools=[MyCustomTool(result_as_answer=True)],
- )
-
-# Assuming the tool's execution and result population occurs within the system
-task_result = coding_agent.execute_task(task)
-```
-
-## Workflow in Action
-
-1. **Task Execution**: The agent executes the task using the tool provided.
-2. **Tool Output**: The tool generates the output, which is captured as the task result.
-3. **Agent Interaction**: The agent may reflect and take learnings from the tool but the output is not modified.
-4. **Result Return**: The tool output is returned as the task result without any modifications.
diff --git a/docs/how-to/LLM-Connections.md b/docs/how-to/LLM-Connections.md
deleted file mode 100644
index 620ddddf9..000000000
--- a/docs/how-to/LLM-Connections.md
+++ /dev/null
@@ -1,163 +0,0 @@
----
-title: Connect CrewAI to LLMs
-description: Comprehensive guide on integrating CrewAI with various Large Language Models (LLMs) using LiteLLM, including supported providers and configuration options.
----
-
-## Connect CrewAI to LLMs
-
-CrewAI uses LiteLLM to connect to a wide variety of Language Models (LLMs). This integration provides extensive versatility, allowing you to use models from numerous providers with a simple, unified interface.
-
-!!! note "Default LLM"
- By default, CrewAI uses the `gpt-4o-mini` model. This is determined by the `OPENAI_MODEL_NAME` environment variable, which defaults to "gpt-4o-mini" if not set. You can easily configure your agents to use a different model or provider as described in this guide.
-
-## Supported Providers
-
-LiteLLM supports a wide range of providers, including but not limited to:
-
-- OpenAI
-- Anthropic
-- Google (Vertex AI, Gemini)
-- Azure OpenAI
-- AWS (Bedrock, SageMaker)
-- Cohere
-- Hugging Face
-- Ollama
-- Mistral AI
-- Replicate
-- Together AI
-- AI21
-- Cloudflare Workers AI
-- DeepInfra
-- Groq
-- And many more!
-
-For a complete and up-to-date list of supported providers, please refer to the [LiteLLM Providers documentation](https://docs.litellm.ai/docs/providers).
-
-## Changing the LLM
-
-To use a different LLM with your CrewAI agents, you have several options:
-
-### 1. Using a String Identifier
-
-Pass the model name as a string when initializing the agent:
-
-```python
-from crewai import Agent
-
-# Using OpenAI's GPT-4
-openai_agent = Agent(
- role='OpenAI Expert',
- goal='Provide insights using GPT-4',
- backstory="An AI assistant powered by OpenAI's latest model.",
- llm='gpt-4'
-)
-
-# Using Anthropic's Claude
-claude_agent = Agent(
- role='Anthropic Expert',
- goal='Analyze data using Claude',
- backstory="An AI assistant leveraging Anthropic's language model.",
- llm='claude-2'
-)
-```
-
-### 2. Using the LLM Class
-
-For more detailed configuration, use the LLM class:
-
-```python
-from crewai import Agent, LLM
-
-llm = LLM(
- model="gpt-4",
- temperature=0.7,
- base_url="https://api.openai.com/v1",
- api_key="your-api-key-here"
-)
-
-agent = Agent(
- role='Customized LLM Expert',
- goal='Provide tailored responses',
- backstory="An AI assistant with custom LLM settings.",
- llm=llm
-)
-```
-
-## Configuration Options
-
-When configuring an LLM for your agent, you have access to a wide range of parameters:
-
-| Parameter | Type | Description |
-|-----------|------|-------------|
-| `model` | str | The name of the model to use (e.g., "gpt-4", "claude-2") |
-| `temperature` | float | Controls randomness in output (0.0 to 1.0) |
-| `max_tokens` | int | Maximum number of tokens to generate |
-| `top_p` | float | Controls diversity of output (0.0 to 1.0) |
-| `frequency_penalty` | float | Penalizes new tokens based on their frequency in the text so far |
-| `presence_penalty` | float | Penalizes new tokens based on their presence in the text so far |
-| `stop` | str, List[str] | Sequence(s) to stop generation |
-| `base_url` | str | The base URL for the API endpoint |
-| `api_key` | str | Your API key for authentication |
-
-For a complete list of parameters and their descriptions, refer to the LLM class documentation.
-
-## Connecting to OpenAI-Compatible LLMs
-
-You can connect to OpenAI-compatible LLMs using either environment variables or by setting specific attributes on the LLM class:
-
-### Using Environment Variables
-
-```python
-import os
-
-os.environ["OPENAI_API_KEY"] = "your-api-key"
-os.environ["OPENAI_API_BASE"] = "https://api.your-provider.com/v1"
-os.environ["OPENAI_MODEL_NAME"] = "your-model-name"
-```
-
-### Using LLM Class Attributes
-
-```python
-llm = LLM(
- model="custom-model-name",
- api_key="your-api-key",
- base_url="https://api.your-provider.com/v1"
-)
-agent = Agent(llm=llm, ...)
-```
-
-## Using Local Models with Ollama
-
-For local models like those provided by Ollama:
-
-1. [Download and install Ollama](https://ollama.com/download)
-2. Pull the desired model (e.g., `ollama pull llama2`)
-3. Configure your agent:
-
-```python
-agent = Agent(
- role='Local AI Expert',
- goal='Process information using a local model',
- backstory="An AI assistant running on local hardware.",
- llm=LLM(model="ollama/llama2", base_url="http://localhost:11434")
-)
-```
-
-## Changing the Base API URL
-
-You can change the base API URL for any LLM provider by setting the `base_url` parameter:
-
-```python
-llm = LLM(
- model="custom-model-name",
- base_url="https://api.your-provider.com/v1",
- api_key="your-api-key"
-)
-agent = Agent(llm=llm, ...)
-```
-
-This is particularly useful when working with OpenAI-compatible APIs or when you need to specify a different endpoint for your chosen provider.
-
-## Conclusion
-
-By leveraging LiteLLM, CrewAI offers seamless integration with a vast array of LLMs. This flexibility allows you to choose the most suitable model for your specific needs, whether you prioritize performance, cost-efficiency, or local deployment. Remember to consult the [LiteLLM documentation](https://docs.litellm.ai/docs/) for the most up-to-date information on supported models and configuration options.
diff --git a/docs/how-to/Langtrace-Observability.md b/docs/how-to/Langtrace-Observability.md
deleted file mode 100644
index 168f7e340..000000000
--- a/docs/how-to/Langtrace-Observability.md
+++ /dev/null
@@ -1,64 +0,0 @@
----
-title: CrewAI Agent Monitoring with Langtrace
-description: How to monitor cost, latency, and performance of CrewAI Agents using Langtrace, an external observability tool.
----
-
-# Langtrace Overview
-
-Langtrace is an open-source, external tool that helps you set up observability and evaluations for Large Language Models (LLMs), LLM frameworks, and Vector Databases. While not built directly into CrewAI, Langtrace can be used alongside CrewAI to gain deep visibility into the cost, latency, and performance of your CrewAI Agents. This integration allows you to log hyperparameters, monitor performance regressions, and establish a process for continuous improvement of your Agents.
-
-
-
-
-
-## Setup Instructions
-
-1. Sign up for [Langtrace](https://langtrace.ai/) by visiting [https://langtrace.ai/signup](https://langtrace.ai/signup).
-2. Create a project, set the project type to crewAI & generate an API key.
-3. Install Langtrace in your CrewAI project using the following commands:
-
-```bash
-# Install the SDK
-pip install langtrace-python-sdk
-```
-
-## Using Langtrace with CrewAI
-
-To integrate Langtrace with your CrewAI project, follow these steps:
-
-1. Import and initialize Langtrace at the beginning of your script, before any CrewAI imports:
-
-```python
-from langtrace_python_sdk import langtrace
-langtrace.init(api_key='')
-
-# Now import CrewAI modules
-from crewai import Agent, Task, Crew
-```
-
-### Features and Their Application to CrewAI
-
-1. **LLM Token and Cost Tracking**
-
- - Monitor the token usage and associated costs for each CrewAI agent interaction.
-
-2. **Trace Graph for Execution Steps**
-
- - Visualize the execution flow of your CrewAI tasks, including latency and logs.
- - Useful for identifying bottlenecks in your agent workflows.
-
-3. **Dataset Curation with Manual Annotation**
-
- - Create datasets from your CrewAI task outputs for future training or evaluation.
-
-4. **Prompt Versioning and Management**
-
- - Keep track of different versions of prompts used in your CrewAI agents.
- - Useful for A/B testing and optimizing agent performance.
-
-5. **Prompt Playground with Model Comparisons**
-
- - Test and compare different prompts and models for your CrewAI agents before deployment.
-
-6. **Testing and Evaluations**
- - Set up automated tests for your CrewAI agents and tasks.
diff --git a/docs/how-to/Replay-tasks-from-latest-Crew-Kickoff.md b/docs/how-to/Replay-tasks-from-latest-Crew-Kickoff.md
deleted file mode 100644
index 136f32047..000000000
--- a/docs/how-to/Replay-tasks-from-latest-Crew-Kickoff.md
+++ /dev/null
@@ -1,58 +0,0 @@
----
-title: Replay Tasks from Latest Crew Kickoff
-description: Replay tasks from the latest crew.kickoff(...)
-
----
-
-## Introduction
-CrewAI provides the ability to replay from a task specified from the latest crew kickoff. This feature is particularly useful when you've finished a kickoff and may want to retry certain tasks or don't need to refetch data over and your agents already have the context saved from the kickoff execution so you just need to replay the tasks you want to.
-
-## Note:
-You must run `crew.kickoff()` before you can replay a task. Currently, only the latest kickoff is supported, so if you use `kickoff_for_each`, it will only allow you to replay from the most recent crew run.
-
-Here's an example of how to replay from a task:
-
-### Replaying from Specific Task Using the CLI
-To use the replay feature, follow these steps:
-
-1. Open your terminal or command prompt.
-2. Navigate to the directory where your CrewAI project is located.
-3. Run the following commands:
-
-To view the latest kickoff task_ids use:
-```shell
-crewai log-tasks-outputs
-```
-
-Once you have your `task_id` to replay, use:
-```shell
-crewai replay -t
-```
-
-**Note:** Ensure `crewai` is installed and configured correctly in your development environment.
-
-### Replaying from a Task Programmatically
-To replay from a task programmatically, use the following steps:
-
-1. Specify the `task_id` and input parameters for the replay process.
-2. Execute the replay command within a try-except block to handle potential errors.
-
-```python
- def replay():
- """
- Replay the crew execution from a specific task.
- """
- task_id = ''
- inputs = {"topic": "CrewAI Training"} # This is optional; you can pass in the inputs you want to replay; otherwise, it uses the previous kickoff's inputs.
- try:
- YourCrewName_Crew().crew().replay(task_id=task_id, inputs=inputs)
-
- except subprocess.CalledProcessError as e:
- raise Exception(f"An error occurred while replaying the crew: {e}")
-
- except Exception as e:
- raise Exception(f"An unexpected error occurred: {e}")
-```
-
-## Conclusion
-With the above enhancements and detailed functionality, replaying specific tasks in CrewAI has been made more efficient and robust. Ensure you follow the commands and steps precisely to make the most of these features.
\ No newline at end of file
diff --git a/docs/how-to/agentops-observability.mdx b/docs/how-to/agentops-observability.mdx
new file mode 100644
index 000000000..605cfda14
--- /dev/null
+++ b/docs/how-to/agentops-observability.mdx
@@ -0,0 +1,126 @@
+---
+title: Agent Monitoring with AgentOps
+description: Understanding and logging your agent performance with AgentOps.
+icon: paperclip
+---
+
+# Introduction
+
+Observability is a key aspect of developing and deploying conversational AI agents. It allows developers to understand how their agents are performing,
+how their agents are interacting with users, and how their agents use external tools and APIs.
+AgentOps is a product independent of CrewAI that provides a comprehensive observability solution for agents.
+
+## AgentOps
+
+[AgentOps](https://agentops.ai/?=crew) provides session replays, metrics, and monitoring for agents.
+
+At a high level, AgentOps gives you the ability to monitor cost, token usage, latency, agent failures, session-wide statistics, and more.
+For more info, check out the [AgentOps Repo](https://github.com/AgentOps-AI/agentops).
+
+### Overview
+
+AgentOps provides monitoring for agents in development and production.
+It provides a dashboard for tracking agent performance, session replays, and custom reporting.
+
+Additionally, AgentOps provides session drilldowns for viewing Crew agent interactions, LLM calls, and tool usage in real-time.
+This feature is useful for debugging and understanding how agents interact with users as well as other agents.
+
+
+
+
+
+### Features
+
+- **LLM Cost Management and Tracking**: Track spend with foundation model providers.
+- **Replay Analytics**: Watch step-by-step agent execution graphs.
+- **Recursive Thought Detection**: Identify when agents fall into infinite loops.
+- **Custom Reporting**: Create custom analytics on agent performance.
+- **Analytics Dashboard**: Monitor high-level statistics about agents in development and production.
+- **Public Model Testing**: Test your agents against benchmarks and leaderboards.
+- **Custom Tests**: Run your agents against domain-specific tests.
+- **Time Travel Debugging**: Restart your sessions from checkpoints.
+- **Compliance and Security**: Create audit logs and detect potential threats such as profanity and PII leaks.
+- **Prompt Injection Detection**: Identify potential code injection and secret leaks.
+
+### Using AgentOps
+
+
+
+ Create a user API key here: [Create API Key](https://app.agentops.ai/account)
+
+
+ Add your API key to your environment variables:
+ ```bash
+ AGENTOPS_API_KEY=
+ ```
+
+
+ Install AgentOps with:
+ ```bash
+ pip install crewai[agentops]
+ ```
+ or
+ ```bash
+ pip install agentops
+ ```
+
+
+ Before using `Crew` in your script, include these lines:
+
+ ```python
+ import agentops
+ agentops.init()
+ ```
+
+ This will initiate an AgentOps session as well as automatically track Crew agents. For further info on how to outfit more complex agentic systems,
+ check out the [AgentOps documentation](https://docs.agentops.ai) or join the [Discord](https://discord.gg/j4f3KbeH).
+
+
+
+### Crew + AgentOps Examples
+
+
+
+ Example of a Crew agent that generates job posts.
+
+
+ Example of a Crew agent that validates Markdown files.
+
+
+ Example of a Crew agent that generates Instagram posts.
+
+
+
+### Further Information
+
+To get started, create an [AgentOps account](https://agentops.ai/?=crew).
+
+For feature requests or bug reports, please reach out to the AgentOps team on the [AgentOps Repo](https://github.com/AgentOps-AI/agentops).
+
+#### Extra links
+
+π¦ Twitter
+ β’
+π’ Discord
+ β’
+ποΈ AgentOps Dashboard
+ β’
+π Documentation
\ No newline at end of file
diff --git a/docs/how-to/Coding-Agents.md b/docs/how-to/coding-agents.mdx
similarity index 62%
rename from docs/how-to/Coding-Agents.md
rename to docs/how-to/coding-agents.mdx
index 5ef72a79e..b2d504a4b 100644
--- a/docs/how-to/Coding-Agents.md
+++ b/docs/how-to/coding-agents.mdx
@@ -1,17 +1,20 @@
---
title: Coding Agents
-description: Learn how to enable your crewAI Agents to write and execute code, and explore advanced features for enhanced functionality.
+description: Learn how to enable your CrewAI Agents to write and execute code, and explore advanced features for enhanced functionality.
+icon: rectangle-code
---
## Introduction
-crewAI Agents now have the powerful ability to write and execute code, significantly enhancing their problem-solving capabilities. This feature is particularly useful for tasks that require computational or programmatic solutions.
+CrewAI Agents now have the powerful ability to write and execute code, significantly enhancing their problem-solving capabilities. This feature is particularly useful for tasks that require computational or programmatic solutions.
## Enabling Code Execution
-To enable code execution for an agent, set the `allow_code_execution` parameter to `True` when creating the agent. Here's an example:
+To enable code execution for an agent, set the `allow_code_execution` parameter to `True` when creating the agent.
-```python
+Here's an example:
+
+```python Code
from crewai import Agent
coding_agent = Agent(
@@ -22,31 +25,45 @@ coding_agent = Agent(
)
```
-**Note**: The `allow_code_execution` parameter defaults to `False`.
+
+Note that `allow_code_execution` parameter defaults to `False`.
+
## Important Considerations
-1. **Model Selection**: It is strongly recommended to use more capable models like Claude 3.5 Sonnet and GPT-4 when enabling code execution. These models have a better understanding of programming concepts and are more likely to generate correct and efficient code.
+1. **Model Selection**: It is strongly recommended to use more capable models like Claude 3.5 Sonnet and GPT-4 when enabling code execution.
+These models have a better understanding of programming concepts and are more likely to generate correct and efficient code.
-2. **Error Handling**: The code execution feature includes error handling. If executed code raises an exception, the agent will receive the error message and can attempt to correct the code or provide alternative solutions. The `max_retry_limit` parameter, which defaults to 2, controls the maximum number of retries for a task.
+2. **Error Handling**: The code execution feature includes error handling. If executed code raises an exception, the agent will receive the error message and can attempt to correct the code or
+provide alternative solutions. The `max_retry_limit` parameter, which defaults to 2, controls the maximum number of retries for a task.
-3. **Dependencies**: To use the code execution feature, you need to install the `crewai_tools` package. If not installed, the agent will log an info message: "Coding tools not available. Install crewai_tools."
+3. **Dependencies**: To use the code execution feature, you need to install the `crewai_tools` package. If not installed, the agent will log an info message:
+"Coding tools not available. Install crewai_tools."
## Code Execution Process
When an agent with code execution enabled encounters a task requiring programming:
-1. The agent analyzes the task and determines that code execution is necessary.
-2. It formulates the Python code needed to solve the problem.
-3. The code is sent to the internal code execution tool (`CodeInterpreterTool`).
-4. The tool executes the code in a controlled environment and returns the result.
-5. The agent interprets the result and incorporates it into its response or uses it for further problem-solving.
+
+
+ The agent analyzes the task and determines that code execution is necessary.
+
+
+ It formulates the Python code needed to solve the problem.
+
+
+ The code is sent to the internal code execution tool (`CodeInterpreterTool`).
+
+
+ The agent interprets the result and incorporates it into its response or uses it for further problem-solving.
+
+
## Example Usage
Here's a detailed example of creating an agent with code execution capabilities and using it in a task:
-```python
+```python Code
from crewai import Agent, Task, Crew
# Create an agent with code execution enabled
@@ -75,4 +92,4 @@ result = analysis_crew.kickoff()
print(result)
```
-In this example, the `coding_agent` can write and execute Python code to perform data analysis tasks.
+In this example, the `coding_agent` can write and execute Python code to perform data analysis tasks.
\ No newline at end of file
diff --git a/docs/how-to/Conditional-Tasks.md b/docs/how-to/conditional-tasks.mdx
similarity index 91%
rename from docs/how-to/Conditional-Tasks.md
rename to docs/how-to/conditional-tasks.mdx
index 58c5dea6f..41b7475bf 100644
--- a/docs/how-to/Conditional-Tasks.md
+++ b/docs/how-to/conditional-tasks.mdx
@@ -1,15 +1,17 @@
---
title: Conditional Tasks
description: Learn how to use conditional tasks in a crewAI kickoff
+icon: diagram-subtask
---
## Introduction
-Conditional Tasks in crewAI allow for dynamic workflow adaptation based on the outcomes of previous tasks. This powerful feature enables crews to make decisions and execute tasks selectively, enhancing the flexibility and efficiency of your AI-driven processes.
+Conditional Tasks in crewAI allow for dynamic workflow adaptation based on the outcomes of previous tasks.
+This powerful feature enables crews to make decisions and execute tasks selectively, enhancing the flexibility and efficiency of your AI-driven processes.
## Example Usage
-```python
+```python Code
from typing import List
from pydantic import BaseModel
from crewai import Agent, Crew
diff --git a/docs/how-to/Create-Custom-Tools.md b/docs/how-to/create-custom-tools.mdx
similarity index 68%
rename from docs/how-to/Create-Custom-Tools.md
rename to docs/how-to/create-custom-tools.mdx
index 7dc1e8f07..31fd09e3f 100644
--- a/docs/how-to/Create-Custom-Tools.md
+++ b/docs/how-to/create-custom-tools.mdx
@@ -1,10 +1,14 @@
---
-title: Creating and Utilizing Tools in crewAI
-description: Comprehensive guide on crafting, using, and managing custom tools within the crewAI framework, including new functionalities and error handling.
+title: Create Custom Tools
+description: Comprehensive guide on crafting, using, and managing custom tools within the CrewAI framework, including new functionalities and error handling.
+icon: hammer
---
-## Creating and Utilizing Tools in crewAI
-This guide provides detailed instructions on creating custom tools for the crewAI framework and how to efficiently manage and utilize these tools, incorporating the latest functionalities such as tool delegation, error handling, and dynamic tool calling. It also highlights the importance of collaboration tools, enabling agents to perform a wide range of actions.
+## Creating and Utilizing Tools in CrewAI
+
+This guide provides detailed instructions on creating custom tools for the CrewAI framework and how to efficiently manage and utilize these tools,
+incorporating the latest functionalities such as tool delegation, error handling, and dynamic tool calling. It also highlights the importance of collaboration tools,
+enabling agents to perform a wide range of actions.
### Prerequisites
@@ -18,7 +22,7 @@ pip install 'crewai[tools]'
To create a personalized tool, inherit from `BaseTool` and define the necessary attributes and the `_run` method.
-```python
+```python Code
from crewai_tools import BaseTool
class MyCustomTool(BaseTool):
@@ -32,9 +36,10 @@ class MyCustomTool(BaseTool):
### Using the `tool` Decorator
-Alternatively, you can use the tool decorator `@tool`. This approach allows you to define the tool's attributes and functionality directly within a function, offering a concise and efficient way to create specialized tools tailored to your needs.
+Alternatively, you can use the tool decorator `@tool`. This approach allows you to define the tool's attributes and functionality directly within a function,
+offering a concise and efficient way to create specialized tools tailored to your needs.
-```python
+```python Code
from crewai_tools import tool
@tool("Tool Name")
@@ -48,7 +53,7 @@ def my_simple_tool(question: str) -> str:
To optimize tool performance with caching, define custom caching strategies using the `cache_function` attribute.
-```python
+```python Code
@tool("Tool with Caching")
def cached_tool(argument: str) -> str:
"""Tool functionality description."""
@@ -61,4 +66,5 @@ def my_cache_strategy(arguments: dict, result: str) -> bool:
cached_tool.cache_function = my_cache_strategy
```
-By adhering to these guidelines and incorporating new functionalities and collaboration tools into your tool creation and management processes, you can leverage the full capabilities of the crewAI framework, enhancing both the development experience and the efficiency of your AI agents.
\ No newline at end of file
+By adhering to these guidelines and incorporating new functionalities and collaboration tools into your tool creation and management processes,
+you can leverage the full capabilities of the CrewAI framework, enhancing both the development experience and the efficiency of your AI agents.
diff --git a/docs/how-to/Your-Own-Manager-Agent.md b/docs/how-to/custom-manager-agent.mdx
similarity index 90%
rename from docs/how-to/Your-Own-Manager-Agent.md
rename to docs/how-to/custom-manager-agent.mdx
index f6dd15dc8..07f424fb1 100644
--- a/docs/how-to/Your-Own-Manager-Agent.md
+++ b/docs/how-to/custom-manager-agent.mdx
@@ -1,12 +1,13 @@
---
-title: Setting a Specific Agent as Manager in CrewAI
+title: Create Your Own Manager Agent
description: Learn how to set a custom agent as the manager in CrewAI, providing more control over task management and coordination.
-
+icon: user-shield
---
# Setting a Specific Agent as Manager in CrewAI
-CrewAI allows users to set a specific agent as the manager of the crew, providing more control over the management and coordination of tasks. This feature enables the customization of the managerial role to better fit your project's requirements.
+CrewAI allows users to set a specific agent as the manager of the crew, providing more control over the management and coordination of tasks.
+This feature enables the customization of the managerial role to better fit your project's requirements.
## Using the `manager_agent` Attribute
@@ -16,7 +17,7 @@ The `manager_agent` attribute allows you to define a custom agent to manage the
### Example
-```python
+```python Code
import os
from crewai import Agent, Task, Crew, Process
@@ -71,7 +72,7 @@ result = crew.kickoff()
If you're using the hierarchical process and don't want to set a custom manager agent, you can specify the language model for the manager:
-```python
+```python Code
from langchain_openai import ChatOpenAI
manager_llm = ChatOpenAI(model_name="gpt-4")
@@ -84,4 +85,6 @@ crew = Crew(
)
```
-Note: Either `manager_agent` or `manager_llm` must be set when using the hierarchical process.
\ No newline at end of file
+
+Either `manager_agent` or `manager_llm` must be set when using the hierarchical process.
+
\ No newline at end of file
diff --git a/docs/how-to/customizing-agents.mdx b/docs/how-to/customizing-agents.mdx
new file mode 100644
index 000000000..527ebf8cd
--- /dev/null
+++ b/docs/how-to/customizing-agents.mdx
@@ -0,0 +1,111 @@
+---
+title: Customize Agents
+description: A comprehensive guide to tailoring agents for specific roles, tasks, and advanced customizations within the CrewAI framework.
+icon: user-pen
+---
+
+## Customizable Attributes
+
+Crafting an efficient CrewAI team hinges on the ability to dynamically tailor your AI agents to meet the unique requirements of any project. This section covers the foundational attributes you can customize.
+
+### Key Attributes for Customization
+
+| Attribute | Description |
+|:-----------------------|:----------------------------------------------------------------------------------------------------------------------------------------------------------|
+| **Role** | Specifies the agent's job within the crew, such as 'Analyst' or 'Customer Service Rep'. |
+| **Goal** | Defines the agentβs objectives, aligned with its role and the crewβs overarching mission. |
+| **Backstory** | Provides depth to the agent's persona, enhancing motivations and engagements within the crew. |
+| **Tools** *(Optional)* | Represents the capabilities or methods the agent uses for tasks, from simple functions to complex integrations. |
+| **Cache** *(Optional)* | Determines if the agent should use a cache for tool usage. |
+| **Max RPM** | Sets the maximum requests per minute (`max_rpm`). Can be set to `None` for unlimited requests to external services. |
+| **Verbose** *(Optional)* | Enables detailed logging for debugging and optimization, providing insights into execution processes. |
+| **Allow Delegation** *(Optional)* | Controls task delegation to other agents, default is `False`. |
+| **Max Iter** *(Optional)* | Limits the maximum number of iterations (`max_iter`) for a task to prevent infinite loops, with a default of 25. |
+| **Max Execution Time** *(Optional)* | Sets the maximum time allowed for an agent to complete a task. |
+| **System Template** *(Optional)* | Defines the system format for the agent. |
+| **Prompt Template** *(Optional)* | Defines the prompt format for the agent. |
+| **Response Template** *(Optional)* | Defines the response format for the agent. |
+| **Use System Prompt** *(Optional)* | Controls whether the agent will use a system prompt during task execution. |
+| **Respect Context Window** | Enables a sliding context window by default, maintaining context size. |
+| **Max Retry Limit** | Sets the maximum number of retries (`max_retry_limit`) for an agent in case of errors. |
+
+## Advanced Customization Options
+
+Beyond the basic attributes, CrewAI allows for deeper customization to enhance an agent's behavior and capabilities significantly.
+
+### Language Model Customization
+
+Agents can be customized with specific language models (`llm`) and function-calling language models (`function_calling_llm`), offering advanced control over their processing and decision-making abilities.
+It's important to note that setting the `function_calling_llm` allows for overriding the default crew function-calling language model, providing a greater degree of customization.
+
+## Performance and Debugging Settings
+
+Adjusting an agent's performance and monitoring its operations are crucial for efficient task execution.
+
+### Verbose Mode and RPM Limit
+
+- **Verbose Mode**: Enables detailed logging of an agent's actions, useful for debugging and optimization. Specifically, it provides insights into agent execution processes, aiding in the optimization of performance.
+- **RPM Limit**: Sets the maximum number of requests per minute (`max_rpm`). This attribute is optional and can be set to `None` for no limit, allowing for unlimited queries to external services if needed.
+
+### Maximum Iterations for Task Execution
+
+The `max_iter` attribute allows users to define the maximum number of iterations an agent can perform for a single task, preventing infinite loops or excessively long executions.
+The default value is set to 25, providing a balance between thoroughness and efficiency. Once the agent approaches this number, it will try its best to give a good answer.
+
+## Customizing Agents and Tools
+
+Agents are customized by defining their attributes and tools during initialization. Tools are critical for an agent's functionality, enabling them to perform specialized tasks.
+The `tools` attribute should be an array of tools the agent can utilize, and it's initialized as an empty list by default. Tools can be added or modified post-agent initialization to adapt to new requirements.
+
+```shell
+pip install 'crewai[tools]'
+```
+
+### Example: Assigning Tools to an Agent
+
+```python Code
+import os
+from crewai import Agent
+from crewai_tools import SerperDevTool
+
+# Set API keys for tool initialization
+os.environ["OPENAI_API_KEY"] = "Your Key"
+os.environ["SERPER_API_KEY"] = "Your Key"
+
+# Initialize a search tool
+search_tool = SerperDevTool()
+
+# Initialize the agent with advanced options
+agent = Agent(
+ role='Research Analyst',
+ goal='Provide up-to-date market analysis',
+ backstory='An expert analyst with a keen eye for market trends.',
+ tools=[search_tool],
+ memory=True, # Enable memory
+ verbose=True,
+ max_rpm=None, # No limit on requests per minute
+ max_iter=25, # Default value for maximum iterations
+)
+```
+
+## Delegation and Autonomy
+
+Controlling an agent's ability to delegate tasks or ask questions is vital for tailoring its autonomy and collaborative dynamics within the CrewAI framework. By default,
+the `allow_delegation` attribute is now set to `False`, disabling agents to seek assistance or delegate tasks as needed. This default behavior can be changed to promote collaborative problem-solving and
+efficiency within the CrewAI ecosystem. If needed, delegation can be enabled to suit specific operational requirements.
+
+### Example: Disabling Delegation for an Agent
+
+```python Code
+agent = Agent(
+ role='Content Writer',
+ goal='Write engaging content on market trends',
+ backstory='A seasoned writer with expertise in market analysis.',
+ allow_delegation=True # Enabling delegation
+)
+```
+
+## Conclusion
+
+Customizing agents in CrewAI by setting their roles, goals, backstories, and tools, alongside advanced options like language model customization, memory, performance settings, and delegation preferences,
+equips a nuanced and capable AI team ready for complex challenges.
\ No newline at end of file
diff --git a/docs/how-to/force-tool-output-as-result.mdx b/docs/how-to/force-tool-output-as-result.mdx
new file mode 100644
index 000000000..8e03a44c4
--- /dev/null
+++ b/docs/how-to/force-tool-output-as-result.mdx
@@ -0,0 +1,50 @@
+---
+title: Force Tool Output as Result
+description: Learn how to force tool output as the result in an Agent's task in CrewAI.
+icon: wrench-simple
+---
+
+## Introduction
+
+In CrewAI, you can force the output of a tool as the result of an agent's task.
+This feature is useful when you want to ensure that the tool output is captured and returned as the task result, avoiding any agent modification during the task execution.
+
+## Forcing Tool Output as Result
+
+To force the tool output as the result of an agent's task, you need to set the `result_as_answer` parameter to `True` when adding a tool to the agent.
+This parameter ensures that the tool output is captured and returned as the task result, without any modifications by the agent.
+
+Here's an example of how to force the tool output as the result of an agent's task:
+
+```python Code
+from crewai.agent import Agent
+from my_tool import MyCustomTool
+
+# Create a coding agent with the custom tool
+coding_agent = Agent(
+ role="Data Scientist",
+ goal="Produce amazing reports on AI",
+ backstory="You work with data and AI",
+ tools=[MyCustomTool(result_as_answer=True)],
+ )
+
+# Assuming the tool's execution and result population occurs within the system
+task_result = coding_agent.execute_task(task)
+```
+
+## Workflow in Action
+
+
+
+ The agent executes the task using the tool provided.
+
+
+ The tool generates the output, which is captured as the task result.
+
+
+ The agent may reflect and take learnings from the tool but the output is not modified.
+
+
+ The tool output is returned as the task result without any modifications.
+
+
\ No newline at end of file
diff --git a/docs/how-to/Hierarchical.md b/docs/how-to/hierarchical-process.mdx
similarity index 80%
rename from docs/how-to/Hierarchical.md
rename to docs/how-to/hierarchical-process.mdx
index 5b46aa459..95efa7c3f 100644
--- a/docs/how-to/Hierarchical.md
+++ b/docs/how-to/hierarchical-process.mdx
@@ -1,18 +1,26 @@
---
-title: Implementing the Hierarchical Process in CrewAI
+title: Hierarchical Process
description: A comprehensive guide to understanding and applying the hierarchical process within your CrewAI projects, updated to reflect the latest coding practices and functionalities.
+icon: sitemap
---
## Introduction
-The hierarchical process in CrewAI introduces a structured approach to task management, simulating traditional organizational hierarchies for efficient task delegation and execution. This systematic workflow enhances project outcomes by ensuring tasks are handled with optimal efficiency and accuracy.
-!!! note "Complexity and Efficiency"
+The hierarchical process in CrewAI introduces a structured approach to task management, simulating traditional organizational hierarchies for efficient task delegation and execution.
+This systematic workflow enhances project outcomes by ensuring tasks are handled with optimal efficiency and accuracy.
+
+
The hierarchical process is designed to leverage advanced models like GPT-4, optimizing token usage while handling complex tasks with greater efficiency.
+
## Hierarchical Process Overview
-By default, tasks in CrewAI are managed through a sequential process. However, adopting a hierarchical approach allows for a clear hierarchy in task management, where a 'manager' agent coordinates the workflow, delegates tasks, and validates outcomes for streamlined and effective execution. This manager agent can now be either automatically created by CrewAI or explicitly set by the user.
+
+By default, tasks in CrewAI are managed through a sequential process. However, adopting a hierarchical approach allows for a clear hierarchy in task management,
+where a 'manager' agent coordinates the workflow, delegates tasks, and validates outcomes for streamlined and effective execution. This manager agent can now be either
+automatically created by CrewAI or explicitly set by the user.
### Key Features
+
- **Task Delegation**: A manager agent allocates tasks among crew members based on their roles and capabilities.
- **Result Validation**: The manager evaluates outcomes to ensure they meet the required standards.
- **Efficient Workflow**: Emulates corporate structures, providing an organized approach to task management.
@@ -25,15 +33,21 @@ By default, tasks in CrewAI are managed through a sequential process. However, a
## Implementing the Hierarchical Process
-To utilize the hierarchical process, it's essential to explicitly set the process attribute to `Process.hierarchical`, as the default behavior is `Process.sequential`. Define a crew with a designated manager and establish a clear chain of command.
-!!! note "Tools and Agent Assignment"
- Assign tools at the agent level to facilitate task delegation and execution by the designated agents under the manager's guidance. Tools can also be specified at the task level for precise control over tool availability during task execution.
+To utilize the hierarchical process, it's essential to explicitly set the process attribute to `Process.hierarchical`, as the default behavior is `Process.sequential`.
+Define a crew with a designated manager and establish a clear chain of command.
-!!! note "Manager LLM Requirement"
- Configuring the `manager_llm` parameter is crucial for the hierarchical process. The system requires a manager LLM to be set up for proper function, ensuring tailored decision-making.
+
+ Assign tools at the agent level to facilitate task delegation and execution by the designated agents under the manager's guidance.
+ Tools can also be specified at the task level for precise control over tool availability during task execution.
+
-```python
+
+ Configuring the `manager_llm` parameter is crucial for the hierarchical process.
+ The system requires a manager LLM to be set up for proper function, ensuring tailored decision-making.
+
+
+```python Code
from langchain_openai import ChatOpenAI
from crewai import Crew, Process, Agent
@@ -75,9 +89,12 @@ project_crew = Crew(
```
### Workflow in Action
+
1. **Task Assignment**: The manager assigns tasks strategically, considering each agent's capabilities and available tools.
2. **Execution and Review**: Agents complete their tasks with the option for asynchronous execution and callback functions for streamlined workflows.
3. **Sequential Task Progression**: Despite being a hierarchical process, tasks follow a logical order for smooth progression, facilitated by the manager's oversight.
## Conclusion
-Adopting the hierarchical process in CrewAI, with the correct configurations and understanding of the system's capabilities, facilitates an organized and efficient approach to project management. Utilize the advanced features and customizations to tailor the workflow to your specific needs, ensuring optimal task execution and project success.
\ No newline at end of file
+
+Adopting the hierarchical process in CrewAI, with the correct configurations and understanding of the system's capabilities, facilitates an organized and efficient approach to project management.
+Utilize the advanced features and customizations to tailor the workflow to your specific needs, ensuring optimal task execution and project success.
\ No newline at end of file
diff --git a/docs/how-to/Human-Input-on-Execution.md b/docs/how-to/human-input-on-execution.mdx
similarity index 88%
rename from docs/how-to/Human-Input-on-Execution.md
rename to docs/how-to/human-input-on-execution.mdx
index 543d48e68..de8c8a0a8 100644
--- a/docs/how-to/Human-Input-on-Execution.md
+++ b/docs/how-to/human-input-on-execution.mdx
@@ -1,15 +1,18 @@
---
title: Human Input on Execution
description: Integrating CrewAI with human input during execution in complex decision-making processes and leveraging the full capabilities of the agent's attributes and tools.
+icon: user-check
---
-# Human Input in Agent Execution
+## Human input in agent execution
-Human input is critical in several agent execution scenarios, allowing agents to request additional information or clarification when necessary. This feature is especially useful in complex decision-making processes or when agents require more details to complete a task effectively.
+Human input is critical in several agent execution scenarios, allowing agents to request additional information or clarification when necessary.
+This feature is especially useful in complex decision-making processes or when agents require more details to complete a task effectively.
-## Using Human Input with CrewAI
+## Using human input with CrewAI
-To integrate human input into agent execution, set the `human_input` flag in the task definition. When enabled, the agent prompts the user for input before delivering its final answer. This input can provide extra context, clarify ambiguities, or validate the agent's output.
+To integrate human input into agent execution, set the `human_input` flag in the task definition. When enabled, the agent prompts the user for input before delivering its final answer.
+This input can provide extra context, clarify ambiguities, or validate the agent's output.
### Example:
@@ -17,7 +20,7 @@ To integrate human input into agent execution, set the `human_input` flag in the
pip install crewai
```
-```python
+```python Code
import os
from crewai import Agent, Task, Crew
from crewai_tools import SerperDevTool
diff --git a/docs/how-to/Kickoff-async.md b/docs/how-to/kickoff-async.mdx
similarity index 94%
rename from docs/how-to/Kickoff-async.md
rename to docs/how-to/kickoff-async.mdx
index 8d0e6800b..099c7ebc6 100644
--- a/docs/how-to/Kickoff-async.md
+++ b/docs/how-to/kickoff-async.mdx
@@ -1,11 +1,13 @@
---
-title: Kickoff Async
+title: Kickoff Crew Asynchronously
description: Kickoff a Crew Asynchronously
+icon: rocket-launch
---
## Introduction
-CrewAI provides the ability to kickoff a crew asynchronously, allowing you to start the crew execution in a non-blocking manner. This feature is particularly useful when you want to run multiple crews concurrently or when you need to perform other tasks while the crew is executing.
+CrewAI provides the ability to kickoff a crew asynchronously, allowing you to start the crew execution in a non-blocking manner.
+This feature is particularly useful when you want to run multiple crews concurrently or when you need to perform other tasks while the crew is executing.
## Asynchronous Crew Execution
@@ -13,7 +15,7 @@ To kickoff a crew asynchronously, use the `kickoff_async()` method. This method
### Method Signature
-```python
+```python Code
def kickoff_async(self, inputs: dict) -> CrewOutput:
```
@@ -37,7 +39,7 @@ def kickoff_async(self, inputs: dict) -> CrewOutput:
Here's an example of how to kickoff a crew asynchronously using asyncio and awaiting the result:
-```python
+```python Code
import asyncio
from crewai import Crew, Agent, Task
@@ -74,7 +76,7 @@ asyncio.run(async_crew_execution())
In this example, we'll show how to kickoff multiple crews asynchronously and wait for all of them to complete using `asyncio.gather()`:
-```python
+```python Code
import asyncio
from crewai import Crew, Agent, Task
diff --git a/docs/how-to/Kickoff-for-each.md b/docs/how-to/kickoff-for-each.mdx
similarity index 79%
rename from docs/how-to/Kickoff-for-each.md
rename to docs/how-to/kickoff-for-each.mdx
index ea1d27441..4a83f7a5f 100644
--- a/docs/how-to/Kickoff-for-each.md
+++ b/docs/how-to/kickoff-for-each.mdx
@@ -1,17 +1,22 @@
---
-title: Kickoff For Each
-description: Kickoff a Crew for a List
+title: Kickoff Crew for Each
+description: Kickoff Crew for Each Item in a List
+icon: at
---
## Introduction
-CrewAI provides the ability to kickoff a crew for each item in a list, allowing you to execute the crew for each item in the list. This feature is particularly useful when you need to perform the same set of tasks for multiple items.
+
+CrewAI provides the ability to kickoff a crew for each item in a list, allowing you to execute the crew for each item in the list.
+This feature is particularly useful when you need to perform the same set of tasks for multiple items.
## Kicking Off a Crew for Each Item
-To kickoff a crew for each item in a list, use the `kickoff_for_each()` method. This method executes the crew for each item in the list, allowing you to process multiple items efficiently.
+
+To kickoff a crew for each item in a list, use the `kickoff_for_each()` method.
+This method executes the crew for each item in the list, allowing you to process multiple items efficiently.
Here's an example of how to kickoff a crew for each item in a list:
-```python
+```python Code
from crewai import Crew, Agent, Task
# Create an agent with code execution enabled
diff --git a/docs/how-to/langtrace-observability.mdx b/docs/how-to/langtrace-observability.mdx
new file mode 100644
index 000000000..fddb2cd65
--- /dev/null
+++ b/docs/how-to/langtrace-observability.mdx
@@ -0,0 +1,72 @@
+---
+title: Agent Monitoring with Langtrace
+description: How to monitor cost, latency, and performance of CrewAI Agents using Langtrace, an external observability tool.
+icon: chart-line
+---
+
+# Langtrace Overview
+
+Langtrace is an open-source, external tool that helps you set up observability and evaluations for Large Language Models (LLMs), LLM frameworks, and Vector Databases.
+While not built directly into CrewAI, Langtrace can be used alongside CrewAI to gain deep visibility into the cost, latency, and performance of your CrewAI Agents.
+This integration allows you to log hyperparameters, monitor performance regressions, and establish a process for continuous improvement of your Agents.
+
+
+
+
+
+## Setup Instructions
+
+
+
+ Sign up by visiting [https://langtrace.ai/signup](https://langtrace.ai/signup).
+
+
+ Set the project type to `CrewAI` and generate an API key.
+
+
+ Use the following command:
+
+ ```bash
+ pip install langtrace-python-sdk
+ ```
+
+
+ Import and initialize Langtrace at the beginning of your script, before any CrewAI imports:
+
+ ```python
+ from langtrace_python_sdk import langtrace
+ langtrace.init(api_key='')
+
+ # Now import CrewAI modules
+ from crewai import Agent, Task, Crew
+ ```
+
+
+
+### Features and Their Application to CrewAI
+
+1. **LLM Token and Cost Tracking**
+
+ - Monitor the token usage and associated costs for each CrewAI agent interaction.
+
+2. **Trace Graph for Execution Steps**
+
+ - Visualize the execution flow of your CrewAI tasks, including latency and logs.
+ - Useful for identifying bottlenecks in your agent workflows.
+
+3. **Dataset Curation with Manual Annotation**
+
+ - Create datasets from your CrewAI task outputs for future training or evaluation.
+
+4. **Prompt Versioning and Management**
+
+ - Keep track of different versions of prompts used in your CrewAI agents.
+ - Useful for A/B testing and optimizing agent performance.
+
+5. **Prompt Playground with Model Comparisons**
+
+ - Test and compare different prompts and models for your CrewAI agents before deployment.
+
+6. **Testing and Evaluations**
+
+ - Set up automated tests for your CrewAI agents and tasks.
\ No newline at end of file
diff --git a/docs/how-to/llm-connections.mdx b/docs/how-to/llm-connections.mdx
new file mode 100644
index 000000000..542a9c110
--- /dev/null
+++ b/docs/how-to/llm-connections.mdx
@@ -0,0 +1,182 @@
+---
+title: Connect to any LLM
+description: Comprehensive guide on integrating CrewAI with various Large Language Models (LLMs) using LiteLLM, including supported providers and configuration options.
+icon: brain-circuit
+---
+
+## Connect CrewAI to LLMs
+
+CrewAI uses LiteLLM to connect to a wide variety of Language Models (LLMs). This integration provides extensive versatility, allowing you to use models from numerous providers with a simple, unified interface.
+
+
+ By default, CrewAI uses the `gpt-4o-mini` model. This is determined by the `OPENAI_MODEL_NAME` environment variable, which defaults to "gpt-4o-mini" if not set.
+ You can easily configure your agents to use a different model or provider as described in this guide.
+
+
+## Supported Providers
+
+LiteLLM supports a wide range of providers, including but not limited to:
+
+- OpenAI
+- Anthropic
+- Google (Vertex AI, Gemini)
+- Azure OpenAI
+- AWS (Bedrock, SageMaker)
+- Cohere
+- Hugging Face
+- Ollama
+- Mistral AI
+- Replicate
+- Together AI
+- AI21
+- Cloudflare Workers AI
+- DeepInfra
+- Groq
+- And many more!
+
+For a complete and up-to-date list of supported providers, please refer to the [LiteLLM Providers documentation](https://docs.litellm.ai/docs/providers).
+
+## Changing the LLM
+
+To use a different LLM with your CrewAI agents, you have several options:
+
+
+
+ Pass the model name as a string when initializing the agent:
+
+ ```python Code
+ from crewai import Agent
+
+ # Using OpenAI's GPT-4
+ openai_agent = Agent(
+ role='OpenAI Expert',
+ goal='Provide insights using GPT-4',
+ backstory="An AI assistant powered by OpenAI's latest model.",
+ llm='gpt-4'
+ )
+
+ # Using Anthropic's Claude
+ claude_agent = Agent(
+ role='Anthropic Expert',
+ goal='Analyze data using Claude',
+ backstory="An AI assistant leveraging Anthropic's language model.",
+ llm='claude-2'
+ )
+ ```
+
+
+
+ For more detailed configuration, use the LLM class:
+
+ ```python Code
+ from crewai import Agent, LLM
+
+ llm = LLM(
+ model="gpt-4",
+ temperature=0.7,
+ base_url="https://api.openai.com/v1",
+ api_key="your-api-key-here"
+ )
+
+ agent = Agent(
+ role='Customized LLM Expert',
+ goal='Provide tailored responses',
+ backstory="An AI assistant with custom LLM settings.",
+ llm=llm
+ )
+ ```
+
+
+
+
+## Configuration Options
+
+When configuring an LLM for your agent, you have access to a wide range of parameters:
+
+| Parameter | Type | Description |
+|:----------|:-----:|:-------------|
+| **model** | `str` | The name of the model to use (e.g., "gpt-4", "claude-2") |
+| **temperature** | `float` | Controls randomness in output (0.0 to 1.0) |
+| **max_tokens** | `int` | Maximum number of tokens to generate |
+| **top_p** | `float` | Controls diversity of output (0.0 to 1.0) |
+| **frequency_penalty** | `float` | Penalizes new tokens based on their frequency in the text so far |
+| **presence_penalty** | `float` | Penalizes new tokens based on their presence in the text so far |
+| **stop** | `str`, `List[str]` | Sequence(s) to stop generation |
+| **base_url** | `str` | The base URL for the API endpoint |
+| **api_key** | `str` | Your API key for authentication |
+
+For a complete list of parameters and their descriptions, refer to the LLM class documentation.
+
+## Connecting to OpenAI-Compatible LLMs
+
+You can connect to OpenAI-compatible LLMs using either environment variables or by setting specific attributes on the LLM class:
+
+
+
+
+ ```python Code
+ import os
+
+ os.environ["OPENAI_API_KEY"] = "your-api-key"
+ os.environ["OPENAI_API_BASE"] = "https://api.your-provider.com/v1"
+ os.environ["OPENAI_MODEL_NAME"] = "your-model-name"
+ ```
+
+
+
+
+ ```python Code
+ llm = LLM(
+ model="custom-model-name",
+ api_key="your-api-key",
+ base_url="https://api.your-provider.com/v1"
+ )
+ agent = Agent(llm=llm, ...)
+ ```
+
+
+
+
+## Using Local Models with Ollama
+
+For local models like those provided by Ollama:
+
+
+
+ [Click here to download and install Ollama](https://ollama.com/download)
+
+
+ For example, run `ollama pull llama3.2` to download the model.
+
+
+
+ ```python Code
+ agent = Agent(
+ role='Local AI Expert',
+ goal='Process information using a local model',
+ backstory="An AI assistant running on local hardware.",
+ llm=LLM(model="ollama/llama3.2", base_url="http://localhost:11434")
+ )
+ ```
+
+
+
+
+## Changing the Base API URL
+
+You can change the base API URL for any LLM provider by setting the `base_url` parameter:
+
+```python Code
+llm = LLM(
+ model="custom-model-name",
+ base_url="https://api.your-provider.com/v1",
+ api_key="your-api-key"
+)
+agent = Agent(llm=llm, ...)
+```
+
+This is particularly useful when working with OpenAI-compatible APIs or when you need to specify a different endpoint for your chosen provider.
+
+## Conclusion
+
+By leveraging LiteLLM, CrewAI offers seamless integration with a vast array of LLMs. This flexibility allows you to choose the most suitable model for your specific needs, whether you prioritize performance, cost-efficiency, or local deployment. Remember to consult the [LiteLLM documentation](https://docs.litellm.ai/docs/) for the most up-to-date information on supported models and configuration options.
\ No newline at end of file
diff --git a/docs/how-to/replay-tasks-from-latest-crew-kickoff.mdx b/docs/how-to/replay-tasks-from-latest-crew-kickoff.mdx
new file mode 100644
index 000000000..782f2d04f
--- /dev/null
+++ b/docs/how-to/replay-tasks-from-latest-crew-kickoff.mdx
@@ -0,0 +1,80 @@
+---
+title: Replay Tasks from Latest Crew Kickoff
+description: Replay tasks from the latest crew.kickoff(...)
+icon: arrow-right
+---
+
+## Introduction
+
+CrewAI provides the ability to replay from a task specified from the latest crew kickoff. This feature is particularly useful when you've finished a kickoff and may want to retry certain tasks or don't need to refetch data over and your agents already have the context saved from the kickoff execution so you just need to replay the tasks you want to.
+
+
+ You must run `crew.kickoff()` before you can replay a task.
+ Currently, only the latest kickoff is supported, so if you use `kickoff_for_each`, it will only allow you to replay from the most recent crew run.
+
+
+Here's an example of how to replay from a task:
+
+### Replaying from Specific Task Using the CLI
+
+To use the replay feature, follow these steps:
+
+
+
+
+
+
+
+ To view the latest kickoff task_ids use:
+
+ ```shell
+ crewai log-tasks-outputs
+ ```
+
+ Once you have your `task_id` to replay, use:
+
+ ```shell
+ crewai replay -t
+ ```
+
+
+
+
+ Ensure `crewai` is installed and configured correctly in your development environment.
+
+
+### Replaying from a Task Programmatically
+
+To replay from a task programmatically, use the following steps:
+
+
+
+ Specify the `task_id` and input parameters for the replay process.
+
+
+ Execute the replay command within a try-except block to handle potential errors.
+
+ ```python Code
+ def replay():
+ """
+ Replay the crew execution from a specific task.
+ """
+ task_id = ''
+ inputs = {"topic": "CrewAI Training"} # This is optional; you can pass in the inputs you want to replay; otherwise, it uses the previous kickoff's inputs.
+ try:
+ YourCrewName_Crew().crew().replay(task_id=task_id, inputs=inputs)
+
+ except subprocess.CalledProcessError as e:
+ raise Exception(f"An error occurred while replaying the crew: {e}")
+
+ except Exception as e:
+ raise Exception(f"An unexpected error occurred: {e}")
+ ```
+
+
+
+
+## Conclusion
+
+With the above enhancements and detailed functionality, replaying specific tasks in CrewAI has been made more efficient and robust.
+Ensure you follow the commands and steps precisely to make the most of these features.
\ No newline at end of file
diff --git a/docs/how-to/Sequential.md b/docs/how-to/sequential-process.mdx
similarity index 79%
rename from docs/how-to/Sequential.md
rename to docs/how-to/sequential-process.mdx
index ef58894ba..3957a7d5c 100644
--- a/docs/how-to/Sequential.md
+++ b/docs/how-to/sequential-process.mdx
@@ -1,23 +1,30 @@
---
-title: Using the Sequential Processes in crewAI
-description: A comprehensive guide to utilizing the sequential processes for task execution in crewAI projects.
+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.
+
+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.
+
+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
+```python Code
from crewai import Crew, Process, Agent, Task, TaskOutput, CrewOutput
# Define your agents
@@ -38,9 +45,21 @@ writer = Agent(
)
# 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')
+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(
@@ -58,9 +77,11 @@ 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.
@@ -68,28 +89,39 @@ Each task in a sequential process **must** have an agent assigned. Ensure that e
## 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.
+
+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.
+
+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.
\ No newline at end of file
+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.
\ No newline at end of file
diff --git a/docs/assets/agentops-overview.png b/docs/images/agentops-overview.png
similarity index 100%
rename from docs/assets/agentops-overview.png
rename to docs/images/agentops-overview.png
diff --git a/docs/assets/agentops-replay.png b/docs/images/agentops-replay.png
similarity index 100%
rename from docs/assets/agentops-replay.png
rename to docs/images/agentops-replay.png
diff --git a/docs/assets/agentops-session.png b/docs/images/agentops-session.png
similarity index 100%
rename from docs/assets/agentops-session.png
rename to docs/images/agentops-session.png
diff --git a/docs/assets/langtrace1.png b/docs/images/langtrace1.png
similarity index 100%
rename from docs/assets/langtrace1.png
rename to docs/images/langtrace1.png
diff --git a/docs/assets/langtrace2.png b/docs/images/langtrace2.png
similarity index 100%
rename from docs/assets/langtrace2.png
rename to docs/images/langtrace2.png
diff --git a/docs/assets/langtrace3.png b/docs/images/langtrace3.png
similarity index 100%
rename from docs/assets/langtrace3.png
rename to docs/images/langtrace3.png
diff --git a/docs/index.md b/docs/index.md
deleted file mode 100644
index 93f2105c1..000000000
--- a/docs/index.md
+++ /dev/null
@@ -1,228 +0,0 @@
-
-
-# crewAI Documentation
-
-Cutting-edge framework for orchestrating role-playing, autonomous AI agents. By fostering collaborative intelligence, CrewAI empowers agents to work together seamlessly, tackling complex tasks.
-
-