Build Multi AI Agent System with an Open-sourced LLM and CrewAI

Share it with your senior IT friends and colleagues
Reading Time: 3 minutes

Namaste and Welcome to Build It Yourself.

AI Agent is the hottest topic in the AI world.

Basically, AI Agents can interact with external applications and provide personalized assistance to users.

Learn everything about AI Agent – https://www.aimletc.com/what-are-llm-agents-why-are-everyone-talking-about-them/

In this video, we will make a Multi AI agent system for writing purposes. We will build 3 Agents for Planning, Writing and Editing the content.

These 3 Agents will work in tandem to complete the task of writing on any chosen topic.

Who is this article for?

The article is for senior IT professionals who want to keep them updated with the latest trends in AI and Generative AI.

We will use this Google Colab Notebook – https://colab.research.google.com/drive/1xYw84L56qnlz-yB6JGufHrs2Xo9alKiC

Let us dive into it.

Pre-requisites for building an LLM Agent

– An Open Mind to learn new things

– Huggingface account

– HuggingFace Access Token

The source code for this video was taken from – https://www.deeplearning.ai/short-courses/multi-ai-agent-systems-with-crewai/

How to get HuggingFace Access Token

Don’t worry, it’s not a very technical thing. Just follow the below instructions to get it.

HuggingFace provides an option to create a free access token. We will just generate that.

Step 1 – Login to HuggingFace – https://huggingface.co/

Create an account if you don’t have one already

Step 2 – Click on the right top corner and go to Settings

Step 3 – On Left hand side, you will get Access Tokens, click on it

Step 4 – Generate a new token by clicking on it.

Make sure, you copy it and write it somewhere as you will not be able to access it again.

Through this Access token, you can access any open-source AI model present on HuggingFace

How we will create a Multi AI Agent System

We will use CrewAI to build these agents. These are the steps we will follow

  1. Create 3 Agents – Planner, Writer and Editor
  2. Create 3 Tasks – Planning, Writing and Editing
  3. Create the Crew

The first step is obviously to install all necessary libraries and import them

We will then add any open-sourced LLM of our choice. I have used Zephyr-7b-beta. Please feel free to experiment here.

Check How to access open-sourced LLMs from Huggingface on Colab

Creating an Agent

While creating an Agent, we need to specify 3 things – Role, Goal and Backstory. Your major effort should go here is defining these 3.

Sometimes it could take weeks to come up with the right description for the backstory.

Creating Tasks

After creating Agents, the important job is to create Tasks that the Agents will perform. We need to properly think through the task description and create the tasks.

Creating the Crew

Now, let us combine Agents & tasks and create the Crew.

After creating the Crew, run the crew by adding any topic on which you want the Multi AI Agent system to create content.

Once you run the crew, check the whole process, how the AI agent was thinking and passing the work to another agent and what changes the other Agent is making.

Also, try with multiple topics. Happy learning!

AI + Gen AI Courses for Senior IT Professionals

In case you are looking to learn AI + LLM in a very simple language in a live online class from an instructor, check out the details here

Pricing for AI courses for senior IT professionals – https://www.aimletc.com/ai-ml-etc-course-offerings-pricing/

Check out these free videos to start your AI learning journey – https://www.aimletc.com/free-course-1-introduction-to-ml-and-ai/

Connect with me on LinkedIn – https://www.linkedin.com/in/nikhileshtayal/

Share it with your senior IT friends and colleagues
Nikhilesh Tayal
Nikhilesh Tayal
Articles: 51