Introducing Think: Build Agents That Remember, Learn & Code Extensions
Chapters10
An overview of Think as an experimental, opinionated base with new tools and capabilities designed to enhance agent development and experimentation.
Think introduces an experimental agent base class with durable memory, extendable extensions, and a session API to keep learning and coding alongside real-time tools.
Summary
Cloudflare Developers’ walkthrough showcases Think, an experimental, opinionated base class in the agent SDK designed to let agents remember, learn, and even code extensions. The host demonstrates how Think stores persistent memory across sessions via the new Session API, enabling a user to recall details like their name and reading preferences. A durable, restartable state keeps progress available after restarts, and a front-end wired to this state reflects every change in real time. The video highlights how tools are attached to agents and how agents can dynamically build extensions that generate code, install them, and iterate on them without leaving the browser. A key example is the Motivation Station extension, which supports reading goals, mini-challenges, and reading-session logging, all able to heal themselves if something goes wrong. Think also introduces extensions as user-built, code-generating components that live alongside the agent, plus a workflow for scheduling reminders and sending digests via fibers (restartable background tasks). The host emphasizes serverless, on-demand operation where the agent wakes up, runs, and sleeps, and points to docs, code, and blog posts for deeper dives. For readers, the takeaway is that you can build long-running, memory-aware agents that learn from user input and extend themselves with dynamically generated tooling.
Key Takeaways
- The Session API stores memory across sessions, enabling the agent to recall details like the user’s name and preferences even after restart.
- Extensions let users generate and install new tooling; the Motivation Station example shows a self-contained, configurable assistant that tracks reading goals and streaks.
- Agents can maintain durable state with the agent SDK, so changes persist in the front end and across restarts.
- Code is generated and run dynamically to create new extensions, which are then iterated on with user approval and sandboxed environments.
- Fibers provide restartable background tasks, enabling background reading digests to run even if deployment or sessions are interrupted.
- The approach is serverless and pay-per-use, with agents waking up, performing work, and sleeping to conserve resources.
- Open Library integration demonstrates how external APIs can be hooked to enrich an agent’s capabilities and memory.
Who Is This For?
Essential viewing for developers building memory-enabled agents who want to extend functionality on the fly with user-generated extensions and durable state. It’s especially relevant for anyone exploring Cloudflare’s Think/agent SDK and fibers workflow.
Notable Quotes
"There is a new experimental opinionated base class in agent SDK and it's called Think."
—Introduction to Think and its purpose as a base class.
"This is going to go ahead and generate code, actually generate code and build an extension that I can run."
—Demonstrates dynamic extension generation and deployment.
"The thing that's really nice about this is it will stay across sessions, it's using that new session API."
—Highlights durable memory across sessions.
"Think introduces the concept of extensions."
—Shows user-created tooling that can be dynamically built.
"Fibers... restartable background tasks, enabling a reading digest to run no matter what."
—Explains background, resilient tasks with fibers.
Questions This Video Answers
- How does Cloudflare Think's Session API enable memory persistence across sessions?
- What is the Motivation Station extension and how does it work with reading goals?
- Can extensions be generated automatically by the agent and how is code safety handled?
- How do fibers enable long-running tasks in serverless agent architectures?
- What are practical examples of durable agent state in Think?
Cloudflare ThinkAgent SDKSession APIDurable memoryExtensionsMotivation StationOpen Library APIFibersServerlessCode generation
Full Transcript
I love exploring and I love new tech. So today's a special day because there is a new experimental opinionated base class in agent SDK and it's called Think. It's got all sorts of tools that you're gonna love. In fact, I think you're gonna love it. This is Bookworm. Check it out. I've tried building agents like this before and you know what 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 gonna enter here. We're gonna say demo town. Welcome to demo town, everybody. I'm gonna open up here and you'll see here's my shelf right on a, it's a durable shelf, right? Because it lasts forever, right? It's a durable after restart. It will be there. I've got to read, I've got reading now, read and reviewed.
We got some more stuff in here that we're gonna take a look at. Now, I've got a custom tool that I attached to this agent that will control these things and will 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 wanna know, I want you to know that you can call me Craig. I wanna be familiar with it, right? So it's gonna come into, 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 gonna clear this here and I'm gonna say what memory do you have of me, right? And so it can access this memory whenever it needs to. And we're gonna see here that it's got this, it knows up 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 wanna do is I wanna 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 open library and it's trying to find the fashionable adventures of Joshua Craig, Craig's soil mechanics and some non-fiction. Miss Craig's saving 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 gonna say, can you add, and we'll just say the name of that book that was there.
So it's searched open library, which is a nice API that I've hooked my tools up to. And it's gonna 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 agent 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 gonna say, I'll start reading that now. And so, it's moved it into the other reading now thing. So here we go, and you know, 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 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's 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 or 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? Just, it's pretty wonkers. So you can say something like, I want to build an extension, right? 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. 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, build it all. I like all of that. I like everything it said there. Let's do it. So it's going to go, it's going to start doing this install extensions. 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 OK, because then the little sandbox 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 book room. 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 exercise. 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 built it. 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 to you. 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, I 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 should be able to see that, right? It's using my list books. Oh, let's say, of course, the namesake book. 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. I'll say, oh, let's just add those to my reading list.
So now I'm working across. 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 as my 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 p.m. PST. So it's scheduling 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 there. 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 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 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.
Now, I could really, it's almost 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, right? So it built me this little dice markdown thing here.
And it's telling me I've got an interesting mix going on. I'm scared of entered 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 eating too. Thanks for having it out. And we'll see you real soon.
More from Cloudflare Developers
Get daily recaps from
Cloudflare Developers
AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.









