WEBVTT

00:00.080 --> 00:00.440
Okay.

00:00.480 --> 00:04.000
That was the first of our two agents and the bigger of the two for sure.

00:04.160 --> 00:06.160
And very satisfying, I have to say.

00:06.560 --> 00:08.360
And now for the second one.

00:08.400 --> 00:11.200
The second one, the first one was the outbound sales.

00:11.200 --> 00:14.200
The second one is the account executive.

00:14.360 --> 00:17.000
The person that takes inbound calls.

00:17.240 --> 00:23.320
The account executive agent is going to have just two subagents, one of them that is able to record

00:23.320 --> 00:27.520
that a deal is in progress and the other is able to book a demo.

00:27.680 --> 00:33.760
These are the two activities that will be carried out by Subagents under the watchful eye of the account

00:33.760 --> 00:34.480
executive.

00:34.520 --> 00:35.920
Let's go and build them.

00:35.920 --> 00:36.240
Okay.

00:36.280 --> 00:38.280
Here we are in our amplify project.

00:38.280 --> 00:43.720
I'm now going to go and create a new folder and I'm going to call it Account Executive.

00:44.760 --> 00:45.440
There we go.

00:45.560 --> 00:49.760
So we now have our business development and our account executive folder.

00:49.760 --> 00:51.560
Nothing in there just yet.

00:51.680 --> 00:55.440
Let's go in and create our first workflow.

00:55.560 --> 01:02.160
And our first workflow which is going to be called the deal according Subagent.

01:03.840 --> 01:04.720
Okay.

01:05.120 --> 01:07.400
What is this deal recording subject going to do?

01:07.400 --> 01:08.440
Well, let's begin with it.

01:08.480 --> 01:12.800
Having a trigger of a chat message, uh, which we will change later.

01:12.800 --> 01:17.320
And it's going to, as usual, go straight in to an AI agent.

01:17.480 --> 01:18.440
There it is.

01:18.720 --> 01:19.160
Okay.

01:19.200 --> 01:20.480
What are we going to do with this agent?

01:20.480 --> 01:24.720
Well, I'm going to start by having it use the usual OpenAI chat model.

01:24.720 --> 01:26.240
You may pick your own.

01:26.560 --> 01:32.840
I'm again going to go with my favorite GPT 5.2, which will give me nice and strong model.

01:32.840 --> 01:33.840
There it is.

01:33.880 --> 01:39.880
And but I am going to tell it just to have the low reasoning effort, uh, just so that it's nice and

01:39.880 --> 01:42.160
quick and doesn't take too much.

01:42.480 --> 01:43.440
There we have it.

01:43.600 --> 01:48.240
Uh, we, uh, we we won't need memory because we'll just be giving it one instruction at a time.

01:48.520 --> 01:52.240
And now it's time for us to look at the tools.

01:52.240 --> 01:53.680
So what's this agent going to do?

01:53.840 --> 01:59.600
It's going to be informed that some customer is interested in having a demo, which means that it's

01:59.600 --> 02:07.720
time to record that this customer is potentially in a deal flow in our CRM in Pipedrive, you say that

02:07.720 --> 02:08.480
you've got a deal.

02:08.480 --> 02:12.120
And in something like Pipedrive, not necessarily because you've yet won the business, but because

02:12.120 --> 02:16.840
there's somewhere in the deal pipeline that hopefully will close and become a deal in the future.

02:17.160 --> 02:21.440
So that's what we want to do, which means that really, this AI agent needs to have the ability to

02:21.480 --> 02:26.560
read from Pipedrive, to find out the people who've got in Pipedrive to identify a person and then to

02:26.560 --> 02:28.600
be able to create deals.

02:28.880 --> 02:29.920
Now, here's the thing.

02:29.920 --> 02:33.360
I'm actually going to use tools and structured outputs.

02:33.360 --> 02:38.320
In this case, I'm going to use a tool to read all of the people, but I'm going to use structured outputs

02:38.320 --> 02:43.440
to write the new information so that we can be crisp and and bulletproof about it.

02:43.440 --> 02:45.960
And that seems like a good balance to me.

02:46.000 --> 02:48.480
Now, of course, you might say, how did I come up with that?

02:48.480 --> 02:51.920
And the answer is you should experiment and you should see what works best.

02:51.920 --> 02:54.520
I know you know this saying, shut up and get on with it.

02:54.760 --> 02:55.400
All right.

02:55.440 --> 03:00.160
So we're going to add a tool which is going to be a Pipedrive tool, which is going to be the tool to

03:00.200 --> 03:01.560
get people.

03:01.560 --> 03:06.000
We're going to want to have a resource will be a person.

03:06.240 --> 03:09.200
And I'm going to make this to be get many.

03:09.600 --> 03:14.970
And as I say, if you were building this to be something that's ready for prime time, you'd want to

03:14.970 --> 03:19.850
put in filters here and have the model be able to filter on the people it's looking for, but I'm just

03:19.850 --> 03:23.090
going to have it return all for for this so that we don't get bogged down.

03:23.090 --> 03:26.450
And that's going to be fine up until a reasonably large number.

03:26.570 --> 03:28.410
Uh, so that's how it's going to work.

03:28.410 --> 03:33.930
It's going to get all of the people, and that should work just fine for this.

03:34.210 --> 03:38.610
And now we want the agent to output structured outputs okay.

03:38.650 --> 03:40.610
So I open up the AI agent.

03:40.610 --> 03:41.690
Here it is.

03:42.010 --> 03:47.050
I am going to first give it a system prompt so we know what it's going to do.

03:47.330 --> 03:48.650
Here we go I'll paste one in.

03:48.690 --> 03:52.570
You're provided with a potential name of a person in the Pipedrive database.

03:52.570 --> 03:55.650
You use your tools to see whether that person is already in the database.

03:55.650 --> 03:58.490
If there are duplicates, you pick one reply with the details.

03:58.490 --> 04:02.370
You find a deal will be created in Pipedrive as a result.

04:02.650 --> 04:03.450
That's super clear.

04:03.450 --> 04:06.890
So now we need to require a specific output format.

04:07.130 --> 04:08.370
Let's go back.

04:08.370 --> 04:14.970
Now we've got this here and we're going to say structured output parser and define the output we want.

04:15.010 --> 04:15.850
And here we go.

04:15.890 --> 04:20.050
I'm going to have it be a JSON object with four fields found.

04:20.050 --> 04:25.730
Whether or not the person was found in the people, the id the person ID goes there, the company,

04:25.730 --> 04:29.810
the company name goes there, the name, the person's name goes there.

04:29.970 --> 04:32.010
Very simple, very clear.

04:32.250 --> 04:34.610
That is going to be our structured output.

04:34.610 --> 04:39.730
And then based on that output we can then create the records in Pipedrive.

04:39.770 --> 04:40.250
Okay.

04:40.290 --> 04:43.690
So from what comes out of here let's put in an if node.

04:44.570 --> 04:47.970
If node, because we know that that this is going to come up with an output.

04:48.130 --> 04:50.250
Uh, let's make this an expression.

04:50.810 --> 04:58.250
And we know that what comes out of the previous cell dollar JSON output dot.

04:58.370 --> 05:01.410
And then one of the fields is called found.

05:01.610 --> 05:04.370
And if that's true then we have found a record.

05:04.370 --> 05:05.810
If it's false we have not.

05:06.250 --> 05:10.330
So now to not make the mistake I made before we go Boolean is true.

05:10.570 --> 05:11.490
There we have it.

05:11.530 --> 05:14.090
JSON output is true.

05:14.450 --> 05:15.770
That's the Tesla we want to make.

05:15.810 --> 05:17.730
We are either going to go true or false.

05:17.890 --> 05:24.330
If we go to true, then what we want to do is we want to carry out a Pipedrive node, a node action.

05:24.330 --> 05:26.850
We want to be to create a deal.

05:27.130 --> 05:28.450
Create a deal.

05:28.810 --> 05:29.690
All right.

05:29.690 --> 05:32.930
So what's the deal title going to be.

05:33.290 --> 05:41.370
Well, we'll have the deal title be this Jason name which is the name thing coming from from the the

05:41.370 --> 05:44.010
AI agent followed by the word deal.

05:44.170 --> 05:48.330
So if the person's name is John Smith, it will say John Smith deal.

05:48.330 --> 05:50.730
That will be the expression we'll use there.

05:51.090 --> 05:53.090
Uh, and we can associate it with something.

05:53.090 --> 05:54.130
Let's associate it.

05:54.170 --> 05:58.570
We choose between either associating a deal with an organization or with a person.

05:58.570 --> 06:00.330
Let's associate it with a person.

06:00.330 --> 06:02.330
We have to provide a person ID.

06:02.610 --> 06:03.850
Well, we have one of them.

06:03.970 --> 06:08.890
An expression uh, the expression should be dollar JSON

06:10.130 --> 06:12.970
output.id.

06:13.130 --> 06:18.130
That was the field coming out of our AI agent that is populated with the ID.

06:18.570 --> 06:27.130
So now we have called it John Smith deal, and we've linked it to John Smith's ID, and John Smith is

06:27.130 --> 06:32.930
the person who was found by the AI agent and outputted in the structured outputs.

06:32.930 --> 06:33.730
Right here.

06:33.770 --> 06:35.050
You see found is true.

06:35.090 --> 06:41.250
That's the ID and we've taken, uh, their, uh, their name and put the word deal at the end of it.

06:41.850 --> 06:42.450
Okay.

06:42.730 --> 06:45.330
So this let me tidy it up for you.

06:45.370 --> 06:46.050
There we go.

06:46.330 --> 06:52.090
So this should create a deal for a person if they are in the database.

06:52.650 --> 06:53.690
Time to give it a try.

06:54.050 --> 06:56.410
Just before we give it a try I did some tidying up.

06:56.410 --> 07:02.530
I just added to stickies and then I added a couple of push notifications just so that we we are kept

07:02.530 --> 07:05.730
informed about what's exactly is going on.

07:05.890 --> 07:08.130
Uh, make sure my phone is not on silent.

07:08.290 --> 07:09.010
Uh, okay.

07:09.050 --> 07:13.210
And with that, we can now give it a try and have some, some visual to it.

07:13.210 --> 07:18.050
Okay, so I bring up the chat and what I'm going to say is if we look in Pipedrive, let's look at one

07:18.050 --> 07:19.850
of our leads, Rob Carter.

07:20.130 --> 07:30.780
Uh, let's now come back here again and say, uh, record that Rob Carter has become a deal.

07:31.500 --> 07:32.940
And let's see what happens.

07:33.580 --> 07:35.260
Off it goes to our chat model.

07:35.260 --> 07:37.700
It's reading people from Pipedrive.

07:37.980 --> 07:39.700
It's done something and I got it.

07:39.780 --> 07:40.260
Did you hear that?

07:40.860 --> 07:44.180
I got a push notification and it created a deal.

07:44.380 --> 07:49.580
And if I go back to my leads inbox here, there is a section on deals.

07:49.740 --> 07:55.220
And there we have Rob Carter in there as our deal.

07:55.220 --> 07:57.460
We have our first deal in Pipedrive.

07:57.700 --> 07:59.020
That was pretty easy.

07:59.260 --> 08:00.580
Uh, excellent.

08:00.580 --> 08:01.340
Onwards.

08:01.460 --> 08:02.060
Okay.

08:02.100 --> 08:07.060
So now what we're going to do is turn this into a subagent, remove this chat received and add a new

08:07.060 --> 08:08.140
trigger node.

08:08.420 --> 08:12.460
And in the past we've, we've put in here when executed by another workflow.

08:12.500 --> 08:15.300
I'm going to do it differently this time for reasons that will become clear.

08:15.300 --> 08:18.020
But I'm going to have it be on webhook call.

08:18.020 --> 08:24.260
So the way that you trigger this is by hitting a URL, and we'll hit it with http post as we did before,

08:24.500 --> 08:27.780
which means we get these URLs that you can hit if you want to do it.

08:27.980 --> 08:30.780
Um, and, uh, this all looks fine to me.

08:30.780 --> 08:31.700
I think everything's good.

08:31.700 --> 08:33.460
We'll have this one respond immediately.

08:33.460 --> 08:34.140
We won't make it.

08:34.180 --> 08:35.660
Wait and then respond later.

08:35.660 --> 08:38.140
We'll just have it respond back immediately.

08:38.340 --> 08:40.100
And that's what we will do.

08:40.140 --> 08:43.020
That's going to be connected in here and in here.

08:43.020 --> 08:44.060
We just have to come in here.

08:44.060 --> 08:45.660
It's no longer expecting this.

08:45.700 --> 08:47.300
It's now needs to be defined.

08:47.300 --> 08:49.260
Below we'll have an expression.

08:49.460 --> 08:52.020
And so an expression needs to be in double curlies.

08:52.060 --> 08:55.820
And you may remember that it's it's got to be dollar Jason.

08:57.060 --> 08:59.020
That's the name of what comes in.

08:59.260 --> 09:06.180
And we'll assume that name that will be populated with name, which is going to be the name of the person

09:06.180 --> 09:08.060
in the in the Pipedrive database.

09:08.500 --> 09:11.260
So that is, uh, is what we're after.

09:11.260 --> 09:17.140
And that has now set this up to be a, uh, ready to be called as a webhook.

09:17.380 --> 09:21.620
And what we can now do is save it as already saved and publish it.

09:21.620 --> 09:27.060
And that will now be published out there waiting on its webhook that we can take later.

09:27.460 --> 09:28.260
Excellent.

09:28.500 --> 09:30.700
Now, on to the next Subagent.
