Crew AI Build AI Agents Team With Local LLMs For Content Creation

AI Business Ideas @ Benji
27 Feb 202407:28

Summary

TLDRThe video tutorial demonstrates how to use Crew AI, a framework for building automated workflows using multiple AI agents. It shows how to connect local LLMs like Anthropic's Constitutional AI and LM Studio to Crew AI to define different agents with specific roles. A sample workflow is created with a 'researcher' agent that gathers information on AI advancements online using DuckDuckGo and a 'writer' agent that generates a blog post on the topic. The workflow enables automating research and content creation by harnessing multiple LLMs. Crew AI provides flexible integration of different LLMs to build efficient, multi-agent automation.

Takeaways

  • 😀 Crew AI allows creating workflows using multiple AI models as agents
  • 👥 You can connect Crew AI to OpenAI, Anthropic, Cohere, or local LLMs like AMA
  • 💻 Installation requires Python and some dependencies like DuckDuckGo
  • 🤖 Agents are defined with a LLM, work scope, and backstory
  • 🔀 Tasks define what each agent must do in the workflow
  • ✏️ A sample workflow gathers AI advancements info to generate blog content
  • 📝 One agent researches info, another writes content based on that info
  • ⚙️ Workflows can be sequential or hierarchical depending on needs
  • 🔗 You can connect LM Studio in addition to AMA as agents
  • 🎉 Crew AI enables automating workflows using multiple LLMs easily

Q & A

  • What is Crew AI?

    -Crew AI is a multiple AI agent framework that allows users to build workflows using multiple AI models as autonomous agents to complete automation tasks.

  • What types of large language models can be connected to Crew AI?

    -Crew AI can connect to models like GPT from OpenAI, as well as local large language models hosted on the user's machine, like those from Anthropic, Cohere, or LM Studio.

  • How does Crew AI allow the AI models to search the internet?

    -Crew AI uses the DuckDuckGo search library to enable the AI agents to search the internet and retrieve information.

  • What is the purpose of defining a workscope and backstory?

    -Defining a workscope and backstory provides context for the AI agents to understand their roles and objectives within the workflow.

  • What were the two agents defined in the example workflow?

    -The two agents were a 'Researcher' responsible for gathering information, and a 'Tech Content Strategist' responsible for using that information to write tech content.

  • How did the two agents interact in the workflow?

    -The Researcher gathered information on AI advancements from the internet, then passed that information to the Tech Content Strategist to write content based on it.

  • What tools did the agents use if they needed additional information?

    -The agents used the DuckDuckGo search library to search the internet for any additional information they needed.

  • What was the end result of the workflow?

    -The end result was a set of paragraphs with titles constituting a blog post on AI advancements.

  • Besides AMA, what other local large language model could be connected?

    -The script shows how LM Studio could also be connected as one of the agents in the workflow.

  • What benefits does Crew AI provide for content creation?

    -Crew AI allows automating content creation by using multiple AI agents in defined roles within a workflow.

Outlines

00:00

😊 Introduction to Crew AI and its capabilities

The paragraph introduces Crew AI, a tool that allows creating workflows using multiple AI models as autonomous agents. It allows connecting local LLMs like AMA or LM Studio to perform various tasks like content creation. The tutorial will demonstrate setting up Crew AI on a PC and connecting it to AMA and LM Studio to generate content.

05:01

👩‍💻 Step-by-step walkthrough on using Crew AI

The paragraph provides a detailed walkthrough on using Crew AI - installing it, connecting local LLMs, creating a script with multiple agents, defining tasks for research and content writing, executing the workflow to gather information and generate content. It shows a sample output demonstrating how the researcher gathers information which the writer uses to generate content.

Mindmap

Keywords

💡crew AI

Crew AI is a multiple AI agent framework that allows users to build workflows using multiple AI models as autonomous agents to complete automation tasks. It is the main focus of the tutorial video, allowing connection to large language models like AMA and LM Studio to define agents and tasks.

💡workflow

A workflow refers to a sequence or chain of multiple AI agents and tasks defined in crew AI to accomplish an overall goal. The video demonstrates building a simple 2-agent workflow to gather information and write blog content.

💡agent

Agents in crew AI refer to the individual AI models like AMA, LM Studio etc that are assigned specific roles and responsibilities in the workflow. The video defines a 'researcher' and 'content writer' agent.

💡task

Tasks define the objectives to be completed by each agent within the workflow. Example tasks are gathering information, writing content paragraphs etc based on the agent's role.

💡DuckDuckGo

The DuckDuckGo search library allows the AI agents to search the internet and retrieve external information when needed to complete their tasks in the workflow.

💡AMA

AMA refers to Anthropic's conversational AI model, which is locally hosted and accessed via API in the tutorial video to serve as one of the multiple agents in crew AI.

💡LM Studio

LM Studio is used to locally host a large language model which can also be connected as an agent in crew AI workflows, demonstrated in the later part of the video.

💡automation

A key benefit of crew AI is enabling automation of tasks by defining workflows for agents. The video automates research and content writing through its 2-agent workflow.

💡API

API refers to the interface for programmatically accessing AI models like AMA and LM Studio. Crew AI connects to them via defined API urls and keys.

💡code

The video walks through sample crew AI code for importing libraries, defining agents and tasks, and executing the automated workflow with multiple AI agents.

Highlights

Crew AI allows us to build a workflow using multiple AI models as autonomous agents

We can connect Crew AI to OpenAI, Anthropic, Cohere, or a local LLM like AMA or LM Studio

Crew AI provides instructions on connecting different LLMs and customizing AI agents

We design workflows using sequential or hierarchical processes with multiple agents

Crew AI shows how to connect AMA and LM Studio locally without an API key

We define work scope, backstory, LLM, and tasks for each agent in the workflow

One agent researches information, the other writes content based on that

Agents analyze if they need more info and can search DuckDuckGo if researcher

We define the crew with agents, tasks, and execute the workflow

Researcher gathers info, writer creates content in 4 paragraphs

Example workflow shows automation for content creation from research

Can connect multiple LLMs like AMA and LM Studio as different agents

Code shows how to define API URL to connect other LLMs as agents

Example workflow automates researcher and writer tasks for content creation

Transcripts

play00:00

crew AI a multiple AI agent framework

play00:04

allows us to build a workflow that

play00:06

autonomously agents to complete

play00:08

automation tasks for us let's check it

play00:11

out so in this tutorial we are going

play00:14

through crew AI it allows us to build a

play00:17

chain of workflows using multiple AI

play00:19

models as our autonomous agents to

play00:22

accomplish certain tasks that you define

play00:25

for the AI agents here we will have a

play00:28

step-by-step walkthr on how we can set

play00:31

this up on our PC and also connect it

play00:33

with our local llm models to run certain

play00:36

tests and perform content creation

play00:39

processes so right here as we can see

play00:42

the crew AI official page is open-

play00:45

Source tools and it allows us to use any

play00:48

large language models for example you

play00:50

can connect with your open AI API key to

play00:53

use Chad GPT or if you have a local

play00:55

large language model you can connect

play00:57

with Ama or LM Studio to incorp

play00:59

incorporate those large language models

play01:02

into your workflow and Define multiple

play01:05

large language models as individual AI

play01:08

agents to complete specific tasks in the

play01:11

documentation they provide clear

play01:13

instructions on how to connect with any

play01:15

large language models customize the

play01:17

agents and utilize sequential or

play01:20

hierarchical processes to design

play01:22

efficient workflows importantly you need

play01:25

to know how to connect with a large

play01:27

language model hosted locally on your PC

play01:31

for example we have LM Studio here in

play01:34

this section it shows you how to define

play01:36

the API based URL for LM Studio you

play01:39

don't need an API key so leave that

play01:42

field empty additionally they provide

play01:44

examples on how to connect with AMA in

play01:47

this video we are going to connect with

play01:49

these two popular options AMA and LM

play01:52

Studio you can also connect with

play01:55

Microsoft Windows Azure to access their

play01:57

AI Studios using authorization keys and

play02:00

API Keys now let's get started with

play02:03

creating a workflow and connecting those

play02:06

large language models in crew AI first

play02:10

we need to install crew AI by running

play02:12

this command prompt and downloading the

play02:14

necessary

play02:19

files after that it will automatically

play02:23

install the required

play02:26

components then we need to install the

play02:29

duck duck go search Library this library

play02:32

is essential for enabling our AI to

play02:34

search the internet and retrieve

play02:36

information for

play02:38

us once that is done we are good to go

play02:41

now let's open Visual Studio code vs

play02:44

code and start creating our script for

play02:46

multiple AI agents here I have already

play02:49

run two AMA large language models one is

play02:52

Mistral and one is llama 2 so both of

play02:56

them just keep that command prompt

play02:57

running in the background and also the

play02:59

AMA running the AMA server here which

play03:02

allows API access for AMA so in here we

play03:06

have vs code and this script you can

play03:09

download it on the GitHub page of crew

play03:11

AI I will post a link to it in the video

play03:13

description below scroll up here and as

play03:16

you can see I have the Lama 2 and

play03:19

Mistral using as well to connect here

play03:22

basically I will use this tool to

play03:24

generate content for my workflows and to

play03:26

run two individual agents in different

play03:29

roles in this workflow and right here

play03:32

this is the template of the very basic

play03:34

crew AI multiple agents creation script

play03:37

and above that we have the installation

play03:40

command prompt you can just copy this

play03:42

too and install it and it's pretty easy

play03:45

actually let's go through each of the

play03:47

rows that we are going to do so in the

play03:49

OS versions here we have the open AI API

play03:52

key now we don't need that so we just

play03:55

put that into comments and we don't need

play03:57

to run that script then we scroll down

play04:00

into here let's go through each one so

play04:04

running 2 and then Mistral running as

play04:07

the second agent using

play04:10

Al and right below that we have the land

play04:13

chain tools that is we import the Duck

play04:16

Duck Go search and we are going to use

play04:19

Duck Duck Go search to gather

play04:21

information online if the large language

play04:24

model necessary needs some information

play04:26

from them and then we have to Define

play04:30

the llm on each agent here these llms

play04:33

are using the llm which is the Llama

play04:36

tool that I defined at the beginning of

play04:38

this script then we have the work scope

play04:40

and the backstory you have to define

play04:42

those as well and then the second agent

play04:45

here is the tech content strategist

play04:49

which is the content writer for the tech

play04:51

content blow poost these agents are

play04:54

responsible for gathering information

play04:56

from the first agent and then writing

play04:58

content based on it

play05:00

these agents are going to use mistal llm

play05:03

from my defined Al agent large language

play05:05

model for this agent lastly we have to

play05:08

create the tasks the tasks are going to

play05:12

Define what these two agents have to do

play05:14

in this workflow there's task one which

play05:17

is the researcher and task two which is

play05:20

the writer the writer is going to write

play05:22

about the AI advancements based on the

play05:25

content they're getting from the

play05:26

researcher lastly we have to Define find

play05:29

the crew the crew includes the agents

play05:32

and tasks that are included in this crew

play05:34

workflow lastly it will execute on the

play05:37

last command code here is my first run

play05:40

using this code and it gathers

play05:42

information from the researcher so the

play05:44

researcher is going to the internet and

play05:46

then Gathering the information secondly

play05:49

we have the tech content strategist who

play05:51

will use that information to write four

play05:54

paragraphs of content or code for my

play05:56

blog post this is a very typical iCal

play05:59

task for lots of bloggers and website

play06:02

owners who want to create new content

play06:05

this kind of workflow is simple yet

play06:07

effective and practical allowing people

play06:09

to automate this task here as you can

play06:12

see each AI agent has its own automation

play06:15

they will analyze if they need tools to

play06:17

run their tasks and then answer

play06:20

themselves if the answer is yes they

play06:22

will use duck ducko if the agent is a

play06:25

researcher they will go online and

play06:28

search for re AI advancements and pass

play06:31

that information to the

play06:33

writers the content writers will then

play06:37

write the content based on that

play06:39

information the content is divided into

play06:42

different paragraphs as you can see with

play06:44

title paragraphs and all the content and

play06:47

additional thoughts about the content

play06:49

this is how we use crew AI Additionally

play06:51

you can also connect LM studio with crew

play06:54

AI not just AMA in this case we have the

play06:57

first agents using Ama and the second

play07:00

agents using LM Studio the code is

play07:03

provided here for the first one as you

play07:05

can see we use the URL at the top to

play07:07

connect and create content using other

play07:10

large language models as agents in this

play07:13

workflow I hope you find inspiration in

play07:16

using crew AI this is a simple workflow

play07:18

using two agents in one automation

play07:21

workflow I will see you in the next

play07:23

tutorial have a nice day

play07:27

bye