Introducing Think: Build Agents That Remember, Learn & Code Extensions
Première diffusion : Aujourd'hui, de 13:00 à 13:30 UTC−5
English
Transcription (Bêta)
I love exploring and I love new tech, so today's a special day because there is a new experimental opinionated base class in Agents SDK and it's called Think.
It's got all sorts of tools that you're going to love.
In fact, I think you're going to love it.
This is Bookworm. Check it out. I've tried building Agents like this before and you know, when you do this stuff, they need to run for a long time, right?
The stuff that we're asking these Agents to do, it's a little bit harder than it used to be, right?
It's harder than usual. We expect more. They need access to tools.
They need to live when I shut my computer. They all kind of need to keep a state that lasts forever.
Now, here is a type of Agent that I've wanted for such a long time where I keep track of my books.
So I'm going to enter here. We're going to say Demo Town.
Welcome to Demo Town, everybody. I'm going to open up here and you'll see here's my shelf, right?
It's a durable shelf, right? Because it lasts forever, right?
It's durable. After restart, it will be there. I've got to read.
I've got read now, read and reviewed. We've got some more stuff in here that we're going to take a look at.
Now, I've got a custom tool that I attached to this Agent that will control these things and we'll show that off here in a second.
But one of the new tools that Think is using here is called the Session API.
It's a new type of concept where it will store values that build up in memory. So I want you to know that you can call me Craig.
I want to be familiar with it, right?
So it's going to come in. It'll do a thing where it sets context, right? It's setting context.
It's doing that. Now, what's really nice about this is it will stay across sessions.
It's using that new Session API. So I'm going to clear this here and I'm going to say, what memory do you have of me, right?
And so it can access this memory whenever it needs to.
And we're going to see here that it's got this.
It knows that my name's Craig and it doesn't know these other themes or genres or things that I do.
But what's nice about that is because I want it to learn more about me as I read, right?
So it's got this permanent memory about me. So check this out.
So what I want to do is I want to say, I want to read a book with my name in it.
So I've hooked this up to tools just like you do, right? It's going across, it's using OpenLibrary and it's trying to find the fashionable adventures of Joshua Craig, Craig's soil mechanics and some non-fiction.
Miss Craig's face -saving exercises.
Oh, let's do that for my skincare routine. Let's do that. I'm interested in this.
So, yeah. So let's go ahead. What a weird book. I'm going to say, can you add, and we'll just say the name of that book that was there.
So it went out, it searched OpenLibrary, which is a nice API that I've hooked my tools up to.
And it's going to go ahead and do that. And I said, can you add it? It knows it's a book and then it's running my other tool that I said I made, right?
I made this ad book and you'll see that if I come here, it's going and it's, what's happening is it's using the state, right?
So I've set up, this is nothing new. I've set up my agent to have state in agents SDK.
It has state and therefore I'm able to put it into different places.
And of course I can use the different tools. I'm going to say, I'll start reading that now.
And so, it's moved it into the other reading now thing.
So here we go. And it's still, it's telling me doing some nice stuff here that I've wanted it to do.
I wanted it to kind of encourage me to keep reading a little bit.
So, so this is clearly using agent state, right?
And my front end is wired up to that agent state. So any changes that happen on my agent, it gets reflected here.
And again, my agent is addressable so I can change it and we'll just pop here.
So I can have other tools touching my agent, just like you always have, but check this one out.
This is new.
Think introduces the concept of extensions. So as a user, let's say I wanted to get motivated to read more.
This is something that maybe I would want to do.
Wouldn't it be cool if there was some way to let the user just go build that tool?
Check this out. It's pretty bonkers. So you can say something like, I want to build an extension, right?
So, so maybe I looked over here at the installed extensions and I realized that I could make a custom one that keeps me motivated to read more, right?
Now, this is going to go out and build code for me dynamically. It says, what kind of motivation do I want all of that?
Oh, that's really cool. Saying a whole bunch of stuff that I might want to do.
Yeah. Yeah. Build it all. I like all that.
I liked everything it said there. Let's do it. So it's going to go, it's going to start doing this install extension.
So this is going to go ahead and generate code, actually generate code and build an extension that I can run.
And it went and made a whole bunch of code here.
So I'm going to go and see, do I want to approve it?
Yeah, I want to approve it. Of course I read all that. You read all that, didn't you?
Probably not the safest, but that's okay because in a little sandboxed environment.
So what it's done now is it's gone and it's built a thing called motivation station, which great rhyming there.
And it has a whole bunch of different things in here that I could do.
I could set a reading goal. I could get a mini challenge.
Oh my gosh, that's amazing. And I want to log my reading session.
It'll do a streak and this is unique to me, right? And I can iterate here if I wanted to.
And again, it just built it dynamically. And I think right now I can use it.
So let's see. I just read five pages. I'm going to send this to the bookworm.
It's going to call this new tool that I just built. And it's asking me, it was in the book.
Yeah. Yeah. That book. Yeah. Ms. Craig's face-saving exercises.
How many minutes did those five pages take you?
It took me like 20 minutes. I guess it's getting really specific about what it needs for this.
So there we go. It's trying, right?
But it's going to self -heal. It's going to build it if it doesn't work.
So it wants to remove it and it's going to build it again. There we go. And it's a pretty hefty thing.
It's gone and done there. And I'm going to go ahead. I'm going to prove this too.
And we just iterated, right? So we removed that. We made a new motivation station.
It called it the same thing. Let's go ahead and say, I just read five pages, 10 minutes.
Awesome.
So it says that I've gone and I've made a streak here. So that's great. And if I go and I start again, if I go and I start a whole new conversation here, I can say, I read another read another four pages in eight minutes and nine minutes.
Here we go. And it's going to go.
And it knows to call these tools. So it's doing it. It's continuing. It's keeping track.
I have built a brand new tool that I as a user wanted very specifically.
Amazing, right? So here's another thing that you can do, right? So because of those personal things, I can say, I love this book.
I've never read it. I don't know.
That's going to ask me some questions about it. And it says, what would you like to do?
The one in reading now I'm reading. So it should be able to see that, right?
Here we go. It's good. It's using my list books. Oh, the Seifei, of course.
The namesake book. Yeah. Yeah. I love it. I love this book. So it's asking me, what do I like about it?
Oh, I like the humor. So I like the humor. So it's knows that I like that.
And it's doing some suggestions of say, oh, let's just add, let's add those to my reading list.
So now I'm working across, right? I'm working across.
I'm finding those two books that they talked about here, The Good Asian and Farewell, My Lovely.
And I've added them both here to read books, right?
It's pretty amazing, right? So now I'm working with a suggestion across here, across these books, across these tools.
And they're all interacting with each other.
And this thing's going to go on and live forever and it's serverless. So I'm only paying for it when I'm using it.
It's going to fall asleep. It's going to wake back up.
Now, the other thing that you can do is you can schedule a reminder. So I'm going to say, remind me to read every night at 8.30 PM PST.
So it's scheduling a reminder time.
And you'll see that it knows that. And it's telling me over here about when it's going to go and do that, which is really nice.
So what will happen is it will go, if this app, all connected apps will get a message right here.
So the message will pop in and we'll see that it's telling me that it's time to go reading.
But one of the things I think I'm going to build because I can, right? If nobody's connected to this, if I don't have any agent, if I don't have any clients that are connected to this, I'm going to have it send me an email because I can do that now.
The way that I built this actually is I just took and I pointed my coding agent, my clanker, I pointed it at the blog post.
And what happened was it built this app for me.
And one of the things that it did, one of the things that it saw in the blog post, which you should read more about is this thing called fibers.
So it said, I'm going to build you a reading digest that will automatically run no matter what.
So like if I deploy code or if something gets canceled, it will automatically keep running.
So this is running in the background for a very long time.
I'm sure you have tasks that you think about. Maybe you could use a workflow for this, but you can also use these things called fibers, which are restartable.
It might be a little hard for me to try this, but I'm going to, let's say, can you build me?
And it's really cute that it did this. Can you build me a reading digest?
So this is going to go off and it creates a markdown file. And now I could really, it's almost done.
It's done. I could go off and stop and try to deploy and it would change the way that this reading digest went.
Maybe I wanted to go out and I want to get reviews about books and my things that I'm waiting for.
I want to reprioritize or I want to gather maybe some recordings that I said of people or books that I saw or photos I took.
I'm not exactly sure. I can use this for whatever I want, long reading inputs here and it will go and do this.
So it built me this little nice markdown thing here.
And it's telling me I've got an interesting mix going on obscure vintage titles, right?
It's fun. It will go and do that thing. So remember, this is just an opinionated primitive that adds a whole bunch of new tools that you can use outside of this.
You have the session API where you can store memory and things like that.
You have the ability to have a workspace, right?
So this thing is writing out these files like this extension that I was having, the way that it's working is it's actually writing files out, which is really powerful.
You have access to that. You have access to this background fiber, all sorts of new things to go and explore.
And I'm loving exploring it. And I want you to go dive in.
The code, the docs, the blog posts, they're all there. Come play with this thing.
It is so powerful. Tell me what you build. And I would love to know what you're reading too.
Thanks for hanging out and we'll see you real soon.
