In this tutorial, I'm going to teach you how to build a team of AI agents without writing a single
line of code.
Let's do a quick demo and see what this team of agents can do for you.
Let me show you how this works.
So we will communicate just with our supervisor agent via telegram, because it acts as the coordinator
and delegates the tasks to three specialized sub agents.
So the research agent, email agent, and calendar agent.
We can use both voice or text.
You can give your agent multiple tasks at once.
So I've prepared a prompt.
So I'm just gonna copy and paste it.
So let's test it and ask to check what's on my schedule today etc..
So I'm gonna click Test Workflow.
Send this message.
So I want it to check what's on my schedule today.
Send an email to Mark Johnson to cancel our meeting and let him know.
I will contact him later at two.
Reschedule and give me news about Leipzig from today.
So our supervisor agent calls the calendar and research agents to fulfill these tasks.
The calendar agent fetches the details from my Google calendar and sends them back to the main agent
to create a response for me.
And the research agent scrapes the internet to find the news articles about Dopesick.
It takes a moment.
So now we got a response.
Here is a summary of your requests.
So today's schedule Projects meeting client brainstorming with Mark and Jim.
Upper body.
So now let's check my calendar.
And this is correct.
So now let's check my inbox.
And yes, we got an email about the meeting cancellation.
Hi Mark, I hope this message finds you well, etc..
Now our agent also.
Wants the latest news about Leipzig.
So let's have a look.
So recent news about Leipzig.
And we can see all the headlines here along with links to the original articles.
So let's check one of them.
Investigates.
Deep six use of its models.
Open it.
And yep, this one was posted today.
We can also send a voice message to our agent.
I will show you two ways to generate a voice for other agents, so you will have plenty of voices to
choose from.
You can even generate or clone your own voice or someone else's.
You can also provide our agent with a custom knowledge base like contact details, frequently ask questions,
training materials, product lists.
In this setup, we have contact details.
So we store it in Google Sheets in Google Drive, but you can use any storage like any storage format
Not like PDFs, docs, etc..
You can also implement persistent memory.
All right.
So this is your canvas.
We'll start by renaming the workflow from my workflow to the team of agents.
And press enter just to confirm it.
Next I strongly recommend changing your time zone so the times are correct for all tasks.
So click on these three dots.
Click on settings.
And select your time zone.
Save it.
So our first step is creating the supervisor agent.
So let's add our first node.
So click on this plus button.
Type a agent.
Click on it.
Close it for now.
So basically nodes represent actions like fetching data, sending emails or making API calls.
So let's rename our agent to.
Supervisor or agent.
Click rename to confirm it.
And now we have to set up a trigger which starts the workflow.
So usually it's the communication channel you want to communicate with your agent.
So every workflow needs a trigger to be activated.
And by default we have this chat on message.
So let's get rid of it.
So click on this plus button again.
And you can activate the workflow manually on App events which will use in this setup.
But you can also run your workflow on a schedule like every day, every hour, etc. you can use webhook
call or on the form submission.
So now click on App Event.
And now we have to select the platform We want to communicate with.
You can choose WhatsApp.
Telegram.
Slack.
And other platforms.
So we will use telegram because it's very easy to set up.
So click on this telegram node.
I've got a tutorial on how to set up WhatsApp in six minutes, so check it out if you prefer WhatsApp.
So the trigger we need is on message.
So this means the workflow will start when we send a message to our agent on telegram.
So click on that.
First we need to set up our telegram credentials to connect our agents to telegram.
So click on this drop down and select Create New Credential.
Now we need to provide the access token.
And edit N makes it easy.
So you can click on Open Docs.
If you need help filling out these fields to follow the instructions yourself.
So it looks like that.
Or just follow along with me right now.
If we send a message on telegram, nothing will happen.
That's because N810 is not listening for events yet and our workflow is not activated.
So let's close it.
And at this point, we will not get answer from our agent because it's not connected to a large language
model, which essentially acts as the agent's brain.
So to add a brain to our agent, click on this plus button.
And here are all the available options.
We can integrate all of OpenAI's models like GPT four, GPT four, mini, etc. you can use cloud 3.5
sonnet by using this node.
We can use grok here.
You can choose the model you would like to use as a brain for your AI agent.
For this tutorial, we'll be using GPT four mini because it's very fast and cost effective.
And I prepared a well detailed prompts to guide it so it's good enough.
But you can choose the other models like GPT four.
Now let's go back to the canvas.
Now let's move this trigger.
Note the left side.
Connect it to a supervisor agent.
And now we need to add a memory node.
As you can see.
So click on this plus button and choose Window Buffer memory.
We need to retrieve this session ID.
Because the memory node allows the agent to remember past messages from our conversation.
So change the session ID to define below.
Close it for now.
Click on Test Workflow.
And send any message on on telegram.
I'm just gonna say hi.
Now open this note again.
And you can get a conversation ID from a trigger note by going to mapping.
Just grab this ID.
And drop it over here.
So now the context window length sets how many pass messages to include.
So for example let's say we want our agent to remember ten previous messages.
Let's close it for now.
Let's hit save.
This workflow again.
Set message.
Anything.
Now we got another error.
So let's open our agent.
And as you can see there is no prompt specified.
So we need to set up the prompt to give instructions for our agent what to do and how to behave.
Now under prompt click drop down, select define below and what you can do.
You can just drag the message we received from telegram and drop it over here.
So this is our message we sent on telegram.
Now under options add a new option and select System Message.
Switch to expression Then expand the view.
So the simplest way to structure the prompt is to assign the role objective and provide additional information.
So I'm just going to paste the prompt.
So it can be as simple as you are a professional assistant.
Your primary goal is to manage contacts, email and calendar events and perform research tasks for the
user.
And now additional information.
So you have access to three sub agents to help you.
Email agent, calendar agent, and research agent.
So I will provide you with a template so you can just copy and paste it.
So make sure to do this before using your team of agents, as I have added some comments to avoid errors
because an optimized prompt is crucial for building effective agents.
All right.
So let's test our agent again.
Click this workflow and send a simple message on telegram.
Great.
So this time we successfully received a response.
When you open this now again you can see the output is.
Hello.
How can I assist you today?
Just need to send this message back to telegram.
So back in the canvas add a new note and search for telegram.
Scroll through the options and select.
Send a text message.
Which is right here.
Next, choose the credentials.
Next, choose the credentials you set up earlier.
Then we have to grab the chat ID from the telegram trigger.
Just expand it.
And drag and drop it over here to chat.
To chat ID field.
Now for the text field we need to assign the A agents output.
So drag and drop output over here.
So let's run a test and have a look.
Yes.
That's great.
So we just received a message from our agent.
But we got some extra text, which is redundant.
So let's fix it.
Click on add field.
Append an item attribution.
And switch it off.
Let's back to our canvas.
And now we can explore how to handle audio messages.
First, run a test workflow.
Switch to telegram.
And we'll press and hold the record button.
Say something and then release to send it.
Now back in our workflow, we got an error.
And when we check the trigger note and the schema and scroll down.
It looks different this time because instead of text, we now have a voice note that contains a file
ID.
This means we need to handle messages differently based on their type.
So to do this, we will insert a switch node between the diagram trigger node and the agent node.
So go back to canvas.
Let's close this error message.
Zoom out a bit and let's search for each node.
Now let's remove this connection.
And move it over here.
So the switch node allows us to create separate processing paths.
Connect the telegram signal to the switch node.
Let's open the switch node and for the first condition, we will check if the message contains a file
ID inside the voice object.
So scroll down.
Let's find our file within the voice object.
Grab it and drop over here.
We assign this to the value field, then select string and exist.
It simply means if a voice file id is detected, we route the workflow through the audio processing
path.
So to keep it organized, let's just rename it to audio.
And let's close it.
And now we can see the audio label.
Since we also need to handle text messages let's make that adjustment.
So I'm going to run test Workflow again.
And send the basic text message.
And now when we open the switch node.
It appears red because the expected field is not present.
So instead we have a text property from the telegram trigger.
So to fix this we have to add a new route.
So add a new routing rule.
Use text field as the value.
Again string Exist.
And let's rename it to text.
Let's close it.
And now our switch node has two different routes.
One for audio and one for text.
So via text message comes in it will be directed to the agent for processing.
When we connect these two nodes.
But if we receive an audio message we need to handle it differently.
So first let's add a new node and send another audio file into the flow.
And now we can see the audio message.
Trigger the audio route.
Let's go back to our canvas.
And now we have to download our voice message.
So again click on Add node.
Search for telegram.
Select the get file.
Now pass the file ID from the voice object into this field.
And let's test this node.
Here the file is successfully downloaded.
I will rename this node to.
Node file.
Confirm it.
And hit save.
The next step is to transcribe the audio to text.
So click add node.
Search for OpenAI.
Scroll down.
Transcribe a recording.
This is the action we want to achieve.
We don't need to change anything in this note.
So run a test.
Great.
Now that we have the transcribed text, we need to make sure our agent processes it correctly.
Now let's make it more organized.
I'm going to move it here.
And we can connect the transcribed text to our AI agent.
Now when we open the supervisor AI agent node there is a small issue we need to fix, because when we
receive a text message from telegram, it comes inside an object called message, which contains a text
field.
However, when we got a transcription from an audio message.
So let's expand it.
The text is stored directly in the field called text without being wrapped in in a message object.
Now when we open the supervisory agent node, there is a small issue we need to fix.
Because when we receive a standard text message from telegram, it comes inside an object called message,
which contains a text field.
However, when we got a transcription from an audio message.
So let's expand it.
The text is stored directly in a field called text without being wrapped in a message object.
We can quickly fix it and simplify the text format before sending it to the agent.
So go back to canvas.
Now we have to add a set node right after the switch node.
So click on this small plus button.
Search for set node.
Click Add field and name it text.
Let's scroll down.
Let's grab text and assign it to the value called text.
Now let's go back to our canvas.
And if the text comes from telegram, it will extract text from the message object.
And if it comes from the transcription it will use the text directly.
So let's connect this node to our agent.
And our agent will always receive a standardized text field no matter where the input comes from.
So I will rename this node to set text.
Film.
Now, if we send a voice message, we might want the agent to reply with the voice too, not just text.
So what we can do is add a new node between our agent and the telegram response node.
So just by clicking on this plus button let's search for if node.
What we will do here is add an if condition.
So what we want to say is let's go to our telegram trigger node.
And we want to check if the voice ID exists.
So let's grab this file ID.
And drop over here.
If you can see this voice object that's mean you need to add some data to to the flow.
So just simply test a workflow and send a voice message on telegram.
So now you want to click on drop down select string and exist.
So basically now we have two branches true and false.
So if true we want to respond with audio.
So we have to remove this connection.
And if First, we will simply return text.
So you have to connect these two nodes.
And now we want to generate audio instead.
So let's click on Add nodes.
Search for open AI.
Go to Audio Actions and generate audio.
Select your credentials.
And here you can select a voice.
So I go with echo.
And you can leave this node as it is.
So now you have a setup.
And the two conditions if the file ID exists.
So the condition is true.
Generate an audio if doesn't exist.
Return a text message.
Now let's rename this node to generate audio.
Let's test our workflow.
I'm just gonna say a short voice message on telegram.
Hi.
How are you doing?
So we should Just get a response in a second.
Yes.
You got an error?
Which is?
Which was expected.
Let's open this node.
Now we got some data in the flow so we can.
Expand our supervisor agent node and grab this output property.
And drop it here.
Let's test our workflow again.
Just before that I've got a great trick for you in every trigger node.
Doesn't matter if it's a telegram, WhatsApp or any other platform, there is an option to pin data.
So there is a pin icon in the top right corner.
So when you click on it, you'll pin data within your workflow and you can simply unpin it.
So it means that the message, voice message or text message you send area will be saved in this node,
so you don't need to send it over and over again.
Now you just need to click on Test Workflow and it will use the previous message.
Great.
So now we generated the ice voice response.
So we need to send it back to telegram.
So add the telegram node.
Scroll down.
And.
We are looking for.
Send an audio file.
Which is right here.
Now switch to the schema.
And we need to select the chat ID from the telegram trigger node.
So expand it.
Grab this chat ID.
And move over here.
Also we need to.
Enable binary file so it knows to send the audio instead of text okay that's it.
And now let's test it out.
I'm just gonna click on Test Workflow.
Great.
I just received an audio file.
Let's listen to it.
I'm here and ready to assist you.
How can I help you today?
All right.
Great.
Now let's check if our agent will respond to a text message properly.
So I'm just gonna unpin data.
Test workflow.
And send short text message on telegram.
I'm just gonna say hi.
Can you assist me, please?
Great.
Now we have received a text respond back to this branch.
So let's have a look.
Absolutely.
How can I assist you today?
Please let me know what you need help with.
Alright, great.
Now what I like to do, I like to summarize the message before generating the voice.
So this makes the voice message more to the point and also reduces token cost.
And obviously we don't want to listen to long messages.
So what we are going to do now is we are going to grab an open AI message model.
So let's search for open AI.
Just bit between the teeth and generate audio notes.
So let's click on this plus button.
Search for open AI.
And under Text actions select Message Model.
Connect your credentials and select the large language model you want to use.
So I want to use GPT for me.
Now you want to get some data into this node.
So I'm just gonna say test the workflow.
Send a short voice message on telegram.
Hi.
Can you help me, please?
All right.
So now we want to give it give a prompt to our model.
So let's.
Ask it to summarize.
The message.
So I'm going to provide you with the prompt.
So I'm going to copy and paste it now.
There we go.
I want this model to summarize this incoming information.
So the message from the previous node.
So I'm going to expand it to show you how it looks like.
So summarize this incoming information which is in this format is basically our previous message for
the calendar events provides only the name of the event and time for or you may provide the title of
the email and summary of the body.
No time and output, only plain text.
There should be no markdown formatting or any symbols.
So let's close it.
We want the summary in plain text, so we'll make sure there are no symbols or special characters because
the AI generated voice will read everything.
That's it.
Let's test it out.
It's going to ping data again and test the workflow.
Let's listen to the response.
Of course.
I'm here to help.
Please let me know what you need assistance with.
Perfect.
So now your agent responds with voice two.
And if the voice is too long, it will be summarized before sending back to you.
What if you want a different voice because you don't like any of the OpenAI's options?
So there is a solution for that.
Also, if you want to clone your own voice or someone else's voice, you can use voices from 11 labs,
which is the best AI voice generation platform.
So this is optional, but I'm going to show you how to set this up.
All right.
So now that we have our summarized text, we are going to send it to 11 labs to generate the actual
voice file instead of sending it to OpenAI voice models.
So let's remove this connection and this one too.
We want to feed this summarized text into post requests, and we'll generate audio file using a voice
from platform.
We need to set up the HTTP request in order to use a Post request to send our text to 11 labs.
So let's search for http request node.
Now we need to change the method from get to post.
And we need the URL as some headers and JSON body.
Now go to 11 labs.
You can find a link in the description.
Sign up.
Create an account.
Now when I was testing this, I ran into some credential errors on the free plan, so I recommend you
to upgrade to the starter plan for $5 a month, which gives you 40,000 credits.
That should last quite a while unless you are generating really long voice files in 11 laps.
Go to the text to speech section.
So create speech and now you can copy and paste values from this code snippet.
So first we need this URL.
So let's copy it.
Go back to 2010.
And paste it right here.
Right now we need some headers.
So enable send headers.
Go back to the platform.
Copy this one of the two headers.
Go back to N810.
Pass it as a first name.
Now as a value, we need to generate our API keys.
In your account.
Go to settings API keys.
Create API key.
Give it a name.
Create.
Copy it.
Go back to it again.
And paste it here.
Now we need to add the second parameter.
So add new one.
Go to API documentation.
Copy this line.
So this is our value.
With that all right.
So now we need to send a body.
So basically JSON file.
So enable it.
Hybrid.
Switch to using JSON.
Switch to expression.
Now from the previous node.
Grab this property content and drop over here.
And now we need to convert this JSON file into JSON string and clean it up a bit because it will return
some symbols we don't want in our message.
So I'm going to provide you with a code snippet.
Now I'm going to paste it here.
So as you can see JSON dot Stringify.
So it's going to convert it to JSON string and remove all the special characters.
So it should work now.
Now let's scroll up.
And now in our URL after text to speech forward slash, we can paste the ID of the voice we want to
use.
So let's go back to our Level Labs account.
And in the left menu click on voices.
On this page you can choose the voice you like.
So you can test.
I believe there are over 3000 voices to choose from.
So I'm going to pick this one.
Just trust yourself.
Then you will know how to live.
Now click on view and right here in the right bottom corner you can see an ID.
Just copy the ID go back to n810.
And after the text to speech forward slash paste this ID.
Now in the telegram response node we need to provide a name of the field.
So under additional fields click on Add field.
Select File Name and give it a name data dot.
And it needs to be this format this file extension.
To copy and paste it.
Now let's close it.
Hit save.
I'm going to unpin data in the telegram trigger node.
So simply unpin.
Save again.
Now let's test it out.
So I'm going to send a short voice message on telegram.
Hi.
Can you please help me write a viral LinkedIn post?
All right, we got a response.
Let's listen to it.
To help write a viral LinkedIn post, I need one topic or message to convey two personal experiences
or insights to share three.
Target audience for specific call to action.
That sounds good.
That's awesome.
Our agent can already read and listen to our messages and respond with text or audio.
But what makes an agent powerful is its ability to interact with the world.
In other words, connecting with external systems, apps, and data sources.
So this means it can, for example, read and reply to emails, manage calendar, search the web for
real time information Update spreadsheets or databases.
Fashion process.
Customer requests.
So you could implement these functionalities by adding tools.
So simply by clicking on this plus button as N810 has direct integrations with many platforms such as
Google Apps, CRMs, Wikipedia.
Then set up credentials specify in the prompt how to use these tools.
In general, there are over 1000 apps and services you can connect to.
And if there is not a direct integration for what you are looking for, you can always connect via HTTP
requests and API calls in Agentic workflows.
It's not recommended to give your agent too many tools, because the agent may might struggle to decide
which tool to use.
More tools mean more chances for conflicts and failures.
Managing multiple tools in a single agent can slow down responses.
So instead, it's better to build separate subagents, each responsible for a specific task.
Like in this setup, we will create email agent handles, emails and responses.
Calendar agent manages our calendar.
And research agent does research for us.
So this is a basic example.
But what if you wanted your supervisor agent to do more tasks such as managing social media, Making
calls on your behalf or nurturing leads, you would need a swarm of agents, which, by the way.
Can have their own subagents and tools.
And this is what we call a multi-agent system.
Think of it like a multi-layered organization.
So at the top you have an executive agent overseeing everything.
Below that, directors to handle major responsibilities.
And each director has a manager a agent.
Who coordinates tasks.
They have supervisors.
And finally employs agents to execute specific actions.
And each employee has access to tools.
Rules.
So instead of overloading one agent with too many tools, the best practice is to build a network of
specialized agents that communicate and work together.
Each agent focuses on a specific task, making the system more efficient, scalable, and reliable.
By the way, I'm currently working on a system with over 20 agents in N810, so stay tuned.
Now, the only tool you want to add in this setup is a contact database.
So our agent can access email addresses, phone numbers, calendar events, etc. for example, I've
got a spreadsheet with one person's contact details.
For this demo, for simplicity, we'll use Google Sheets, but you could also use CRM like Airtable
for structured data, or pinecone, a vector database for large contact repositories.
So click on add tool.
Search for Google Sheets.
Select Google Sheets tool.
Now you need to connect your Google account.
Once you set up your credentials and connect it to Google account.
Let's move on.
We don't need to change anything within this field.
As a resource, we want to retrieve sheet within document as operation.
Let's leave controls.
Patrols.
And now we can choose.
Specific document we want to retrieve from our Google Sheets.
So from the list let's choose.
And now we can choose the specific sheets.
Leave it as it is.
Let's close it.
And now let's hit save.
And let's test our workflow.
Retrieve the email address of Mark Johnson.
So I'm going to send a voice message.
So we should receive a voice message from our agent.
Let's listen to it.
I found a contact named Mark Johnson with the email Nate at gmail.com, but I couldn't locate specific
information for Marques Johnson.
Let me know if you need help with anything else.
All right.
Great.
Now our agent is able to pull rows of contact information from this sheet.
So to keep things organized, I will rename this tool to Contact Database.
The foundation is now set up.
So let's continue by adding the Subagents.
So now we have to create a completely new workflow and make calls.
So let's open a new tab and go back to The N810.
Home screen.
Make sure to save it.
Click that workflow.
And name it to Email Agent.
Press enter.
So this will act as a dedicated sub agent to handle email related tasks.
So add a trigger node.
Set to when called by another workflow.
This means our personal assistant will call this agent when we ask.
For example, can you send an email or can you check my emails?
Let's close it.
Now.
Add an agent node.
We don't need this trigger, so let's remove it.
Let's add a chat model.
I'm going to use OpenAI GPT four mini.
So no memory is needed for this agent.
Now we need to add tools.
Perfect.
Now we need to add tools to our email agent.
So each tool represents a specific task we want our agent to handle.
So in this example we want it to perform two main actions right.
And send emails and fetch emails from your inbox.
So let's search for Gmail.
In Gmail we have a ton of different actions we can take.
We are going to keep this agent simple, but very useful for functionalities.
So what you can what it can do.
So sending and receiving emails.
Let's rename this tool to send email to make it clear what it does.
I want this tool to set automatically as a resource.
We want to have a message.
We want to send an email, but we need to configure these fields.
Now after I recorded the original version of this tutorial, the Na ten team released this super helpful
feature so you can now use AI to fill in these fields automatically for you.
So first I'm going to show you the simplest way to complete these fields.
So using this new feature.
So just click this little purple I button next to the input.
and the model will intelligently figure out things like the recipient's email address, the subject,
and the message content based on your email context.
So it's really cool.
And it it interprets the user's intent and maps the details directly into the right fields.
So it makes your Gmail node setup way faster.
So let's do it now.
So as you can see we can let the model define the parameter.
So let's click on that.
The same for the subject and for the message.
And the second option is to set up it manually.
So I will show you the manual way how to configure this node using the from OpenAI expression.
So that's useful.
Um, if for some reason the default AI option doesn't work for your case.
Or if you want more control and want to understand how it works behind the scenes.
But both of these methods works not just for Gmail, but for every node you use as a tool for your agents
like sending emails, retrieving inbox content, managing calendars, and so on.
So you can stick with the quick helper or go deeper with full manual setup, and both options are available.
So now let's move on to the second method.
So we are going to use this cool expression.
So we will use the from I function.
This helps the AI extract details from a user's request and map them into fields automatically.
So it's really cool.
So basically this expression helps LLM Alarm interpret an incoming query.
So I'm planning to make a separate tutorial on explaining this in detail, because this is the best
way to give you give you agents tools in any ten.
For now, let's keep it simple.
So let's copy this expression including curly braces.
And paste it to this field.
Then in the field switch over to expression.
Now we need to change the placeholder.
So name it email address.
You can also add a description but it's optional.
So it helps glide the LLM in figuring out how to retrieve the information and in what format.
So you can add comma.
And say something like.
The recipient's.
Email address.
We do the same thing with other fields.
Now the next field.
So our subject.
Let's do the same thing.
Don't forget to switch over to expression.
Also we need to change the image type to text.
And for message expression.
Let's say email body.
Also we need to add option append and end distribution.
Turn it off.
And add sender name.
This just tells Gmail who the email is from.
But it won't.
It won't actually sign off the message.
We need to do it in our prompt.
So I will put my name here since it's my personal assistant.
I will show you in a bit.
Now we can test our workflow.
So let's see if the agent can send an email like it's supposed to.
So since our supervisor agent will be the one calling, this agent will create a sample request to simulate
that.
So in the execute workflow trigger.
Um.
We need to we need to give a query to our agent.
So when task two send an email.
So for example I might say can you send email to Damon at n810 demos Gmail.com to check how he is doing.
Now let's save it in your data.
Save it.
And let's test the workflow.
There is no problem specified.
So now let's fix it.
Oh yeah.
You have to define below.
We don't want to take data from the previous node automatically.
We want to define it below.
We just simply grab this query and drop it here.
Save.
And let's test it again.
Now let's check my inbox.
Great.
So I hope this message finds you well.
Perfect.
So now our agent is able to send messages.
Just a quick tip to get an authorization error.
Our Gmail credentials might have expired.
So just refresh the connection and try again.
So the credentials seem to expire every few days, meaning you just have to sign in again.
But if you publish your app, you should be good to go without having to refresh it all the time.
Now, after successful execution, when you check this tool, you can see the actual message.
So the email I got and the email subject and email address.
Going back to the email I got, the LM grabbed the recipient, which was Damien, but since we didn't
specify a sender name, it signed off as your name by default.
If you actually if you actually want it to sign off properly, you need to prompt the supervisor agent.
So a quick way to do this is just by is just by going to the supervisor agent in the system message.
You can say something like when sending emails through Gmail, always sign off with Damian and never
use placeholders, so this makes sure every email has the correct sign off.
Great.
So our agent knows how to send emails.
Now we need to add another tool to fetch emails from our inbox.
So let's go back to our email agent.
Now we want our agent to retrieve emails from our inbox.
So you can simply use the same tool as before.
But now you have to configure it differently.
So you can really expand on this agent and give it tons of different actions like.
Adding labels.
Deleting messages.
Marking emails as unread.
You could essentially build a tool for all these functions.
So for now, let's just focus on receiving emails.
So we need to select get money.
So first we need to.
Set a limit on how many emails we are pulling in.
So for now let's say five.
We also need to define some filters.
Like who the emails are coming from.
So we'll set the sender field.
As you can see there are multiple ways to filter by date by status, etc. for example, if you only
wanted to get emails from the past five days, you could configure it by setting received after and
received before filters.
For now, let's keep it simple and use just send the filter.
You can also use from I expression to set a limit and specify the sender.
So let's use from I and as our sender.
So I'm just gonna copy and paste this expression again.
And paste it right here.
As a placeholder you can enter.
Send the email.
And for the limit you have to switch over to expression.
And paste it right here.
We can say something like.
Limit.
Great.
And now, one important thing.
We don't want to simplify the results.
If this setting is on.
It returns a simplified version of the email data instead of the full content.
So in some cases that might that might be fine.
But if you are dealing with long emails and want all the details, you would want to turn this off.
All right.
So now at this point this email agent can send and retrieve emails.
So what we want to do here is we want this email agent to respond back to our supervisor agent.
So we need to add another node.
Set node and simply just name it as a response.
And grab this output.
And put here in this field as the value.
Our email agent is ready to go.
Just need to unpin data and we can connect it to our supervisor agent.
So let's go back to our main workflow.
Now back in our main workflow we are going to add a new tool.
And for this we'll choose call another workflow node.
So simply click on Add Tool button.
We need to choose this option because we want to trigger a different workflow.
So our email agent.
We will name this one Email agent.
Now, as a description, we can say something like.
Call this tool to take action in email.
Now we need to configure this node.
And set up which workflow this tool should connect to.
So you can select the workflow either from a list or by ID, but picking from the list is the easiest.
If you can see the workflow which consists your email agent, just simply save and refresh.
So we called our email agent workflow email agent.
So let's search for it.
Now.
Fit to return.
This is where we previously set up the response field.
So when the supervisor agent sends a request to the email, agent is going to look for a field named
response.
That's why in the email agent workflow I'm going to show you.
That's why in this agent we added a set node named the field response and assign it to the actual email
image data.
So the supervisor agent knows exactly where to look for the response.
Now we are going to create our calendar sub agent and I will move a bit quicker with this, since the
process is pretty much the same as what we did with the email agent.
So the first thing we need to do, we have to create a completely new workflow.
So let's go back to the home page.
So let's trigger this workflow when called by another workflow.
So when called by another workflow.
We'll add the agent.
So let's search for a agent.
Now as the chat model.
So our agents brain since GPT four mini worked well for the email agent, we will stick with it again.
We can remove this one.
Chat message received trigger note.
Add chat model.
Select chat model.
We don't need memory for this agent so we will leave that off.
Now we can start adding the tools.
This is our calendar agent.
So we want to create and get events from our calendar right.
So search for Google Calendar.
So other counties already connected.
So we are good to go.
If you are using the cloud service, you might not need to enter the client ID and secret to set up
credentials.
But for the rest of us, we already done the hard part.
So the first tool we are going to add is to create an event.
So let's rename it.
Will connect it to our calendar.
And now we just need to configure a few details.
The leaf resource as an event we want to create an email.
Select your email address from the list.
Now we have to specify the start, start time and end time and any additional properties like attendees.
We will also add a summary, which is basically the event's title.
So the text that shows up on the calendar.
So let's do it one by one.
We will pull the start time using from AI expression once again to let the large language model to do
it automatically.
So copy this from AI expression from curly braces all the way to the closing curly braces.
Remember to switch to the expression.
And paste it right here.
Change the placeholder name to start time.
You can add the description if you want.
So it's the time.
The user asked for the event.
To start.
Great.
Now we have to do exactly the same thing for the end time.
So let's just copy and paste it.
Now let's change the placeholder name to End time.
And the description.
That's great.
Now we have to add summary.
For the summary.
We will also pull that from I expression.
So let's copy it.
And just change the placeholder and the description.
So let's say simply name.
And it's the name of the calendar event.
Great.
Next we will add a sample query in the Execute workflow trigger node so we can play around with the
data.
Let's say we ask the calendar agent to set up an event at 3:00 pm for a meeting.
So here we have to provide the prompt.
Set up and event.
At 3 p.m..
Meeting.
Great.
Now let's save it.
The data is pinned.
In this case, we are just blocking out time in our supervisor agent.
But since we didn't specify an end time in the query.
So how long is the meeting for?
Later, we modified the agents prompt to assume the event lasts for 30 minutes or an hour.
After the start time of the meeting in our supervisor agents prompt.
Now let's save the workflow.
And test it.
Yes, we got an error because we didn't specify the prompt, so let's do it now.
So define below.
And simply drag and drop the query property.
Now we will update the agent's prompt to include the current date and time so it knows when to create
events.
Because while these agents are pretty good at figuring out which tools to call, adding system prompts
like this can make a big difference, especially depending on the model you are using.
So let's do it now.
Click on add option, Add system message and we'll keep the prompt short and to the point since it's
just a calendar agent.
You are a calendar assistant with access to various tools to manage Calendar tasks.
The current date and time is.
I forgot to switch over to the expression mode, so thanks to this, agent is able to figure out what
the current date and time is.
So create event.
Create event with attendee and also get events.
Okay now let's test it.
Hit save.
And this workflow.
Great.
Now let's look at the execution.
As you can see, it's working perfectly fine.
Now let's add another tool to create events with attendees.
We are doing this in a separate tool because adding attendees requires extra configuration.
We need to add additional fields.
If we left it all in one tool, it could cause issues.
If there is no attendee.
It might return an error when trying to create the event.
So let's make it easy.
So we need just to copy our create Eight.
Events.
Note.
And paste it here.
Let's rename it to.
Event with attendee.
So everything is exactly the same.
We just need to specify attendee.
So scroll down.
Add filled attendees.
Let's use our awesome expression.
So the placeholder is attendee email and the description is the email of the user asks the event to
be scheduled with.
Now that we've got event creation working.
Let's add one more tool to get events from the calendar.
So this will allow the agent to retrieve events based on specific dates.
Let's just actually let's rename this agent to Calendar agent.
And also our workflow to.
Calendar agent.
And hit save.
And this node to create event.
Let's search for Google Calendar again.
This time we want to retrieve emails from our inbox.
So change operation to get money.
Select your email address.
We want all the emails to be returned.
So enable this.
We want to get events from one day before the requested date.
So at option select after.
Which the expression we will use from I expression again.
As a placeholder we have start date and as the description the day before the requested date.
We have to do the same for before field.
But this time we want to get events up to one day after the requested date.
So switch over to expression mode.
And date as a placeholder and as a description the day after the requested date.
This helps us retrieve events dynamically based on the user's input, instead of just pulling events
from a fixed date like today.
Finally, we need to ensure that the calendar agent sends responses back to the supervisor agent.
Let's rename it to get events.
We will add a set node as in the previous example in the email agent to search for set node.
We need to add a response field.
So the name is response again.
Grab the output.
Drop over here.
Great job.
Now let's connect this calendar agent to our supervisor agent.
So hit save.
Adding a tool.
Select called Workflow tool.
Rename it to Calendar agent.
We need to provide a description.
So They still.
Manage the calendar.
Great stuff.
Now we are going to connect the calendar agent workflow we just created.
We have to refresh this workflow.
Because we didn't refresh it since we have created our calendar agent.
So hit save.
Now our calendar agent appears in the list.
So select it.
And the response field will handle sending data back to the supervisor agent.
Great.
Let's save it.
Great.
Now we are setting up a research agent that can answer questions by searching the internet, checking
articles, and using sources like Wikipedia and set API.
It's a lot easier to set up this agent than the email and calendar agents, but still very useful.
So the goal here is to show you how you can assign different tools to your agents, making them more
flexible and reusable across multiple workflows.
So it's exactly the same process we need to create completely new workflow.
So let's go back to our home page at First Step.
So we want to trigger this workflow when it's called by another workflow.
Other agents.
Remove the trigger.
Large language model as a chat model.
To do the same.
GPT four mini.
We don't need a memory.
Then we will add tools starting with Wikipedia.
So add tool.
Search for Wikipedia.
Let's add the prompt to our agent.
So adoption system message.
The system message I have prepared is you are a research assistant with access to Wikipedia and serve
API.
First search for search Wikipedia and if you don't find the answer, use search API.
So this setup is efficient because it uses resources first and only calls setup API when needed.
Saving API credits.
Setup API offers a free plan that includes 100 searches per month.
So basically you can use this research agent 100 times per month in order to connect API ad to search
for Serp API.
Now we have to connect credentials.
So go to servicom.
Create an account.
Go to API key.
Create your API key.
Copy it and paste it into an A-10.
So we need to create new credential.
And paste it right here.
Then click save.
And it should show as successful.
Then save workflow.
All right.
Now let's connect this agent to our supervisor.
Agent.
First let's rename it to.
Research agent.
And also our subagent to make it clear.
Great.
Save it.
Let's go back to our main workflow.
Let's move this tool down.
Adding a tool.
Call a workflow tool.
Rename it to please search agent.
I will call this tool to search the internet and answer the user's questions.
So simply call tool.
To search the internet.
And answer.
Their users questions.
Just select the research agent from the list.
And that's it.
Hit save.
Congratulations.
You just built your team of AI agents and you have learned how to create subagents like the email agent,
calendar agent, and the research agent all working together under the supervision of the main supervisor
agent.
You can easily add more sub agents to handle new tasks, and if you want your agents to remember things
over time, you can connect a vector database to give them persistent memory.
So great job!