Time-Travel Filesystem for AI Agents: Durable State with Event Sourcing and Append-Only Logs
Summary
- Single-Writer Log Architecture: Single-writer durable logs avoid slow remote round-trips by treating local agent state as authoritative while asynchronously persisting mutations to durable storage.
- Event Sourcing: Representing agent state through deterministic mutation events enables instant time travel, branching, and replay without manual snapshotting or complex state coordination.
- Fast Rehydration: Lazy-loading decouples metadata event streams from heavy data blobs, enabling container reboots to replay tens of thousands of agent mutations in under one second.
Time-Travel Filesystem for AI Agents: Durable State with Event Sourcing and Append-Only Logs

A time-travel filesystem for AI agents makes agent state durable by recording every file mutation in a single-writer, append-only log and replaying it with event sourcing. Agents can then survive container shutdowns, pause and resume, branch for reinforcement learning and be debugged step by step, even in hostile serverless environments.
The speaker from Modal explains why point-in-time snapshots are slow and manual, and why multi-writer stores need remote round trips. He then presents Over Easy, a FUSE overlay filesystem that treats local state as authoritative and asynchronously appends events to a durable log on S3: about 200 ms P50 durability lag and 750 ms rehydration while replaying more than 90,000 mutation events, with lazy loading of file blobs. The immutable log also gives time-travel debugging UIs, full lineage tracking and the ability to kill corrupted descendant agents, which answers how to monitor, trace and host agents that act on data.
Chapters
00:00Introduction01:04What is Modal? Hosting agent harnesses on serverless containers02:18What does state mean for AI agents and reinforcement learning?03:24Why serverless is hostile to agent state05:21Durability approaches: snapshots vs multi-writer stores vs single-writer log07:45Event sourcing explained09:26Event sourcing for agents: branching and forking10:04Observability: time-travel debugging and lineage10:55Over Easy: a FUSE overlay filesystem on an append-only log13:14Crash recovery with replay mode and lazy loading14:05Performance: durability latency and rehydration time15:45What's next: durable objects, memory and serverless SQLite
FAQs
Why is state durability critical for autonomous agents in serverless containers?
Serverless environments are hostile to state due to timeouts, preemption, and operational errors. This video explains how single-writer append-only logs make agent state durable across container reboots and failures.
What is event sourcing and how does it enable time travel for agents?
Event sourcing represents state through deterministic mutation events, enabling instant replay, branching, and time-travel debugging without manual snapshots. This video demonstrates these capabilities with real examples.
How does lazy-loading improve performance of agent container rehydration?
Decoupling metadata streams from heavy data blobs allows containers to replay tens of thousands of agent mutations in under a second. This video covers architecture details and performance benchmarks.
What observability benefits does immutable event logging provide for agents?
Storing all agent actions in immutable logs enables auditability, time-travel debugging interfaces, and the ability to kill corrupted descendant agents. This video demonstrates full lineage tracking capabilities.
Full transcript
00:00 Introduction
Hello everyone, how we doing? We are presenting a time travel file system for agents. Who read the origin blog out of cursor their cloud hosted git. It sort of sparked off this whole rave for write ahead logs backed by S3 and that's what we're using here. I'm going to be presenting on that. I think it's fun stuff. Uh as Andre said background on myself, I work at modal. I work primarily on the sandboxes team. We run a little team called agent runtime that I'll get into later and been there for about six months after our previous sandboxing company was acquired.
Agenda today we're going to go through some slides and present the team that we're working on. talk about what state means when it comes to agents and reinforcement learning and then we'll jump into event sourcing a technique used with appendon logs in order to track state immutably uh over time and give you time travel capabilities I think is really interesting in applied to agents um and then we'll talk about over easy which is a file system overlay that we've built on top of these principles to give you uh basically durability time travel for your agents.
01:04 What is Modal? Hosting agent harnesses on serverless containers
Well, who's used Modal or at least knows what Modal is? For those who don't, it's a container orchestration platform. You basically deploy your code up to us. We turn it into serverless functions similar to Lambda or you could run coding sandboxes on us with your agents. Uh two separate products there, but it's all container orchestration in the end. And our goal is to figure out how do you make it way easier for agent harnesses to be hosted on modal with all of their complexities because they have a whole bunch of different interesting intra concerns that I think traditional software doesn't have.
The best place to run agent needs state. How do we add state to an otherwise serverless product? Really hard question. We're trying to solve that. Secondly, open ecosystem. We are not say the open codes of the world where we're not going to go out and claim that we have the best harness or we're not the omnijet. We're not going to be able to claim that we have the best meta harness. We want to support thirdparty harnesses and allow people within the ecosystem to come in with their best approaches.
So that means we need to support agent runtime at the runtime level. No explicit APIs. You would also through like the file system for example. What does state mean for agents and reinforcement learning? Basically, an agent has a starting point and then it goes from that point onward. It is accumulating what I consider a globally unique view of files, context, windows, it tools, user interactions, even active processes.
02:18 What does state mean for AI agents and reinforcement learning?
All of this are, I think, uniquely distinct to agents in that they're kind of actors. They're singletons. They're single instances of state. Uh we'll call this capital S state throughout the slides. U it could mean pretty much anything. and then later we'll be talking about it in the context specifically of file systems. But I'm going to be presenting on state as a general concept here. Agent state has a few challenges.
One, it evolves in ways that you can't plan for. Again, we need to support all of this from the runtime level because the trajectories of these agents are not programmed at runtime. Sure, you could give them tools that hook into some explicit APIs, but as tools develop more and more to use just say bash as the interface, we need to figure out how to support that generically, transparently. Secondly, agent state often outlives containers and can get into all sorts of weird branching forking behavior later.
03:24 Why serverless is hostile to agent state
And you know, from an infra concern, that means we need to have durability. We need to have that state last from one container to the next and not die when the container shuts down. Serverless compute is a very hostile environment to state. This is very sad to my team and we're trying to fix that. Firstly, serverless containers can shut down. That's kind of the point. They are serverless. Timeouts, out of memories, preeemption.
Maybe you just want to scale back your compute when you're not using it. Why would you have a sandbox laying around for hours if user is not interacting with it? Ideally, you can shut it down. And lastly, there's operational error. You know, things happen. Data centers get struck by lightning. We had a heat-based outage in a data center a bit ago. Um, sometimes people just pull the plug. This happens. Uh, the state needs to survive.
It's going to be a term we call durable, which means it's persistent. It lives forever. You could trust that it's there. Durable state must live across reboots for agents. So, here we have a sandbox. We call them tasks. Don't worry about that. But we have a sandbox. And across a pause and resume, that state must be able to be durable. must carry from one sandbox to the next sandbox. Even more complicated, reinforcement learning, branching.
If you're very very deep in a trajectory and say the model is reward hacking or doing something strange, you need to be able to train around that very specific instance. So deep into a trajectory tree, you may end up doing a bunch of branching in order to explore around. So durable state must also be able to branch and share say a prefix but not necessarily a suffix. Interestingly, and I'll explain this a bit more later, in the eyes of the LLM, it is a single linear history, the LLM see effectively an appendon log of events that have happened, ways it's interacted with its environment.
And when you flatten it down, it ends up just being a single line, sometimes with shared prefixes, but a single line. Approaches to durability effectively. How do we take this pause and resume and actually provide that at the runtime level? One approach, and this is the common standard for modal and a lot of uh sandbox platforms, is point- in time snapshots. You need to write code in your harness that says, "Hey, at this moment, we're going to snapshot the state, maybe shut it down, and then come back later, resume it."
05:21 Durability approaches: snapshots vs multi-writer stores vs single-writer log
That's great, but there's a few issues. One, it's slow. You're basically taking all of the accumulated context and reactively compressing that down, maybe bundling it up and pushing it up to durability. Uh, as well, it's manual. Again, you need to plan for this sort of thing. And say the box out of memories or maybe you don't have a handler sitting around uh watching the liveless of the box, there's a chance that you can't call snapshot before the container exits.
Therefore, you lose all your data and after 24 hours is the max runtime of a sandbox on modal. You don't want to lose 24 hours worth of accumulated file system data. So, that's bad. Then there's multi-riter durable stores. Uh modal has a product called volumes. It's basically a multiple file system. Uh there's a few other products, standalone products that are built on this as well. Uh these are slow because they treat the remote tier effectively S3 as authority.
That means, you know, if you have multiple writers, if one does a right, you may have race conditions in the other one doing a right in a read. So you need to make sure that you're roundtpping to remote store every write and maybe even every read in order to have consistency. Um the issue as well is it's a mutable state. It is a mutable state. Um so once you create or once you do deletions that data is gone. Um and it's on version so you can't recover that data.
We're going to be focusing on the single writer durable log. Uh by being single writer we don't have to worry about those round trips because local is the authority. We know that nobody else is writing to durable tier. Therefore, we can just in the background append to the tier and we're good to go. And it's immutable which gives us time travel. We'll be talking about that. And importantly as well, it's implicit. We don't need to do any round trips.
Therefore, we can just run it in the hop half. A user doesn't really see much degradation of performance. And within 50 milliseconds, every mutation that happens within your state as like a generic concept of state can be made durable. With this approach, we're going to be talking about event sourcing. Now, event sourcing is the formal name for this approach, which is effectively taking state, a mutable piece of state, and instead of mutating the actual like record that holds that state, you are instead representing it as a series of mutations against a state machine, a deterministic state machine.
07:45 Event sourcing explained
And that allows you to say apply add a box, add a diamond, add a circle, and then subtracts a diamond and box. And at every step of the way, that mutation is able to apply. And then if you want, you could go to a specific time stamp and just apply the events from the base state up to that time stamp. And since it's deterministic, you perfectly reconstruct that state. And that allows, you know, multiple clients across multiple clouds to reconstruct a state at any point in time using this approach, using the immutable log as the storage format for whatever state you're trying to represent.
And you do that with a state machine and a series of mutation events. Snapshots then become implicit. A time stamp is all you need in order to have effectively a snapshot because the time stamp into the log is just the point up until which you replay. If you wanted to do, you know, forking, for example, you just replay up to that point. You gather that prefix into the state and then you branch off and you introduce a new trajectory.
Uh timestamps, very simple. I'll be showing you that later. This maps very well onto these graphs I was showing you before. Um LLM see it all as a single history, but it actually ends up being a tree. The more you add branching, reverse, pause and resume, uh it all just ends up being a big big immutable log. Agents and reinforcement learning may be event sourced. Uh an instance of state is basically just a branch in the tree.
09:26 Event sourcing for agents: branching and forking
Again, pause and resume. You're continuing from the tail of an existing branch. And then with reinforcement, you're going back to a previous point, branching from there. Branches, we call them sessions here because like a session kind of maps well to the way we treat chat completions API and chat history where a session is just kind of an instance of a conversation. It's globally singleton. um you could branch from them or fork from them.
Um but in the end it's like a single instance of you know a series of things that have happened that's a session. Relevant to this presentation is the observability side of things because all of the mutations to the state are stored in the log that allows us to like do a bunch of interesting things. You can build time travel UIs uh to help users debug exactly what's going on or in reinforcement learning. It allows you in your researchers to go in and figure out exactly what the models did by literally looking at it similar to a time travel debugger.
10:04 Observability: time-travel debugging and lineage
Uh you could also see if certain reader write paths are heavily exploited or you could place protections on those right paths as well. And then lastly, if you ever detect any issues, you have perfect traceability of the lineage of all of these agents. If there's a crazy branching pattern, you could track that down to the exact moment uh within the log where things got corrupted and then you could kill all the agents that are descendant from that.
10:55 Over Easy: a FUSE overlay filesystem on an append-only log
Over easy is a file system that we've built on top of this. The file system is a fuse overlay file system in user space. Um, that basically means we run a server that mounts over a directory within your environment and any changes to that directory are instead captured by our server and served as if it was a proper Linux file system. Uh, it's an overlay. So you can just run this on top of whatever base image you have and we only capture the difference.
It's a copy on the right. Um and then we treat these with the appendon log approach of treating local state as a authoritative and then async whenever mutations happen we push those off to a durable log in S3. Um absolute worst case you're seeing half a second lag between durability and the local state. Normally you're seeing around 100 200 seconds or milliseconds. Uh and then on reboot you simply repay the events as we talked about with event sourcing.
Uh it also comes with a CLI lazy loading. I'll show you all that in a second how it works. So over easy again it's a little fuse module that lives in your server in your sandbox wherever your agent is running. It has a server mode which means we're exposing a fuse mount on a directory. Anything going in and out writing reading from that directory is going to be proxied into over easy. Say a write event lands. What happens next?
We immediately service it in the local state. the local state for a very brief period of time is drifting from the durability tier, but immediately we are appending it to an appendon log on S3. I want to give a shout out to S2. dev and you basically just write the mutation event. In this case, it's an enum a write event that contains the blob of the contents that have been written as well as whatever metadata you need.
And then you just append that to the end of the log. This is a simplified view. In practice, we actually separate the blob and the metadata event uh for reasons basically to like dduplicate data and make it so that if you add a file and then delete that file, it ends up getting clobbered and you don't really have to worry about reading the blob itself when you read down the metadata. Um, but in practice, it looks like this.
First, put the blob to S3 and then append to your durable stream, durable log. As said before, your container can die due to user error, due to timeouts, due to somebody unplugging the server, a lightning strike. Now, we're in replay mode. We need to recover this state. We read the session, which is a stream, you know, a single log on S3 from head to tail and apply those events in the deterministic state machine in order to rebuild the local state.
13:14 Crash recovery with replay mode and lazy loading
Then we transition into server mode. It's a two-step process. replay mode, server mode, and then in server mode, we start serving events. And again, because we've decoupled the blobs themselves, the actual write content in S3, we don't need to pull those down until they're actually accessed in uh server mode, which makes replay mode really, really fast. You're just pulling down very lightweight events and constructing an in-memory representation of the file system.
This is what it all looks like end to end performance. For those who are curious, um again there is a lag due to the fact that we're treating local state as authoritative. We could trust that we could async write up to durable tier because it's single writer, but there is a lag. Get about 200 milliseconds P50 average on every write event that comes through um P90, 310, P99, 370 milliseconds. So basically the worst case scenario if you're snapshotting and you want to be absolutely certain that the state that is in your box is made durable on S3 half a second effectively that's all you got to wait and we have an explicit checkpoint command to flush fully up to durability overhead versus native fuse naturally introduces some overhead for example an npx create next app workload takes about you know 2.
14:05 Performance: durability latency and rehydration time
4 four times as long as a native, you know, just Linux file system. Uh, npm rundev from ser from page cache is 160% of native. For some reason, directly from disk is slower or sorry, faster and don't totally don't totally know why that is, but we'll figure that one out. And then naturally, since we're shifting a lot of the the cost of snapshotting to the resume, the replay phase, we're repling those events. You may ask like how much latency does this introduce?
Uh for an npm rundev like a workload that has run an npm project before shut down and now we're rehydrating it from the appendon log. 750 milliseconds worth of latency that's gathering more than 90,000 total mutation events and applying them to our state machine. Uh we can get this much faster but this is where it is right now. Most of that is just fetching the events themselves. The application is pretty quick. Again remember this is more than just the file system.
15:45 What's next: durable objects, memory and serverless SQLite
The approach we're highlighting here is durability for any agent system. We think appendon logs are very very interesting applied to these global singletons. You know, a type of workload we haven't seen before. Uh so we're going to be working, my team in general is going to be working on things like durable objects, other memory retrieval systems, serverless SQite. Uh all these sort of things are within scope for us to work on.
It's going to be super fun.
Learn more about the Databricks Data and AI platform.
The information provided herein is for general informational purposes only and may not reflect the most current product capabilities or configurations.