WEBVTT

00:00.440 --> 00:02.520
Okay, enough with the sidebars.

00:02.520 --> 00:04.240
It's on to the main business.

00:04.280 --> 00:08.040
It is on to introducing OpenAI agents SDK.

00:08.080 --> 00:10.560
Now let me start by by teeing this up.

00:10.760 --> 00:16.120
So this is a framework which as I've already mentioned, is super lightweight, very flexible.

00:16.600 --> 00:21.960
One of the things I love about it is that it's not what they call opinionated.

00:22.000 --> 00:27.520
Opinionated is how some frameworks are described when they come with a lot of constructs, a way of

00:27.520 --> 00:32.160
doing things that you are then sort of expected to adhere to.

00:32.480 --> 00:37.080
Now, that's not always a bad thing because that can help build particular design patterns.

00:37.080 --> 00:40.320
It can get you it can allow you to build things really, really quickly.

00:40.600 --> 00:46.360
But my personal bias is I often prefer things that are less prescriptive and which give you more flexibility

00:46.360 --> 00:48.640
to choose how you want to to work with this.

00:48.680 --> 00:52.240
And very much OpenAI agents SDK is of that ilk.

00:53.040 --> 01:02.120
It also is very good at the same time at making some of the everyday stuff, like using tools much simpler.

01:02.240 --> 01:07.600
So if you think of all of that gunk that we had to do with the JSON around tools, all of that faffing

01:07.600 --> 01:09.960
around with big JSON objects.

01:09.960 --> 01:12.680
Well, OpenAI agents SDK just does all that for you.

01:12.680 --> 01:16.440
So that kind of stuff is very much it is in the way, but in a good way.

01:16.560 --> 01:22.480
It just does all of that JSON stuff and it handles the whole, if you remember the if statement and

01:22.480 --> 01:27.280
then my fancy version of it, it does all of that so that you just don't need to worry about it.

01:27.280 --> 01:33.080
And that's one way where it is good to have some abstraction, because that's the the useless boilerplate

01:33.080 --> 01:37.160
stuff that you have to repeat every single time that you want a framework to do for you.

01:37.600 --> 01:43.440
And as you can probably tell from the way I'm saying this, OpenAI agents SDK is my favorite.

01:43.720 --> 01:48.840
And yeah, I'm really looking forward to this week and I enjoy working with OpenAI agents SDK.

01:49.000 --> 01:51.320
And you might be thinking, editor, why?

01:51.520 --> 01:53.880
Why are you showing us your favorite one?

01:53.880 --> 01:56.480
First, why don't you want to end with your favorite one?

01:56.480 --> 01:57.800
You should work up to it.

01:57.840 --> 01:59.280
And I have two answers for you there.

01:59.320 --> 02:04.760
So first of all, I do want to point out that that whilst OpenAI agents SDK is my favorite, all of

02:04.760 --> 02:10.920
the frameworks are great, and they all have pros and cons, and each of them have use cases where they

02:10.960 --> 02:13.520
are the best for that particular kind of problem.

02:13.520 --> 02:15.520
So in some ways they're all my favorites.

02:15.520 --> 02:17.200
But but uh, no, that's not true.

02:17.240 --> 02:18.400
OpenAI, you're my favorite.

02:18.520 --> 02:20.480
Uh, they're all good.

02:20.480 --> 02:24.920
And so, uh, but they also get that during the course of our journey, they're going to get more and

02:24.920 --> 02:25.760
more complex.

02:25.760 --> 02:28.080
And so it's going to make sense to do it the way we do.

02:28.120 --> 02:30.480
And our projects are going to get beefier and beefier.

02:30.760 --> 02:31.960
So that's the first reason.

02:32.000 --> 02:37.600
The second reason is that whilst this is the framework that we are starting with, we are also going

02:37.600 --> 02:43.800
to finish with it as well, because in week six, when we work with MCP, which is a protocol, not

02:43.800 --> 02:49.600
really a framework, in the same way we are going to be using OpenAI agents SDK again in a more hardcore

02:49.640 --> 02:49.880
way.

02:49.920 --> 02:50.840
So it's going to come back.

02:50.840 --> 02:54.000
It's going to make a triumphant return in week six.

02:54.000 --> 02:55.720
So you you don't need to worry.

02:55.720 --> 02:57.120
The crescendo will be there.

02:58.040 --> 03:02.040
Now, one thing that all of the frameworks have in common is that they come with some terminology,

03:02.080 --> 03:05.160
some constructs, and each one is of course slightly different.

03:05.160 --> 03:07.840
And we will be learning each of the different terminologies as we go.

03:07.840 --> 03:11.310
But of course OpenAI's terminology is pretty minimal.

03:11.310 --> 03:13.030
It's fairly simple stuff.

03:13.350 --> 03:13.990
There is.

03:14.230 --> 03:17.390
There's three, three concepts, three terms I'm going to go through with you.

03:17.390 --> 03:19.550
The first of them is just an agent.

03:19.590 --> 03:27.030
Agents represent their sort of package around calls to llms, which have a particular role, a particular

03:27.030 --> 03:28.950
purpose in this solution.

03:28.990 --> 03:36.150
Obviously handoffs this is their name for the interactions between agents.

03:36.270 --> 03:41.790
So handoff is a term that they use a fair amount and we'll see it come up in different contexts.

03:41.790 --> 03:42.790
But that's what it means.

03:42.790 --> 03:44.150
It is an interaction.

03:44.630 --> 03:52.390
And guardrails is their terminology for the kinds of checks and controls that you put around, making

03:52.390 --> 03:56.830
sure that an agent is doing what you want it to do and isn't going off the rails.

03:57.070 --> 04:00.710
Guardrails is a pretty common word in normal software engineering anyway.

04:00.710 --> 04:06.990
But but it's one of the the three terms to take on board for using OpenAI agents SDK.

04:07.910 --> 04:13.390
So in order to actually run an agent, there are three steps that you have to take.

04:13.590 --> 04:14.390
And here they are.

04:14.430 --> 04:15.630
Here are the three steps.

04:15.830 --> 04:18.110
You create an instance of agent.

04:18.150 --> 04:20.030
That's going to be the thing that you're going to set.

04:20.070 --> 04:23.630
Up to be one of the roles in your solution.

04:24.150 --> 04:27.750
You use something called with trace to be.

04:27.790 --> 04:31.350
Able to keep a log of all of your interactions with that agent.

04:31.350 --> 04:33.790
This isn't required, but but it's going to be the way we will do it.

04:33.790 --> 04:35.030
And we will always do it this way.

04:35.030 --> 04:39.510
And it's going to allow us to look in OpenAI's monitoring tools and see everything that's going on.

04:39.910 --> 04:42.310
And then you call something called runner.

04:43.430 --> 04:49.590
And runner run is the thing that will actually run the agent as you will see.

04:49.790 --> 04:56.870
And runner run, the thing that actually runs the agent is of course an async function.

04:56.870 --> 04:58.750
Or I should say it's a coroutine.

04:58.910 --> 05:03.910
And so as a result, it's something that we will need to await in order to get it to actually run.

05:03.950 --> 05:07.870
So we are going to need to do something that's going to look like await runner run.

05:08.110 --> 05:10.230
And these are the three steps.

05:10.590 --> 05:14.670
And without further ado, let's go and do those three steps right now.
