Quickstart
Build your first AI agent with CrewAI in under 5 minutes.
Build your first CrewAI Agent
Let’s create a simple crew that will help us research
and report
on the latest AI developments
for a given topic or subject.
Before we proceed, make sure you have finished installing CrewAI. If you haven’t installed them yet, you can do so by following the installation guide.
Follow the steps below to get Crewing! 🚣♂️
Create your crew
Create a new crew project by running the following command in your terminal.
This will create a new directory called latest-ai-development
with the basic structure for your crew.
Navigate to your new crew project
Modify your `agents.yaml` file
You can also modify the agents as needed to fit your use case or copy and paste as is to your project.
Any variable interpolated in your agents.yaml
and tasks.yaml
files like {topic}
will be replaced by the value of the variable in the main.py
file.
Modify your `tasks.yaml` file
Modify your `crew.py` file
[Optional] Add before and after crew functions
Feel free to pass custom inputs to your crew
For example, you can pass the topic
input to your crew to customize the research and reporting.
Set your environment variables
Before running your crew, make sure you have the following keys set as environment variables in your .env
file:
- An OpenAI API key (or other LLM API key):
OPENAI_API_KEY=sk-...
- A Serper.dev API key:
SERPER_API_KEY=YOUR_KEY_HERE
Lock and install the dependencies
- Lock the dependencies and install them by using the CLI command:
- If you have additional packages that you want to install, you can do so by running:
Run your crew
- To run your crew, execute the following command in the root of your project:
Enterprise Alternative: Create in Crew Studio
For CrewAI Enterprise users, you can create the same crew without writing code:
- Log in to your CrewAI Enterprise account (create a free account at app.crewai.com)
- Open Crew Studio
- Type what is the automation you’re tryign to build
- Create your tasks visually and connect them in sequence
- Configure your inputs and click “Download Code” or “Deploy”
Try CrewAI Enterprise
Start your free account at CrewAI Enterprise
View your final report
You should see the output in the console and the report.md
file should be created in the root of your project with the final report.
Here’s an example of what the report should look like:
Congratulations!
You have successfully set up your crew project and are ready to start building your own agentic workflows!
Note on Consistency in Naming
The names you use in your YAML files (agents.yaml
and tasks.yaml
) should match the method names in your Python code.
For example, you can reference the agent for specific tasks from tasks.yaml
file.
This naming consistency allows CrewAI to automatically link your configurations with your code; otherwise, your task won’t recognize the reference properly.
Example References
Note how we use the same name for the agent in the agents.yaml
(email_summarizer
) file as the method name in the crew.py
(email_summarizer
) file.
Note how we use the same name for the task in the tasks.yaml
(email_summarizer_task
) file as the method name in the crew.py
(email_summarizer_task
) file.
Deploying Your Project
The easiest way to deploy your crew is through CrewAI Enterprise, where you can deploy your crew in a few clicks.
Was this page helpful?