Latest / Superlinear / Pi Durable: The Missing Piece for AI Agents That Keep Working
Transcript
- 0:00Christine: How can we delegate more of our ongoing work to coding agents?
- 0:03Christine: Imagine agents that respond to new GitHub issues and recover unfinished work after a crash. So today we're looking at two building blocks for making these persistent agent workflows more reliable. Pi Durable and Cloudflare Durable Objects.
- 0:22Christine: We'll explain what each does, how they fit together, and how you can use them in your own coding workflows. So, Brandon, before we get into the individual tools, can you give us a concrete example of a workflow you could delegate to an agent built this way with these two tools?
- 0:42Christine: What would that look like in practice?
- 0:44Brandon: Imagine an autonomous coding agent that wakes up when a GitHub issue comes in, it builds the PR for you in the cloud, and even if it crashes randomly, the agent knows exactly where to resume without needing to redo unnecessary work. You or your friends and teammates can pick up the same conversation from GitHub, Slack, your phone or your terminal to make any other changes that you need.
- 1:07Brandon: This is something that you can do with these tools.
- 1:11Christine: That sounds really useful. But I wonder, couldn't we already build something like this with Claude Code or Codex and some webhooks and a remote machine?
- 1:20Christine: What's different?
- 1:22Brandon: You can, but it takes a lot of code and there's a lot of nuance to getting it right.
- 1:28Brandon: And it's very hard to test and squash all the bugs.
- 1:32Brandon: And so by having all these tools that are laser-focused on solving these problems and having lots of eyeballs on them and having these like nice open-source projects, we can use these as building blocks to enable us to be more ambitious and build more interesting tools with high confidence.
- 1:55Christine: I see. So it sounds like instead of building everything ourselves, we can now just take off-the-shelf products like the new Pi Durable the Cloudflare Durable Objects. Is that right?
- 2:10Brandon: Exactly. Yes, yeah. So we can take these things that have a lot of energy and focus on them, or at least they're starting to.
- 2:16Brandon: Some of them are new as well and we can use these to build amazing things.
- 2:23Christine: So yeah, let's dive into each of these tools and let's start with Pi Durable. So, what is Pi Durable?
- 2:32Brandon: So Pi Durable is a durable agent harness.
- 2:35Brandon: And what does that durability mean?
- 2:36Brandon: Well, basically it means that you can have a really long-running agent even if the machine that it's running on dies in the middle.
- 2:45Brandon: It still is the same session.
- 2:47Christine: OK. So what does Pi Durable do when a machine crashes?
- 2:53Brandon: So Pi Durable prepares at every moment to be ready for a crash so that it could recover if a crash happens. Right? Cuz it doesn't know when it would happen. So the way that this works is the creators describe it as an effect sandwich.
- 3:10Brandon: So at first you record an intent to perform an effect so anything that you know is happening in the real world then the effect actually happens, or you try to make it happen, and then once you get confirmation that it's done, you record I finished it.
- 3:32Brandon: And that way, Pi Durable knows if it sees only one half of these things when it starts up that something went wrong and a crash happened in the middle there.
- 3:42Christine: So it keeps a log of the things that it plans to do and the status of whether it's done or not.
- 3:50Brandon: Yeah, it's a little different it's a kind of log, yeah.
- 3:54Brandon: A lot of durable agents use what's called like event sourcing to do their durability which is literally writing things down in a log and then playing them back. And this kind of effect sandwich approach is a kind of log but it's different from like the typical log that other durable agent libraries have tried.
- 4:19Christine: And because it keeps track of these effects and the status that makes the workflow recoverable because it will know exactly when a machine crashes, where it was and which steps were already done and which were not. Is that right?
- 4:34Brandon: Yes.
- 4:35Christine: OK. That's helpful.
- 4:35Christine: And what could you build with Pi Durable that would be inconvenient with a regular coding agent but would be much more easy or suitable or helpful to do with Pi Durable?
- 4:50Brandon: Any time you have an agent session or you can imagine an agent session that is not started by a person.
- 5:01Brandon: Or even if it is started by a person, it needs to last for a long time.
- 5:06Brandon: Any of those situations are very suitable for Pi Durable. I can give a handful right now. Shall I?
- 5:13Christine: Yeah.
- 5:14Brandon: OK. OK you wanna set something up so that anytime you add a tag that says improve the performance of this thing, then an agent automatically gets spawned, it does its work, it hill climbs the performance for that particular task that you've specified.
- 5:40Brandon: And then when it's done, it writes the result back as a comment on the issue or opens up pull requests with the actual change so you know this kind of workflow is good if there's folks on your team that are uncomfortable using command line or if you're lazy and you don't wanna open your Codex app and you know you're already in GitHub. So it's just like easier.
- 6:08Brandon: Right? Claude Code has this remote control.
- 6:11Brandon: Codex also has this ability to kind of remote in and control your agent. But the agent has to be running somewhere. It has to be running on your laptop or on a machine in the cloud somewhere.
- 6:22Brandon: And if that agent dies, then you can no longer connect to your work. Right and moreover, it's very hard to share that with other people. But with Pi Durable, it's very easy. It's sort of given to you for free that sessions can be shared or forked between people and you can switch between machines without having to worry that there's some kind of god machine that stays online all the time that is kind of hosting this system that would be if you have Pi Durable running in the cloud somewhere, for example, in a Cloudflare Durable Object.
- 7:06Christine: I could also imagine since Pi Durable is storing like these, I don't know, checkpoints of where the process is, you could also use it in situations where you have like high-stake checkpoints for example, maybe you know you want to make sure that even if your workflow crashes, when it restarts it doesn't resend the same email to your client, your customer. Or if it's like, I don't know, sending a newsletter or posting an announcement that it doesn't do it again. So I would think that maybe for these high-stake situations Pi Durable might be more reliable than your regular coding agent.
- 7:59Brandon: Yeah, exactly like if you're refunding one of your customers with your agent, you don't want to accidentally refund them twice and have your business lose money.
- 8:09Christine: Yeah, that's a really good example.
- 8:11Christine: You don't want to like pay your customer twice so let's take that as a specific example.
- 8:18Christine: Let's say an agent is somewhere halfway through that tool call to pay back the customer and then the process just dies.
- 8:31Christine: What does Pi Durable know at that moment?
- 8:34Christine: And how does it like continue after a restart?
- 8:37Brandon: In order for us to go through this example, I wanna talk a little bit about just how Pi Durable works at a really high level. So Pi Durable completely decouples all of its state from its execution in a way where there's a specific definition for literally every part of the state of the agent.
- 9:01Brandon: And that can be serialized and then recovered at any point.
- 9:05Brandon: And so one of those pieces of state is this effect sandwich that we talked about.
- 9:14Brandon: So basically as Pi Durable is running, it's writing things to that state, like, hey, I'm asking the model for something, the model comes back, I want to make this tool call.
- 9:28Brandon: OK, the tool call came back.
- 9:30Brandon: And so imagine the state at the point that the first refund is sent, The state already contains everything up to that point, including the first part of the effect sandwich that says, I intend on sending a refund and I'm about to.
- 9:55Brandon: And then it crashes. So the next time that it wakes up after a crash, we call it rehydrating the state.
- 10:05Brandon: If we turn some raw state and we make it alive again, we rehydrate it.
- 10:11Brandon: Then Pi Durable will realize, oh the second half of my effect sandwich didn't come.
- 10:16Brandon: So this call it's in no man's land.
- 10:22Brandon: Like, what happened?
- 10:25Brandon: And then it can say, oh OK.
- 10:27Brandon: Well, even though, for example, my session history doesn't include anything about sending the payment or having you know any information about it I need to go and check and say OK like you know I should look up and I should be careful because I'm in the middle of this situation.
- 10:50Christine: And I guess the difference with resuming a session in Claude Code or Codex is Claude and Codex would read the session history and then reason about where it thinks the process died and pick things up.
- 11:04Christine: But I guess the difference is you are very reliant on hoping that the reasoning or thinking is correct and it doesn't accidentally redo something that it might have already done.
- 11:19Brandon: Yeah, Claude doesn't even know where crashes happen.
- 11:23Brandon: There's no mechanism for like marking that in the same way that there is in Pi Durable. You can resume a session.
- 11:32Brandon: But resuming a session is kind of similar to just continuing it.
- 11:35Brandon: Continuing one that has always been running.
- 11:39Christine: How does it exactly look for Claude Code and how does it look for Pi Durable if we put it next to one another?
- 11:45Brandon: So if we're lucky and the reasoning trace that's saved in the session history contains I'm about to send the refund and I should be careful to make sure I don't do this twice, then when you resume, like you said, it probably won't do it twice.
- 12:00Brandon: But if you're unlucky and that's just missing from the reasoning trace, then when Claude resumes, it has no notion of whether or not that refund went through or not. It might not even be in the logs or in the session history, right?
- 12:17Brandon: Basically there's danger.
- 12:21Brandon: There's danger when you're doing these things and
- 12:24Christine: Much more ambiguity because it wasn't purposely built for resuming a session like how Pi Durable is.
- 12:33Brandon: Exactly. And so if you actually were using this in a workflow and you wanted to make it robust, you needed to write a lot of code to work around the fact that this is designed differently but the Pi Durable is kind of built from its foundations because of the way that state is decoupled from execution, where this kind of thing just comes really easily and so I mean the whole Pi Durable in its initial launch is like twelve thousand lines of code which is really small but because it's designed really carefully it enables this kind of safety which is nice.
- 13:17Christine: And how do people use it?
- 13:18Christine: You just install Pi Durable and it just works out of the box? It starts checkpointing right away while you work?
- 13:27Brandon: So Pi Durable is not a tool.
- 13:32Brandon: It's a library. It's a framework so, or a library.
- 13:36Brandon: I don't know so basically it has all of the knowledge of how to run a harness, but it's a function that someone has to call. So out of the box once you download it, you can tell your agent build me a simple interface on top of Pi Durable so that I can start using it in the command line or in my browser or somewhere and Pi Durable doesn't make any decisions for you about where the state is stored and where it's running.
- 14:15Brandon: That's something that it provides a few different like plugins where, you know, Claude can find those and choose one for you or you can choose it you can build your own plugins but out of the box it's not something you can run in the same way that's like standard Pi, Claude Code or Codex.
- 14:36Brandon: Does that make sense?
- 14:40Christine: So what is a good way of using it?
- 14:42Christine: Should we ask Claude Code and Codex to use Pi Durable?
- 14:47Brandon: Yeah. Basically for a specific workflow, you know, like I'll flesh out that refund example you have a system in a mobile app where a user can shake and then give a nasty message to support and say like, I need a refund.
- 15:08Brandon: And you get too many of those.
- 15:10Brandon: So you wanna just have an agent that's running in the background and handling them for you.
- 15:14Brandon: Instead of setting up your workflow in such a way that sending that support message, you know, triggers some machine that you have always running that has a Claude session open on it.
- 15:29Brandon: You have that session rehydrate the Pi Durable state of this support agent that's handling these refunds and then it can perform that work. And that's, yeah.
- 15:42Brandon: And so when you're building that, you just tell Claude for this workflow I'm building, use Pi Durable.
- 15:52Christine: That's cool.
- 15:53Brandon: Then you're basically done. Yeah.
- 15:55Christine: Oh wow.
- 15:56Brandon: You know, make sure you build this the same way you build everything, right?
- 16:01Brandon: Like, if it's something really simple, just vibe-code it. And if it's something important, like it's handling money, maybe you should have long grill sessions, really understand what's happening, make design decisions and then build it out but yeah, like treat it like a library or a framework in the same way that you tell Claude, like, I wanna use React for my front-end.
- 16:29Brandon: You know?
- 16:31Christine: It sounds like the place where those checkpoints are saved is probably quite important.
- 16:37Christine: You need it to recover the progress.
- 16:40Christine: So where is that stored exactly?
- 16:46Brandon: Yeah. Yeah. So out of the box, Pi Durable provides back-ends for storage to like, JSON files or to SQLite objects.
- 16:58Brandon: And it's really easy to build more.
- 16:59Brandon: And I think there's a few more.
- 17:00Brandon: But so it depends on your workflow.
- 17:09Brandon: Let me take a step back.
- 17:11Brandon: Our refund agent, I think it would be nice for this agent to know about all the refunds that are happening.
- 17:23Brandon: And we just want one session and you know, maybe it's happening often enough that it's annoying to you, but it's not so often that like you need to handle a hundred at the same time.
- 17:34Brandon: So let's just have one agent somewhere that anyone in the world who's shaking their phones and sending that nasty support ticket is triaging those requests. And so in that case, you definitely want that state living in the cloud somewhere. And that's a good place for Cloudflare Durable Object which we can talk more about but just to give a like another sort of different choice that you might make in a different situation something that's happening to me that's so annoying all the time now when I'm building is my computer just kind of like grinds to a halt.
- 18:12Brandon: Like it starts freezing and it's slow and it's usually it's like a runaway process like that's leaked, you know, there's too many Chrome tabs, I'm running out of RAM, I'm like doing too many FFmpeg renders or something.
- 18:29Brandon: It's actually a lot of different things that's causing it. At the end of the day, it's really annoying. And this is something I just had an idea about, like today.
- 18:40Brandon: So I haven't built this yet.
- 18:43Brandon: But what I normally do is I go and I open Claude Code and I'm like, hey, like can you investigate and figure out what the hell's going on and like help me fix this? And it takes like ten or fifteen minutes.
- 18:54Brandon: And in the meantime my computer's frozen.
- 18:57Brandon: But what I actually want is an agent that's living on my computer next to me as I'm working always and if my computer runs out of batteries, if it crashes, I don't care. I still want it to be there and I want it to be ready. And I want that state to be on my computer because I use my computer even when I'm not connected to the internet. So I don't want that in the cloud. Right?
- 19:20Brandon: And I don't need to access it from my phone. Like, this is for my computer.
- 19:24Brandon: This is about managing the resources on my computer.
- 19:27Brandon: I want this agent to just always be there and keeping track of if my computer's getting slow or keeping track of all these bad things that are happening and handle them for me.
- 19:36Brandon: So that kind of situation I want the state locally and in our refund example we want the state in the cloud somewhere.
- 19:46Christine: So you mentioned Cloudflare Durable Objects and I've actually also seen a lot of people building something with Pi Durable in combination with Cloudflare Durable Objects. I'm curious, like, what is Cloudflare Durable Objects and why do people like to use it together with Pi Durable? Do you know?
- 20:05Brandon: Yeah. I think one reason is it's another thing that has durable in the name, so people just like tie them together in their brains.
- 20:13Brandon: But there's also real reasons too.
- 20:16Brandon: So a Cloudflare Durable Object is a primitive that works in a similar way to Pi Durable where state is decoupled from execution.
- 20:31Brandon: And so it's a nice fit for Pi Durable so you can think of it as this magic thing that lives in the cloud, in this magical cloud which stores information and you can run code on that information to update it.
- 20:58Brandon: And anyone, anything in the world can trigger it.
- 21:01Brandon: And this Durable Object is smart enough to handle all requests from all around the world, serialize them so there's just sort of one at a time. And then, you know, do that work and apply it to the state.
- 21:19Brandon: And these things can live for you know for months and months and you only pay when you are actually doing the work.
- 21:32Brandon: So when the state is just sitting there it's free or like very, very, very cheap.
- 21:41Brandon: OK? So why does that fit well? Right well if you remember, Pi Durable, its kind of whole identity lives in its state and the state is very well defined.
- 21:59Brandon: And for example, you can serialize it to SQL.
- 22:02Brandon: And there's a nice SQL adapter with Durable Objects. And so what we can do is we can put Pi Durable state in the Durable Object and then allow from anywhere in the world some system to, you know, wake up the Pi Durable agent, it gets rehydrated from its state, it does its work, whatever that is, and then it goes back to sleep.
- 22:35Brandon: So, effectively it's a nice cloud primitive that you can put the Pi Durable agent in.
- 22:46Brandon: It's not a whole operating system.
- 22:49Brandon: It's not a whole big computer.
- 22:51Brandon: It's just enough to basically run JavaScript which is what the Pi agent is written in and so you know it's just enough for what you need for the agent to kind of do its work.
- 23:07Brandon: And if your agent needs to use a computer then it can spin up a computer to do what it needs to do as well you know with Cloudflare with another sandbox provider whatever.
- 23:15Christine: So people who use Cloudflare Durable Objects in combination with Pi Durable. They tend to store the state on Cloudflare.
- 23:26Brandon: Yeah, so a Durable Object is some state and a way to run JavaScript on that state that, like, lots of people all around the world can talk to without the system breaking.
- 23:43Christine: The state plus a way to run JavaScript.
- 23:47Christine: Do you have an example?
- 23:50Christine: Like the payment example that you just had.
- 23:52Christine: How would that look like?
- 23:54Brandon: Yeah. So that's a good example where this makes sense.
- 23:58Brandon: The state of the agent like it's deployed to a Cloudflare Durable Object.
- 24:08Christine: And what is that state in that example?
- 24:10Christine: Is that the amounts, the price?
- 24:14Brandon: Oh no. It's the agent's.
- 24:17Brandon: I'm assuming you have some system for handling, you know, that all the money stuff or you're using a third party or whatever. But what's actually stored is all the state of the agents.
- 24:29Brandon: So it's the Pi Durable state.
- 24:33Brandon: So it's the session history, it's the configuration of the models, it's exactly you know if it was in the middle of a tool call when it went to sleep, all of that is stored and sort of remembered in the Durable Object.
- 24:47Brandon: And so if you're just deploying it maybe you have a system prompt and you've configured some way to wake it up with a network request.
- 24:59Brandon: And so you can imagine, like, when does it wake up?
- 25:02Brandon: Well, when you shake the phone and the user puts in their support request to demand for a refund, and they push the button, that support ticket gets stored somewhere, and as a side effect of it storing, it sends a request to your Durable Object that has the Pi agent state and says, wake up! We have to handle this support ticket and figure out if we wanna do a refund or not, and then do it.
- 25:23Brandon: And then that agent figures it out. If it crashes in the middle, it's OK.
- 25:30Brandon: You can also configure it to check on a heartbeat once in a while to see if it needs to, you know, finish any work. Something like that.
- 25:39Christine: Right. So do people like to use both Pi Durable and Cloudflare Durable Objects, they tend to store the agent's state on Cloudflare plus some instructions or way to tell the agent, OK, wake up and do this.
- 25:52Brandon: Yes. That's like part of configuring the Durable Object is configuring how to talk to it.
- 25:59Christine: Gotcha. Cool. And why is it better to use Cloudflare than other cloud providers?
- 26:07Brandon: Well, specifically this like Durable Object primitive.
- 26:10Brandon: It's unique to Cloudflare. I think Amazon has some version of it as well at this point. But this is nice because it's smaller than a computer basically or some kind of like more heavy sandbox that's running at least parts of an operating system in it. A Durable Object is literally just a JavaScript engine so behind the scenes Cloudflare, they're able to schedule lots of these Durable Objects on one machine or even within a virtual machine.
- 26:45Brandon: I don't know exactly how they're scheduled, but what that means as a user is you pay less money
- 26:52Christine: OK. Because the needs are very lightweight, so it doesn't make sense to go for the heavier options.
- 26:58Christine: This is just a lightweight option.
- 27:00Christine: It's also everything you need in these situations and you also pay less for it.
- 27:04Brandon: Yeah. Yeah. And I guess it's faster as well. It's sort of cheaper in terms of time, money, efficiency, all the nice things.
- 27:13Brandon: Alright. So. So, let me show you an example.
- 27:16Brandon: OK. This is from Daniel Griesser? I don't know how to pronounce his name so Daniel has a very long tweet he's describing building a self-extensible agent harness that can hot-swap and hot-reload even the server run time while continuing to build itself.
- 27:44Brandon: OK? In other words, the agent can make a change, kill itself and crash, and then recover without anything bad happening with its new changes in place.
- 27:57Brandon: This is like what hot reloading is.
- 28:00Brandon: Right? And then he goes on to say like the whole thing is only three thousand lines of code in the core and then you know thirty thousand in extensions. And Pi makes it really easy to have extensions and all these things.
- 28:13Brandon: But I think like what this example illustrates that's really cool is it's leveraging the fact that Pi Durable can recover from crashes easily, to make that a feature of like, let me just crash it all the time whenever I want so that I can change itself.
- 28:30Christine: Just for my understanding.
- 28:34Christine: So he built a self-extensible harness that can crash all the time.
- 28:39Christine: Why does he do that?
- 28:40Christine: Just taking a step back, is he crashing it on purpose?
- 28:45Christine: Does he have a device that crashes all the time, like?
- 28:49Brandon: It's taking this concept of malleability, malleable software, to like a further extreme.
- 28:57Brandon: So this Pi, like the original release of Pi, introduced this concept of malleability which is the software you're using has the ability to change itself and upgrade itself. And Pi expressed this by being able to create plugins and load in the plugins while it's running.
- 29:21Brandon: But this takes that concept to like an extreme where you can change even like the core of the thing.
- 29:31Brandon: And why is malleability cool?
- 29:34Brandon: It means that you can give users like the seed of the thing or as a user, especially as a builder, I want to have like my tool be shaped in exactly the right way as I need it for my task within my project.
- 29:55Brandon: And I don't want it in some generic way that's good for everyone. I want it my way.
- 29:59Brandon: It does everything I need and nothing else.
- 30:01Brandon: An interesting approach to achieving that is to deliver the seed of a thing with a way to grow that seed, to grow that plant, to make the tree that I need or that any user needs for a specific thing. Does that make sense?
- 30:17Christine: I see. So because this agent is improving itself the whole time, there's just a very high likelihood that it might crash, things might break. And that's why it makes sense to use Pi Durable here because it's the best way to set up the agent in such a way that it can restart itself and resume.
- 30:43Christine: Is that right?
- 30:43Brandon: That's a nice bonus, but the main thing is you can't change software while it's running because it's already running I mean, there are ways to do that by like having a plug-in system but then the main software that's loading the plugins, that can't change.
- 31:02Brandon: Ultimately, you have to stop running something for it to change and so if you have a system that's not robust in the face of, like, being killed randomly, then imagine as you're kind of iterating and working on it and wanting to change it, you have to like safely shut it down and then reload and then like you know, replay everything that happened. I mean, you're basically implementing like some kind of durable system at that point.
- 31:37Brandon: So like as you're iterating and changing this seed, you don't have to start from scratch.
- 31:46Brandon: You don't have to, like, reset the state every time because it's durable, like, we're causing crashes on purpose to reload it.
- 31:57Christine: Yeah. There's not a high likelihood of crashes.
- 32:00Christine: It's just a necessity in the process.
- 32:02Christine: And that's why it makes sense to use Pi Durable because there will be a lot of restarts or hot reloads.
- 32:11Brandon: Yeah. That's the idea with this experiment.
- 32:13Brandon: But I think it's really cool.
- 32:15Christine: Cool. Yeah. It makes sense to use Pi Durable here.
- 32:19Christine: That's a cool use case.
- 32:20Brandon: OK, I'm gonna show another example.
- 32:23Brandon: So Earendil, the company that makes Pi wrote a blog post just a few days ago that is a tutorial for building a Pi Durable agent in a Durable Object, something that we talked about before. But it's specifically telling you how to build a chat agent with multiple participants connected to the same chat session.
- 32:58Brandon: So this is something that's really cool that's hard to do otherwise, but Pi Durable makes it really easy, which is multiplayer. There.
- 33:06Brandon: That's the thing.
- 33:13Brandon: So the Pi Durable like we said, it's just some state, and you can rehydrate that state and do something and then go back to sleep. So if you put that state in a Cloudflare Durable Object, remember we said it's living in the cloud somewhere and it can handle requests from all around the world concurrently and the Durable Object primitive from Cloudflare knows how to sequence these things so that, you know, it all works and like things that are happening all around the world can all act on the Durable Object one at a time.
- 33:50Brandon: And so if you go kind of backwards, well that means that you can have one person in Australia on their phone and one person in the United States on a laptop and you can connect to the same Durable Object that's hosting your Pi Durable state that's running your agent and talk to it.
- 34:11Brandon: And you know whoever goes first goes first and then you know the messages go in. You could even steer the agent mid-conversation. Does that make sense?
- 34:23Christine: Oh, that's super cool. So Pi Durable, you know, it's not only like really nice when you need the robustness of recovering from a crash and resume a workflow, but it's also really helpful to do multiplayer vibe coding I guess.
- 34:43Brandon: Well, multiplayer anything. Yeah. Yeah, I guess this would be a multiplayer ChatGPT clone but you could also build a multiplayer vibe coding system or anything else that you'd use with agents. So.
- 35:00Christine: That's very cool.
- 35:01Brandon: Yeah. And then one other thing so this is a post from Mario Zechner, the original creator of Pi.
- 35:12Brandon: He now works at Earendil.
- 35:13Brandon: In his tweet he describes that he's replacing Claude for Android with a little Pi Durable thing, that's his words, that runs fully on his phone except for the actual model call, right?
- 35:27Brandon: So this is cool, right?
- 35:28Brandon: I think we maybe didn't say this exactly, but remember, since Pi Durable is just like some state, it's like the state is very well defined and then there just needs to be a little bit of logic that can kind of run to drive that state, to you know, do the next step of your agent and that runs in JavaScript.
- 35:49Brandon: And so if you have a way to store the state and you have a way to run JavaScript, then you can run it.
- 35:55Brandon: So what Mario did is he put that state on his phone and he runs that JavaScript in an app on his phone and then there it is and this would be hard to do otherwise to take an off-the-shelf harness even if it's written in JavaScript and get it working in a native app, for example but Pi Durable, you know, makes that easy.
- 36:24Christine: Because, you know, if you wanted to work in a native app, what would you need to do instead?
- 36:29Brandon: You have to build an agent, basically.
- 36:34Brandon: And apps they are suspended a lot and they're evicted and shut down all the time by the operating system or the person runs out of batteries on their phone or whatever. So if the agent that you're using on that device is not durable then you're gonna have a hard time with it and then yeah like we said like without Pi Durable if you wanna build a durable agent if you take like an existing normal agent as a starting point, you have to write a lot of logic to make it safe or you can kind of re-architect the thing from scratch and then you end up with something like Pi Durable.
- 37:12Christine: Gotcha. So you know if Mario would have used OpenClaw here, it wouldn't be durable. And if you wanted to make his OpenClaw durable then he would have needed to write a lot of code.
- 37:27Christine: But basically with Pi Durable you could just have it working right away on your phone in a very easy way.
- 37:33Brandon: Yep. Exactly.
- 37:35Christine: I love these examples that you showed.
- 37:37Christine: They all use Pi Durable in a different way I wonder have you built something with Pi Durable as well?
- 37:45Brandon: Yeah, so I was trying to do an experiment.
- 37:49Brandon: OK? So I used Pi Durable, I put it into a Durable Object.
- 37:58Brandon: And what I'm curious about that I haven't seen anyone play with is the fact that the Pi Durable state is very well defined. And I mean it has to be because, you know, the way that you store it is configurable and the whole point is that it can rehydrate itself from that state to run. And so what I thought was like, is there something that we can do with that state without actually waking up the agent to do something and move the state forward?
- 38:31Brandon: So could we somehow digest that information and visualize it to a human or to an agent so you know what's in that state right?
- 38:41Brandon: It's like yeah there's a conversation history but you can get that from any harness.
- 38:48Brandon: The things that are interesting inside of Pi durable's state is we know all of the tasks that ran and which ones were aborted, which ones did, like, a crash happen? And so obviously, like, this is a function of what your agent's doing, but you're able to easily, you know, one could imagine for our refund agent that you could visualize well how often refunds are happening but also like how often you're trying to do them and something's going wrong, like the payment provider or something like that.
- 39:23Christine: Yeah. How efficient your agents performed or you know did this. Maybe you know maybe you know that it worked, the payments went through correctly, but you don't know during the process how many times the agent might have tried it.
- 39:38Brandon: You don't have to reverse engineer that from like the different surfaces that you're touching you know, you can get that all from the information of the agent or like multiplayer, like if we have multiplayer, how do we keep track of what's going on and you know, can we visualize who's doing what and when and how? And that might be important you know if you're building a chat bot that has the ability to do something you know, it's something you might wanna keep track of.
- 40:10Christine: Yeah because previously you know we never had such detailed information about every task but because Pi Durable just inherently already logs or keeps track of every checkpoint.
- 40:21Christine: You suddenly have a new pile of data that you could use to build new things on top of it.
- 40:29Christine: And I think it's a good point with multiplayer as well what you said because when it's multiplayer you might want to have the data to analyze like OK, which agent from which person in this team, you know, performed well?
- 40:44Christine: What configurations did they use and what made it perform better?
- 40:48Brandon: All of these things really, like you could add extra code to handle, but it's just nice that it's all there.
- 40:56Brandon: It's all there already for you to mine and that's interesting.
- 41:02Christine: Yeah, that's a really good point. I love all these examples you've shown and also this idea.
- 41:09Christine: Feels like you could do actually many different things with Pi Durable. More than I imagined on a first impression.
- 41:17Christine: Thanks, Brandon.
- 41:19Christine: I think that's a really interesting shift here.
- 41:22Christine: So we're going from giving coding agents individual tasks to building workflows where agents can take on ongoing responsibilities.
- 41:31Christine: And Pi Durable gives us a new primitive for that.
- 41:35Christine: So there's recoverable execution that we can now build on without having to implement all that durability ourselves it enables multiplayer interactions with the agent since you can now make the persistent state accessible to different people through Cloudflare Durable Objects and also accessible to different applications and events. And it's also way more transparent to inspect tasks, tool calls, and any other state or actions that the agent has done and it's easy to run it on your computer, phone, web browser, anywhere.
- 42:09Christine: Alright, hopefully this episode gave you all some ideas for new durable agent workflows you could build so you can also confidently delegate more work to your agents.
- 42:25Christine: We'll be back next week with another emerging practice for building with coding agents and we hope to see you then.