Okay.
Let's see.
Drum roll.
Please bring back up the chat.
Copy this up and do a new chat.
This shouldn't be required because you don't have memory anyway.
But I feel.
I feel a superstitious.
We should have it be clean and fresh.
Send.
Watch the lines.
Watch what happens.
The agent's thinking.
Tick tick tick.
Wow, it was so quick.
Uh, do you think that worked?
I don't know.
Let's, uh, let's go find out.
Let's hop over to Pipedrive.
Let's have a look.
We're going to start by going to contacts over here.
So you'll see I'll just make sure we've got everything.
Looking latest.
Here it is.
We've got here, uh, under uh, people contacts as people.
People has John Smith, who works at IBM.
That's in there, John Smith at Ibm.com.
That looks familiar.
It's in Pipedrive.
There's also organizations click here.
And this has IBM as an organization.
So uh, and with me as the owner.
So we've got that under people and organizations.
That's cool.
And now we just have to go and find out where is Leeds Press?
Leeds.
And here is John Smith one lead and John Smith pops up.
Here are John Smith's details.
Uh, source was the API organization associated with is IBM.
The person is John Smith.
And so the details have all been loaded correctly in Pipedrive.
That all happened in a flash by this pipeline.
And hopefully you've got a good sense of how reliable this is.
Structured outputs basically guaranteed to produce it in this format.
This is just a strict, uh, workflow on rails.
It's just going to do step by step.
And so we can be pretty confident that this is going to work reliably, create the appropriate records
with the right IDs in Pipedrive.
That's a success.
Okay.
Let's save that and go back.
To amplify back into the business development folder, we're going to create another Subagent and this
one is going to be called.
Click here and let's call it the SDR.
Subagent stands for Sales Development Rep.
SDR is like your outbound sales person that goes and tries to nurture and win people over.
That's what we're going to do now.
Okay.
So again we're going to start with a chat message.
On chat message.
Fine.
We're going to have that going into a uh AI agent of course.
So I paused there like it could be something different.
No AI agent, obviously, that's what the course is all about.
Uh, we're not going to have structured outputs.
We're going to use tools this time because we want to give this thing flexibility and autonomy.
That's what it's going to be about.
Uh, and you'll be able to compare and contrast the different approaches for the chat model.
I'm going to stick with open AI, but you may pick your model of choice.
And it's always good to experiment with different models and find out what they are good at, where
they fall behind, where they do better.
I'm going to I'm going to use the the best one right now, and I'm going to stick the reasoning effort
down on low because we don't want it to take a long time.
And so this is what we're going with a nice let's hide this for a second.
And nice setup.
We also don't need memory.
This is just going to take a task and do it.
Um and we're now going to give it two tools okay.
So the first tool that we are going to give it, we're going to actually use the the Pipedrive tool,
the one that we didn't use last time because we use it as a node, not a tool.
It's connected by default to my, my account.
We're going to look at the person records and we're going to have the get many person.
And we're going to have it just return all just have this return all the people.
So look, what I'm about to do now is not like a particularly scalable end solution, because you'd
want to filter, you'd want to bring back a portion of the people, you'd want to do this differently.
So that's part of the assignment for you, is to build this in a way that could be used more productively
at greater scale.
This is going to work fine for now, but you would want to do this in a more organized way and allow
your SDR to be smarter about how it selects the people it wants to work on.
But I'm going to have it draft emails to send to these people to communicate what we have to offer.
Okay, so we're going to have it to get all the people.
We don't need to specify any parameters because it's just going to get the whole lot, get many people,
get all person.
All right.
That's the first tool.
So one thing that might come to mind to you is you may hopefully you've had at the back of your mind
the lethal trifecta.
You've been thinking that we've given this thing access to private data in Pipedrive.
It's potentially getting in things that have been taken from the internet in the form of people's names
and email addresses.
So we don't know where they're coming from.
And they could contain all sorts of bad embedded things in them.
And we're about to do something that's going to communicate externally by sending emails.
And there's a bunch of concerns with that.
One of them is that that would then be the lethal trifecta, for sure.
And secondly, that generally building automated systems that send emails is something which needs to
be taken very carefully.
Indeed.
It is good.
It is completely fine for, uh, a human to send an email, even if that has been drafted.
In fact, it's fine to have it be drafted by machines, but to send out mass emails is something that
is potentially problematic, particularly if people haven't opted in.
And there is, of course, plenty of rules around this, like GDPR in Europe.
But that's not what we're going to do.
We are going to have this agent draft emails and save them in my draft folder for me to review, and
for me to choose to send it out from me, potentially after changing it when I want.
And that is definitely a safer process.
And also, of course, then means that we are not exposing ourselves to the lethal trifecta.
So I am now going to add in the Gmail tool, the tool that we used a long time ago.
Now it feels like it remembers my account details, and I'm going to have the resource be a draft,
and I'm going to want it to create a draft.
I'm going to let the model set the subject.
I'm going to have the email type be an HTML email, and I'm going to let the model define the message.
It's going to be able to create drafts for me.
And that is now defining my second, uh, of my, uh, of of my tools.
And that's the end of the tools.
And you can see that by giving the agent access to this tool, I'm very happy for it to do something
like reading the people decide when and how it wants to call this.
The autonomy is going to be used for good.
It's a good time to use autonomy.
We don't need to put this into a rigorous workflow.
So this is great.
It's time for us to write a system prompt and then give it a whirl.
Okay.
So I'm going to open this up.
I'm going to, uh, change this, actually, rather than a system prompt, this can just be the, the,
um, the user prompt.
We can just say define below.
We can just paste.
I'm going to paste in here the prompt I've written.
It's going to be you are an STR.
Use your tool to read all the person records in the Pipedrive CRM system.
I'm just saying the Pipedrive CRM less is more for each person.
Use your tool to create a draft email from Donna, the CTO of accounting firm account AI.
That's my new job to pitch account AI's innovative accounting software products.
The email should be professionally formatted in HTML.
Explain in the email that if people are interested, they should call blah blah blah blah blah to speak
with our AI agent and schedule a demo.
Okay, so that's going to be our user message.
Save that.
Let's get out of this.
Uh, and of course with this, we don't need this anymore.
We're not using a chat.
So I'm going to take this out as the trigger.
And instead we can have as our as our trigger node.
We can just have trigger manually.
That's fine.
Just, uh, just hook that up like that when clicking Execute Workflow, it will kick this off.
It's time for us to give it a try.
Okay, here we go.
I'm pressing Execute Workflow.
Off it goes.
The agent is running.
It got the people right away.
It's very quick.
Pipedrive.
And now it's thinking.
Now it's thinking.
Still thinking.
It's creating a draft that was done and it's done.
Workflow executed successfully.
All it remains is to go and look in my draft emails.
Okay, well, I've checked my drafts and sure enough, I do have a draft.
Uh, and here it is.
And, uh, it's a nicely formatted, professional looking email to John, and it's all set up here,
and it has the phone number and it mentions it has a nice signature for me with a little if you've reached
the wrong person.
So I think that this shows you the good and actually also the bad of of LMS.
It's it's great that it did it so efficiently and effectively.
But you will notice that it's also invented tons of stuff.
We didn't tell it like detect anomalies and policy exceptions earlier.
And you know that some people might say, look at it hallucinating.
And I would argue, again, AI users can use words like that and can say it's hallucinating.
As far as you or I are concerned, it's not hallucinating.
It's doing its job.
It's an LLM.
It's designed to generate plausible content, and that's precisely what it's doing.
We didn't tell it not to invent something that it didn't, that we didn't tell it.
We just told it to write a sales email.
And this is a realistic sales email.
And so if we don't want it to do that, we have to tell it that and it's up to us to measure it and
correct for that.
So when models don't behave well, don't blame the model.
Blame the AI engineer.
It's your job and my job.
So let's go in and fix that job, and maybe we can try fixing something else while we're at it.
Okay, in here we go.
So let's update this user message.
Let me just expand this down a bit.
Let me update this.
Explain that people should uh, let's say uh, do not include any additional details about about account
AI or the software that you do not know.
Simply state that it is, uh, innovative accounting software that will streamline costs, drive efficiency,
very bland stuff.
Efficiency.
All right, let's give that a shot.
So we've now improved the prompting, uh, and, uh, made sure that we correct for, for for that,
uh, I'm also going to come into this draft.
Did you notice it didn't actually have who the email was addressed to because that's not set by default
in a draft.
I think we can probably force that by coming in here and setting the two email and saying that we want
the model to define who the email goes to as well.
So let's try that.
Let's now go back and give this thing a second run so we will clean everything up.
We will press execute workflow.
Off it goes.
It's running.
It's thinking.
And it's got we got another tick.
It all seems to have run workflow executed successfully will be the judge of that.
Let's go take a look.
Well here we go.
There's the old email again as a reminder.
You remember that that's what it used to be.
Here comes the new email.
There we go.
It's addressed to John Smith at ibm.com.
Exactly the information that we passed in originally.
And it's nice and short and sharp and it only mentions the things we told it.
It didn't make anything up.
It's very clear it still looks professional and crisp.
Now we can properly declare success.
That is our second subagent our SDR.
Built and working onwards.
Okay.
So that wraps up week four, day four.
Part of the capstone project.
We built two subagents the Revops Subagent the SDR Subagent.
They both work nicely indeed.
One of them using structured outputs and workflow, the other of them using tools.
And both of them somewhat independently testable and and confirmable, if that's a word.
And now we can say we're ready to move on to complete that purple box.
The business development manager and then the other agent that I haven't told you about yet.
And so with that, we can tick off day four of week three, meaning that there's only one day left.
The capstone day.
Amplify your business.
That's what's coming.
It's coming tomorrow.
You are now 93% of the way through this program, 93% of your way to being a pro.
I will see you tomorrow.