-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clean up pipeline #1187
Merged
Merged
Clean up pipeline #1187
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
32ca229
Clean up pipeline
bhancockio 5df28d2
Make versioning dynamic in templates
bhancockio 202e36e
fix .env issues when openai is trying to use invalid keys
bhancockio fd12866
Fix type checker issue in pipeline
bhancockio 9c87f9e
Merge branch 'main' into bugfix/pipeline-followup-review
bhancockio 4377d1d
Fix tests.
bhancockio fc39bb7
Merge branch 'main' into bugfix/pipeline-followup-review
bhancockio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
136 changes: 136 additions & 0 deletions
136
docs/getting-started/Create-a-New-CrewAI-Pipeline-Template-Method.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
# 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 <project_name> | ||
``` | ||
|
||
2. For a pipeline example that includes a router: | ||
|
||
```shell | ||
$ crewai create pipeline --router <project_name> | ||
``` | ||
|
||
These commands will create a new project folder with the following structure: | ||
|
||
``` | ||
<project_name>/ | ||
├── README.md | ||
├── poetry.lock | ||
├── pyproject.toml | ||
├── src/ | ||
│ └── <project_name>/ | ||
│ ├── __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/<project_name>/crews/` to define your agents and tasks for each crew. | ||
2. Modify the pipeline files in `src/<project_name>/pipelines/` to define your pipeline structure. | ||
3. Modify `src/<project_name>/main.py` to set up and run your pipelines. | ||
4. Add your environment variables into the `.env` file. | ||
|
||
### Example: Defining a Pipeline | ||
|
||
Here's an example of how to define a pipeline in `src/<project_name>/pipelines/normal_pipeline.py`: | ||
|
||
```python | ||
from crewai import Pipeline | ||
from crewai.project import PipelineBase | ||
from ..crews.normal_crew import NormalCrew | ||
|
||
@PipelineBase | ||
class NormalPipeline: | ||
def __init__(self): | ||
# Initialize crews | ||
self.normal_crew = NormalCrew().crew() | ||
|
||
def create_pipeline(self): | ||
return Pipeline( | ||
stages=[ | ||
self.normal_crew | ||
] | ||
) | ||
|
||
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 <project_name> | ||
$ poetry lock | ||
$ poetry install | ||
``` | ||
|
||
## Running Your Pipeline Project | ||
|
||
To run your pipeline project, use the following command: | ||
|
||
```shell | ||
$ crewai run | ||
``` | ||
|
||
or | ||
|
||
```shell | ||
$ poetry run <project_name> | ||
``` | ||
|
||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ authors = ["Your Name <[email protected]>"] | |
|
||
[tool.poetry.dependencies] | ||
python = ">=3.10,<=3.13" | ||
crewai = { extras = ["tools"], version = "^0.51.0" } | ||
crewai = { extras = ["tools"], version = ">=0.51.0,<1.0.0" } | ||
|
||
|
||
[tool.poetry.scripts] | ||
{{folder_name}} = "{{folder_name}}.main:run" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,7 @@ authors = ["Your Name <[email protected]>"] | |
|
||
[tool.poetry.dependencies] | ||
python = ">=3.10,<=3.13" | ||
crewai = { extras = ["tools"], version = "^0.51.0" } | ||
crewai = { extras = ["tools"], version = ">=0.51.0,<1.0.0" } | ||
asyncio = "*" | ||
|
||
[tool.poetry.scripts] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,8 @@ authors = ["Your Name <[email protected]>"] | |
|
||
[tool.poetry.dependencies] | ||
python = ">=3.10,<=3.13" | ||
crewai = { extras = ["tools"], version = "^0.51.0" } | ||
crewai = { extras = ["tools"], version = ">=0.51.0,<1.0.0" } | ||
|
||
|
||
[tool.poetry.scripts] | ||
{{folder_name}} = "{{folder_name}}.main:main" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
very nice