WEBVTT

1
00:00:04.250 --> 00:00:07.670
Today we're going to look into Azure Functions

2
00:00:07.670 --> 00:00:12.390
versus the Agents with something they call Durable

3
00:00:12.390 --> 00:00:13.450
Agent Framework.

4
00:00:15.390 --> 00:00:19.090
Agents in Azure Functions is of course always

5
00:00:19.090 --> 00:00:22.810
possible by just an HTTP trigger, but this

6
00:00:22.810 --> 00:00:24.610
should make it more simple.

7
00:00:25.190 --> 00:00:27.890
And I say should, because I ran in,

8
00:00:28.150 --> 00:00:30.290
while recording this, I ran into a bug

9
00:00:30.290 --> 00:00:32.870
with the latest NuGet package that totally didn't

10
00:00:32.870 --> 00:00:34.510
work, and I spent a lot of time.

11
00:00:35.450 --> 00:00:38.190
But once that was resolved by the team,

12
00:00:38.930 --> 00:00:41.470
then it actually was fairly simple to get

13
00:00:41.470 --> 00:00:42.190
running.

14
00:00:43.010 --> 00:00:43.730
So let me show you.

15
00:00:46.300 --> 00:00:49.540
So, in order to do this, I have

16
00:00:49.540 --> 00:00:52.840
a Durable Agent Framework here, and a Hello

17
00:00:52.840 --> 00:00:55.400
AI, because I think we will make more

18
00:00:55.400 --> 00:01:01.140
videos on this, because there's more than just

19
00:01:01.140 --> 00:01:04.379
what I'm going to show today about making

20
00:01:04.379 --> 00:01:08.660
them work together and get stages back and

21
00:01:08.660 --> 00:01:08.940
so on.

22
00:01:09.020 --> 00:01:10.520
But for now, we're just going to make

23
00:01:10.520 --> 00:01:11.040
a little world.

24
00:01:12.460 --> 00:01:15.800
In order to do this, we need several

25
00:01:15.800 --> 00:01:17.040
NuGet packages.

26
00:01:17.040 --> 00:01:20.380
We, of course, need the normal two for

27
00:01:20.380 --> 00:01:24.440
Azure OpenAI and OpenAI for Agent Framework.

28
00:01:25.000 --> 00:01:27.580
We're also going to need the hosting one

29
00:01:27.580 --> 00:01:31.720
for Azure Functions from the Agent Framework, and

30
00:01:31.720 --> 00:01:34.620
then we need these Durable Tasks thingies.

31
00:01:37.240 --> 00:01:41.640
I'm unsure if this is needed, but sometimes

32
00:01:41.640 --> 00:01:43.660
when I don't include it, it breaks down,

33
00:01:43.800 --> 00:01:46.020
so I've included them for the sake.

34
00:01:46.900 --> 00:01:50.100
And here there is newer versions than these

35
00:01:50.100 --> 00:01:55.180
two, but because they are the buggy ones,

36
00:01:55.300 --> 00:01:57.760
I'm down to 1.9, which works.

37
00:01:57.880 --> 00:02:02.440
1.10 should also work, but 1.11

38
00:02:02.440 --> 00:02:05.980
is now unlisted as a NuGet package and

39
00:02:05.980 --> 00:02:07.060
are broken.

40
00:02:07.520 --> 00:02:09.479
Of course, they will fix it going forward.

41
00:02:10.360 --> 00:02:14.180
But if you put these in and you

42
00:02:14.180 --> 00:02:17.860
go to your host and add this extensions

43
00:02:17.860 --> 00:02:20.820
Durable Task, then you should be good to

44
00:02:20.820 --> 00:02:21.060
go.

45
00:02:23.930 --> 00:02:26.530
So what we can do is we can

46
00:02:26.530 --> 00:02:32.070
build our normal Azure Function setup here, and

47
00:02:32.070 --> 00:02:35.430
then we can do our normal agents as

48
00:02:35.430 --> 00:02:38.490
here, but then we add this extra one

49
00:02:38.490 --> 00:02:42.790
that comes from the Microsoft Agent hosting Azure

50
00:02:42.790 --> 00:02:52.780
Functions part, meaning this

51
00:02:52.780 --> 00:02:55.520
NuGet package, which in turn uses these.

52
00:02:58.040 --> 00:03:02.640
So this one just simply says, hey, add

53
00:03:02.640 --> 00:03:05.800
an agent, and that's my agent I put

54
00:03:05.800 --> 00:03:08.380
up here, which is just built like normal.

55
00:03:10.060 --> 00:03:12.860
And then we don't really need to do

56
00:03:12.860 --> 00:03:13.400
any more.

57
00:03:14.140 --> 00:03:17.340
We can have normal functions as well, but

58
00:03:17.340 --> 00:03:20.540
we don't really need them because this will

59
00:03:20.540 --> 00:03:24.520
just, on the fly, like the MCP server

60
00:03:24.520 --> 00:03:27.940
that also exists for Azure Functions, just spin

61
00:03:27.940 --> 00:03:30.420
up some more endpoints on your Azure Function.

62
00:03:31.320 --> 00:03:36.030
So if you run it, you will see

63
00:03:36.030 --> 00:03:40.290
that we both get it as MCP and

64
00:03:40.290 --> 00:03:43.130
we get it as the normal function, but

65
00:03:43.130 --> 00:03:45.630
here we have the new thing, which is

66
00:03:45.630 --> 00:03:46.430
the agent.

67
00:03:48.800 --> 00:03:52.480
So the agents just have a URL like

68
00:03:52.480 --> 00:03:54.700
an Azure Function has, and it's always post.

69
00:03:56.020 --> 00:03:58.400
So I've chosen to go to Insomnia.

70
00:03:58.600 --> 00:04:01.760
You could do Postman as well, and you

71
00:04:01.760 --> 00:04:03.880
can go in and simply write that URL,

72
00:04:05.280 --> 00:04:09.160
and then in a body, say message, and

73
00:04:09.160 --> 00:04:09.620
the message.

74
00:04:09.620 --> 00:04:13.020
So if you do that, it will come

75
00:04:13.020 --> 00:04:16.160
back to you and tell you the answer.

76
00:04:17.700 --> 00:04:21.340
So a normal request response is possible, and

77
00:04:21.340 --> 00:04:23.700
we could easily have done this with a

78
00:04:23.700 --> 00:04:25.700
HTTP trigger as well.

79
00:04:26.460 --> 00:04:30.080
But what helps a bit in them being

80
00:04:30.080 --> 00:04:34.420
doable is that in the headers back we

81
00:04:34.420 --> 00:04:36.660
get here, we get actually a thread, which

82
00:04:36.660 --> 00:04:39.600
is the conversation thread we are working on.

83
00:04:40.680 --> 00:04:42.280
And what we can then do is we

84
00:04:42.280 --> 00:04:44.420
can go in and do a follow-up

85
00:04:44.420 --> 00:04:48.000
by putting in thread underscore ID equals the

86
00:04:48.000 --> 00:04:48.320
thread.

87
00:04:50.670 --> 00:04:53.290
And if we do that, it will actually

88
00:04:53.290 --> 00:04:56.810
â€“ I must have done it wrong here.

89
00:04:57.790 --> 00:04:59.190
Let me try again.

90
00:04:59.190 --> 00:04:59.290
Okay.

91
00:05:03.270 --> 00:05:04.890
So we get a thread.

92
00:05:06.940 --> 00:05:08.200
We try a follow-up.

93
00:05:08.320 --> 00:05:10.900
Yeah, my mistake was I had a space

94
00:05:10.900 --> 00:05:11.160
here.

95
00:05:13.520 --> 00:05:14.360
Try it again.

96
00:05:17.020 --> 00:05:19.860
And now we see that it could take

97
00:05:19.860 --> 00:05:21.580
the follow-up question of how tall was

98
00:05:21.580 --> 00:05:23.340
he, meaning Mohammed Gandhi.

99
00:05:25.400 --> 00:05:27.980
So that is actually everything there is to

100
00:05:27.980 --> 00:05:28.200
it.

101
00:05:28.200 --> 00:05:30.960
I, again, spent a lot of time because

102
00:05:30.960 --> 00:05:33.120
I went to the newest NuGet package.

103
00:05:33.460 --> 00:05:37.600
So if we go here, there was a

104
00:05:37.600 --> 00:05:38.580
NuGet package.

105
00:05:38.700 --> 00:05:39.520
It's been unlisted.

106
00:05:40.820 --> 00:05:43.080
Also, if you have some problems running the

107
00:05:43.080 --> 00:05:47.420
Escher functions, that's because it's dependent on a

108
00:05:47.420 --> 00:05:49.940
Docker image for the storage emulator, and I

109
00:05:49.940 --> 00:05:54.340
put up a console command line that you

110
00:05:54.340 --> 00:05:57.300
need to run in order to have the

111
00:05:57.300 --> 00:05:58.660
Escher right for storage.

112
00:05:58.780 --> 00:06:00.640
But that's more an Escher function thing than

113
00:06:00.640 --> 00:06:03.560
the AI thing because the new thing is

114
00:06:03.560 --> 00:06:07.260
just make an agent, make this simple call,

115
00:06:07.380 --> 00:06:08.540
and it's ready to go.

116
00:06:08.660 --> 00:06:10.060
You don't need to make your own request

117
00:06:10.060 --> 00:06:12.060
response or anything.

118
00:06:12.540 --> 00:06:14.200
That is taken care of for you.

119
00:06:15.320 --> 00:06:15.800
So we're done.

120
00:06:16.040 --> 00:06:16.340
Thank you.

121
00:06:16.460 --> 00:06:17.180
See you in the next one.
