WEBVTT

00:00.040 --> 00:01.240
Okay, so here we go.

00:01.280 --> 00:02.640
I'm going to get rid of the logs.

00:02.640 --> 00:04.280
I'm going to add a first step.

00:04.440 --> 00:06.120
It's going to be on chat message.

00:06.120 --> 00:07.680
We'll keep it simple to start with.

00:07.720 --> 00:09.800
We'll come back later and juice it up.

00:10.080 --> 00:12.080
Let's add in an AI agent.

00:12.920 --> 00:14.760
It's like the stuff is so old hat to you.

00:14.920 --> 00:17.600
We'll we'll also tidy this up at a later point.

00:17.600 --> 00:19.040
We'll add in a chat model.

00:19.040 --> 00:20.080
I'm going to use OpenAI.

00:20.120 --> 00:21.680
You can use whatever model you like.

00:21.720 --> 00:23.040
We'll use deep seek earlier in the week.

00:23.040 --> 00:24.160
You could stick with that.

00:24.560 --> 00:27.360
I am going to pick like a top frontier model.

00:27.360 --> 00:30.800
I'm going to pick GPT 5.2.

00:31.160 --> 00:36.640
Uh, and uh, that's that's definitely the one that, that I'd like to, to pick for here.

00:36.920 --> 00:41.680
Um, but you can, you can feel free to, uh, to use whichever one you want to use this.

00:41.680 --> 00:46.480
This should be very cheap, but obviously a mini would be, would be even even cheaper fractions of

00:46.480 --> 00:46.960
a cent.

00:47.160 --> 00:53.120
Um, and I'm going to add the option reasoning effort low because I want it to be quick and relatively

00:53.120 --> 00:54.560
cheap using 5.2.

00:54.680 --> 00:56.600
So that is a sensible choice.

00:56.800 --> 00:57.840
That is our model.

00:57.840 --> 01:00.440
We're not going to bother with memory because this isn't going to be a conversation.

01:00.440 --> 01:05.370
It's going to be one message in and then the results come out all right.

01:05.370 --> 01:09.490
And now it's time for us to think about what we want to do with Pipedrive.

01:09.650 --> 01:11.490
And so let's go to tools as that.

01:11.490 --> 01:12.650
It would be the most natural.

01:12.650 --> 01:18.410
First choice would be let's equip our agent with tools that will allow it to take a message like, please

01:18.410 --> 01:20.210
load this person into Pipedrive.

01:20.210 --> 01:21.690
And then to do that in Pipedrive.

01:21.690 --> 01:23.890
And indeed there is a Pipedrive tool.

01:24.010 --> 01:26.330
It's right here and we can come into it.

01:26.530 --> 01:31.130
And uh oh, it already knows my credentials, so I will wipe that so we get to set it up.

01:31.370 --> 01:34.770
But, uh, we then would choose, what do you want it to do?

01:34.810 --> 01:38.770
Do you want it to create a lead, an organization or a person?

01:39.010 --> 01:43.570
And if you create a lead, which is what we want to ultimately do, it needs to be associated with an

01:43.570 --> 01:45.570
organization with an ID.

01:45.810 --> 01:47.250
So we would have to do that.

01:47.250 --> 01:52.090
And similarly, if we, if we, uh, we'd want to create an organization and we'd also which, which

01:52.090 --> 01:53.010
needs a name.

01:53.370 --> 01:59.970
And here you'll see an example of something which is a bit tiresome, which is that there are some constraints

02:00.110 --> 02:02.350
around some of the way that these things work.

02:02.390 --> 02:07.870
It appears that unless it's just a current temporary feature of this tool, that you can't actually

02:07.870 --> 02:12.790
get the model to set the name of an organization when it creates it.

02:12.830 --> 02:16.750
However, you can do it when it updates an organization.

02:16.790 --> 02:17.230
There you go.

02:17.270 --> 02:19.230
Let the model define this parameter.

02:19.350 --> 02:23.990
So we'd actually have to have a tool to create the organization and then update its name.

02:24.030 --> 02:27.070
We'd have to create it with a with a temporary name in there.

02:27.070 --> 02:30.990
So there would actually need to be four different tools that we need to equip the LM with.

02:31.030 --> 02:38.110
And we need to teach the LM to take the ID that it gets back from one tool call and put it into another.

02:38.550 --> 02:43.190
And now that's expecting a lot from an LM because it's quite fiddly.

02:43.190 --> 02:46.950
And to be honest, it's something which lends itself really well to code.

02:46.990 --> 02:53.390
We're simply saying, look, always call this first with the ID that gets returned from this, I want

02:53.390 --> 02:54.430
you to call this.

02:54.590 --> 02:57.710
So it's really a set of of workflow steps.

02:57.710 --> 03:02.920
It's a set of steps that should happen one after another with the data from one going into the other.

03:02.920 --> 03:05.360
And that should be a flag for you.

03:05.360 --> 03:07.400
That should be a bit of a red flag for tools.

03:07.400 --> 03:09.720
We don't need autonomy here.

03:09.720 --> 03:13.320
We don't want to give the LLM that much flexibility.

03:13.440 --> 03:20.840
It seems like a better use case for using workflow for using core nodes, not tools.

03:20.840 --> 03:25.520
And that's why your mind should be going to to structured outputs.

03:25.680 --> 03:32.960
This is a great example of where structured outputs and workflow is going to perform better than tools.

03:33.000 --> 03:33.360
Okay.

03:33.400 --> 03:34.920
So I'm going to delete this.

03:35.080 --> 03:35.720
Get rid of it.

03:35.720 --> 03:37.680
From there we're going to stick with this.

03:37.680 --> 03:42.960
And we're now going to build out something which is going to need the agent to produce structured output

03:42.960 --> 03:45.080
in a format that's going to be perfect.

03:45.080 --> 03:46.200
So let's do that.

03:46.200 --> 03:52.280
We're going to to come in here and we're going to say I do require a specific output format.

03:52.480 --> 03:55.720
And once I've done that, you'll see that the output parser has appeared.

03:55.720 --> 03:59.000
And we will choose a structured output parser.

03:59.120 --> 04:00.010
Here we have it.

04:00.050 --> 04:05.570
Okay, so the agent is going to be responsible for taking in some input in text that describes some

04:05.570 --> 04:06.130
lead.

04:06.130 --> 04:13.130
And outputting that same thing turned into something that's structured and organized based on its understanding.

04:13.210 --> 04:18.210
So the JSON that we want is going to have something that is going to describe a lead.

04:18.210 --> 04:25.530
So maybe it's going to have like name the name of the lead, the full name of the lead.

04:28.210 --> 04:28.890
Company.

04:31.210 --> 04:35.130
The company where they work.

04:38.090 --> 04:38.850
Role.

04:41.410 --> 04:43.690
Their job title.

04:45.970 --> 04:46.770
Email.

04:48.610 --> 04:52.850
Their email address.

04:53.490 --> 04:54.330
That's it.

04:54.530 --> 04:59.170
So we're using an LLM to take natural language as an input and output it.

04:59.300 --> 05:01.340
organized and structured in this form.

05:01.340 --> 05:03.260
It's a great application of llms.

05:03.300 --> 05:07.740
They're great at taking structured data and turning it into something that's unstructured.

05:07.860 --> 05:09.580
Uh, and the other way as well.

05:09.780 --> 05:13.060
Uh, either way, they can they can parse and they can parse.

05:13.220 --> 05:15.540
Uh, which is, which is part of their magic.

05:15.700 --> 05:21.140
Uh, so this is going to be a really effective way to use GPT 5.2.

05:21.260 --> 05:21.700
Okay.

05:21.740 --> 05:28.940
Now I'm going to go back to the, uh, agent, and I'm going to set a system message to tell it what

05:28.940 --> 05:29.620
we want it to do.

05:29.660 --> 05:35.180
Basically what I just said, instead of that, I'm going to say this based on the input from the user,

05:35.180 --> 05:38.660
you should reply with a structured version of the lead.

05:38.780 --> 05:42.780
Your reply will be sent to Pipedrive to create a lead record.

05:43.100 --> 05:50.580
It's a bit clear based on the input of the user which describes a sales lead.

05:50.940 --> 05:51.420
There we go.

05:51.460 --> 05:52.900
That seems very clear to me.

05:52.900 --> 05:53.780
So nice.

05:53.780 --> 05:55.020
Simple directions.

05:55.020 --> 06:01.440
It's taking some unstructured data and it's turning it into something that can be put in Pipedrive in

06:01.440 --> 06:02.640
JSON format.

06:03.080 --> 06:03.800
All right.

06:03.840 --> 06:04.760
So far, so good.

06:04.760 --> 06:06.440
Let's come over here now.

06:06.440 --> 06:08.880
So this agent is going to take some chat message.

06:08.880 --> 06:11.800
It's going to turn it into that structured output.

06:11.960 --> 06:15.760
And I'm saying that's kind of equivalent thinking of it as making tool calls.

06:15.760 --> 06:21.640
Because what we can now do is put in in here not a tool but a workflow step.

06:21.760 --> 06:30.960
Pipedrive of course, has a um, a node which has node operations, which includes an operation to create

06:30.960 --> 06:32.160
an organization.

06:32.160 --> 06:33.480
And that's the first thing we're going to do.

06:33.520 --> 06:38.440
We're going to create an organization, uh, and we're going to I'm going to come back to this in a

06:38.440 --> 06:38.720
second.

06:38.720 --> 06:43.560
But when we've done that, we're then going to also use a Pipedrive node.

06:44.240 --> 06:49.280
And here we are going to come in and we're going to create a person record.

06:49.440 --> 06:52.880
So create an organization and then create a person.

06:52.880 --> 06:53.440
Here we go.

06:53.440 --> 06:54.440
Create a person.

06:54.880 --> 06:58.930
And once we've done that we are then let's resize this.

06:58.970 --> 07:01.730
We are then going to do another Pipedrive node.

07:03.370 --> 07:07.730
And finally after doing all of this we're going to create a lead.

07:09.050 --> 07:10.130
So you can see what I mean.

07:10.130 --> 07:13.610
We're just laying out the uh the workflow here.

07:13.650 --> 07:18.170
Here it is three steps based on the JSON that gets outputted from this agent.

07:18.170 --> 07:19.290
Create an organization.

07:19.290 --> 07:21.090
Create a person, create a lead.

07:21.130 --> 07:23.090
Because we just wanted to do it in that order.

07:23.130 --> 07:25.810
There's no point in giving that as a bunch of tools to the model.

07:25.810 --> 07:27.450
We might as well lay it out.

07:27.530 --> 07:29.010
Now we just have to populate these.

07:29.050 --> 07:32.450
Well, the first step to populating it is to set the API key.

07:32.650 --> 07:33.890
And that's pretty simple.

07:33.890 --> 07:35.930
You can see I deleted my the one that was already there.

07:35.970 --> 07:37.610
I press Create New credential.

07:37.650 --> 07:43.170
I click here and I paste in the token that I've got over here from Pipedrive.

07:43.210 --> 07:44.530
Let's go and copy that now.

07:44.570 --> 07:44.890
Okay.

07:44.930 --> 07:46.930
So obviously I go to Pipedrive.

07:46.930 --> 07:48.370
I go to Personal Preferences.

07:48.370 --> 07:49.530
I click on API.

07:49.570 --> 07:52.370
Press the green button to copy your API key.

07:52.530 --> 07:54.050
Come back over here.

07:54.090 --> 07:55.410
Come in here.

07:55.450 --> 07:56.530
Select credential.

07:56.530 --> 07:58.090
Create a new credential.

07:58.180 --> 07:58.900
click here.

07:58.900 --> 08:00.620
Paste in your token.

08:00.620 --> 08:01.540
Press save.

08:01.580 --> 08:02.300
Drum roll.

08:02.340 --> 08:03.140
Green.

08:03.180 --> 08:04.300
Successful.

08:04.300 --> 08:05.460
Congratulations.

08:05.460 --> 08:06.900
We're connected to Pipedrive.

08:06.940 --> 08:09.820
It automatically does that to all of these guys.

08:09.820 --> 08:11.500
We are in good shape.

08:12.020 --> 08:16.740
Next up we need to populate the name of this organization.

08:16.740 --> 08:19.020
And we also need to populate the name of the person.

08:19.020 --> 08:23.580
And we need to populate details of the lead as well and how to associate it.

08:23.580 --> 08:25.660
For now I'm going to leave all of this blank.

08:25.900 --> 08:30.820
I just want to kick this off and see what happens, so I can populate the data so that we can do our

08:30.820 --> 08:32.140
drag and drop stuff.

08:32.140 --> 08:33.020
Let's do that now.

08:33.060 --> 08:37.060
Okay, so when we test this out we're just going to have to turn these guys off.

08:37.100 --> 08:39.580
Otherwise they will complain because they're not populated yet.

08:39.580 --> 08:41.580
So I'm pressing the power button on all three of them.

08:41.580 --> 08:42.700
So they're all turned off.

08:42.740 --> 08:49.420
Then we'll start up the chat and I'll say, please record this lead.

08:50.100 --> 08:57.960
John Smith, CFO at IBM, John Smith at IBM.

08:58.200 --> 08:58.920
Com.

08:59.240 --> 09:02.600
So this is going to be just natural text.

09:02.600 --> 09:07.680
And the other way of doing it would be for this agent to be equipped with various tools and to try and

09:07.680 --> 09:10.000
call all the different tools, but that's not what we're doing.

09:10.000 --> 09:16.360
Instead, we're telling it to use structured outputs to return that unstructured form and pass it on.

09:16.360 --> 09:17.720
And this is what it returned.

09:17.720 --> 09:19.560
And you can see it did just that.

09:19.560 --> 09:23.520
And we can think of this as being analogous to to calling a series of tools.

09:23.520 --> 09:27.760
But that's what we're actually going to do ourselves in this workflow right now.

09:27.880 --> 09:28.320
Okay.

09:28.360 --> 09:30.040
So let me just clean it up with that button.

09:30.040 --> 09:31.760
Let's hide this for a moment.

09:31.920 --> 09:32.800
Let's come here.

09:32.800 --> 09:34.560
Let's reactivate this guy.

09:34.600 --> 09:35.600
Let's double click.

09:35.880 --> 09:36.720
In we come.

09:36.840 --> 09:39.520
So this is creating an organization.

09:39.520 --> 09:41.120
What name do we give it?

09:41.160 --> 09:43.680
In the past we've said let the model decide.

09:43.680 --> 09:45.600
But we can't do that because it's not a tool.

09:45.600 --> 09:46.920
It's just part of the workflow.

09:46.960 --> 09:48.320
We have to select the name.

09:48.360 --> 09:49.840
Well look we have the name right here.

09:49.880 --> 09:51.440
Sorry, the name of the company right here.

09:51.480 --> 09:52.520
It's an organization.

09:52.520 --> 09:53.520
We just drag that in.

09:53.560 --> 09:55.920
It's of course dollar JSON output company.

09:55.920 --> 09:56.560
There it is.

09:56.600 --> 09:58.570
IBM is what will be populated with.

09:58.690 --> 09:59.210
Done.

09:59.490 --> 10:00.050
Okay.

10:00.690 --> 10:01.370
Next.

10:01.730 --> 10:02.570
This one over here.

10:02.610 --> 10:03.530
Turn the power off.

10:03.570 --> 10:04.370
Double click.

10:04.410 --> 10:08.010
It's a little bit more involved because we can't take something from the previous node.

10:08.010 --> 10:09.810
We have to go back one node.

10:09.970 --> 10:14.490
And if you don't remember the syntax for that it's quite easy because over here on the left, if you

10:14.530 --> 10:18.250
scroll down, you'll see that it has the prior nodes.

10:18.250 --> 10:20.370
You can just expand a prior node.

10:20.410 --> 10:22.570
The AI agent is the node we care about.

10:22.610 --> 10:26.130
And here you'll find this is the person record the name John Smith.

10:26.130 --> 10:27.210
That's what we care about.

10:27.250 --> 10:28.410
Drag it and drop it.

10:28.410 --> 10:34.970
And that is the expression dollar AI agent JSON output name.

10:35.130 --> 10:35.930
Fine.

10:36.090 --> 10:38.810
You can have your cunning expression.

10:38.930 --> 10:41.690
Uh, we believe drag and drop work just fine.

10:41.690 --> 10:42.810
This is going to work.

10:42.850 --> 10:43.610
Thank you.

10:43.770 --> 10:46.890
Uh, so that is the name now populated.

10:47.050 --> 10:47.610
Okay.

10:48.010 --> 10:48.690
Escape.

10:48.970 --> 10:49.690
Next.

10:49.730 --> 10:50.130
Okay.

10:50.170 --> 10:51.290
And now the juicy part.

10:51.290 --> 10:53.450
We want to create a lead in our database.

10:53.450 --> 10:55.250
This is what we're really trying to do all along.

10:55.290 --> 10:56.450
We're going to turn the power back on.

10:56.450 --> 10:57.820
We're going to double click.

10:57.820 --> 10:58.460
Here it is.

10:58.500 --> 10:59.340
We need to create a lead.

10:59.340 --> 11:00.620
The lead needs a title.

11:00.660 --> 11:04.580
Now we can populate that with a title that we want for the for the title of the lead.

11:04.620 --> 11:09.660
We can have this be something like, uh, we can have it be the name of the of the person, I guess.

11:09.700 --> 11:13.980
And then, um, and then the, the, uh, the, the lead next to it.

11:13.980 --> 11:20.540
So to do that again, we scroll all the way down, we find the name of the AI agent that is the node.

11:20.540 --> 11:25.180
And we're looking here probably for, for the, the title of the lead should just be the name of the

11:25.180 --> 11:26.060
person I think.

11:26.380 --> 11:30.420
Um, and because normally the lead represents a potential deal.

11:30.420 --> 11:34.540
So this is something that, uh, that could turn into a deal, but I think that's probably how you'd

11:34.540 --> 11:35.260
normally do it.

11:35.300 --> 11:42.340
We want to associate it with an organization and that has an organization ID, and this is where we

11:42.340 --> 11:47.300
might get a bit confused because where are we going to find that organization ID from?

11:47.300 --> 11:49.860
The AI agent didn't tell us the organization ID.

11:50.180 --> 11:54.980
Well, I have news for you that is going to come from this node right here.

11:54.980 --> 12:01.070
When we create an organization, it's going to output the ID and it's just going to be called ID.

12:01.390 --> 12:06.350
And so we can actually take this ID here and drop that in here.

12:06.550 --> 12:09.350
And we're seeing that we're getting create an organization.

12:12.030 --> 12:15.230
That's going to be the organization ID okay.

12:15.550 --> 12:21.350
And you know what we want to lead to be associated not just with an organization but also with a person.

12:21.350 --> 12:25.950
And we can populate a person ID and we want that to come from this node.

12:25.950 --> 12:30.350
Create a person that also has an ID that comes in the response.

12:30.390 --> 12:31.310
These are coming in.

12:31.350 --> 12:32.030
That didn't work.

12:32.150 --> 12:40.190
Uh, expression uh, these are coming in the response back from uh from from this, this previous node.

12:40.470 --> 12:45.150
So I dropped that in there JSON ID because it was just the last node.

12:45.150 --> 12:50.990
And that is now going to, to populate the ID that came back from that prior node.

12:51.430 --> 12:52.430
And we're done.

12:52.550 --> 12:53.750
This should be it.

12:54.150 --> 12:57.130
So I'm just going to recap in case you weren't following me there.

12:57.130 --> 13:03.650
So we're taking all of the data that's flowing in from prior nodes and using that to populate this new

13:03.690 --> 13:04.810
lead record.

13:04.850 --> 13:06.490
And in fact, there are there are three things.

13:06.490 --> 13:08.810
We're setting the title of the lead overall.

13:08.810 --> 13:15.490
We're just setting it to be the the name field that came in from from the agent, the organization ID

13:15.490 --> 13:23.130
and the person ID that we're populating based on the output of creating those records in Pipedrive from

13:23.130 --> 13:30.090
from these prior two nodes, they both output an ID and we're pushing that ID in when we create the

13:30.090 --> 13:30.570
lead.

13:30.570 --> 13:33.770
And that's such a great example of stitching together data.

13:33.770 --> 13:39.450
And it's I hope you I hope this is a eureka moment for you, because you see how much better suited

13:39.450 --> 13:46.690
this is to a workflow in N810 when you're managing the data using a product that's ideally suited for

13:46.690 --> 13:51.810
it, than trying to futz around with tools and telling the agent, hey, you've got to move the ID from

13:51.810 --> 13:54.050
the output of this tool to the input of this tool.

13:54.370 --> 13:55.530
That would be messy.

13:55.570 --> 13:57.010
This is going to work great.
