resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant resonant The topic of today is what it takes to set intelligence free. Really, for us, this takes us back to when we started three years ago. I have to say that I have a complicated relationship with agents. And I'll tell you why. We almost failed as a company because we thought back in 2023 that agents are the future, so let's build for them now. I think we turned out to be true that they were the future, but we were definitely wrong on the now piece in 2023.
So this was back in GPT-4 days. And at that time, the intelligence was simply not there to have more of these complex agentic systems. But now it is. Now the intelligence is actually at a place where you can really build out more complicated systems around them. And so I'll give you a quick background story here of our journey in working with intelligence or these LLMs. And so back in 2023, we built the first version of our product. We called it GPT engineer back then. And really the UI was very similar to what it is today where you have a chat and this preview. But the AI at that point was quite simple. We just had a prompt and a response, one LLM call per user message.
Very simple. It worked fine. But you could build one-page apps and simpler applications with this. And then we thought, okay, this intelligence is going to keep on evolving. So we have to be ready for it as it evolves. And so we thought, let's go out and build this agentic framework. And so we went and we built this very sophisticated, beautiful framework for agents to work. And we had this one main agent that would talk to the user and that agent would spawn other agents, like an implementation agent here in the example. And each agent could have a speciality. This agent would specialize in the first generation of an app.
And then you would have a frontend agent and a backend agent. And they would all talk to each other, send messages back and forth. And we thought, oh, this is beautiful. And there were papers around this and how well this could work. And in the end, it didn't work at all.
We just made the product worse. We definitely failed on this one. But luckily, before we ran out of money, we figured out, hey, let's go back to a simpler system again. So in late 24, we went back to a much simpler system where it was a bit of a chain where we had some smaller LMs doing some knowledge retrieval. And then really just one main LM writing to the user and writing the code in the same message. And this worked great. It was very responsive for users in the UI. And it was reliable. And users were iterating with the model.
And so let's close that down. But now it's time again. We're back. We're so back. Agents this time, they work. And we're running them in production over a billion tokens per minute on these systems that I'm going to talk about. But first, just looking at what is actually lovable? So if you simplify the UI, and this was the same back in 2023 as it is today, to the left we have a chat where humans come in and they describe their intent to build or whatever they want to do. And to the right you have a preview, which is the output or the outcomes of what you're building. And this back in 2023 you could do simpler things with, right?
But now we've really seen working at this layer of abstraction, we're able to build very complex things, right? And I think we've even seen a lot of tooling meant for developers, for example, moving to this type of interface where you're not really looking at the code every day and so on. And you're getting attracted and working on the architecture or looking at some output of what you're doing. And this is something that we've always believed in. And it's been a core thesis behind Lovable that you won't have to care about the code in the same way that you had to do before.
And I think today we're in this almost in between, I think, in the industry where some people might say, oh, you don't have to care about code at all. And some people might have different opinions. And I, of course, growing up coding and these things, you get a bit attached. But in the end, what matters is actually not the code. Sorry, I thought we removed that last part. But what matters is the outcomes, right? And so the outcomes, what is that? Well, for our users, the outcomes is creating a business and monetizing and creating value for others in some type of way.
And I'll go over what we build as a platform to enable this before I go on the technical side of this talk. So if you look at Lovable, the first thing that you can say about the platform is that we have this agent. And like any other agent, it can do quite arbitrary things. And it's quite specialized at building software. And it has access to a browser so it can verify what it's building. And it connects to GitHub.
And it writes code. And you can do whatever you want for that code. So that's your basic coding agent. And the other pieces of the platform is this cloud and business piece of the platform. And so the cloud part of the platform is about giving these hosting primitives seamlessly to this agent. And so we built out databases, authentication, storage, all the types of back-end compute and security scanners and backups and logs for all of these things. And all of it can be introspected by the agent. And this just makes it seamless to build things. You don't have to go to different services to set this together. We just provide you these primitives.
So that's still around building software and hosting this, right? But then the last piece is around these business capabilities where the output of what our users are doing on Lovable, we don't see that output as code. The output is a product or a business. And if you want to succeed as a business, you need to do more things than just write code, right? And so we help our users with receiving payments, sending emails, optimizing SEO, doing ads on Google and Meta, and analyzing what is happening with the product through analytics. And you can look at conversions and optimize these sort of things. And the agent is in the loop in all of this, right?
So that's our capability offering, you could say. Again, the core part of this is an agent that all of these capabilities are built for. And at some point in Lovable's history, we used to limit our agents to work for only 30 minutes because we thought they weren't reliable to work for a longer amount of time. But now we've changed this to really be without any sort of bound in terms of the length an agent can work. And so you can imagine agents working for 10 hours plus. And so I'll go into some of the things that we've done in our architecture to enable this.
And so the first piece is really around the agent runtime itself and how we enable that to run for a long amount of time. And the second piece is the computer where each of these agents are actually doing their work, running a dev server, and then actually verifying what it's doing. And so the last piece then is the verification itself where if you want an agent to work for a long amount of time, you need to make sure that you have these feedback loops in place so that it's not going off in the wrong direction. And so if we start by looking at the agent runtime itself, you can imagine that you have really three different sources that can interact with an agent.
So it can be yourself prompting this or a human. It could be other agents. And it could also be just a system on a schedule waking up. And the way we chose to architect this is that for each agent, we have a separate inbox where any of these sources would send in messages. And so you might have a message here like, what's the status? And you can imagine you have this agent. And this agent is an always on agent that might be working, right? And so you can imagine it has done three actions here, a request, a tool call, and it got some result. And then at this point, the agent is ready to actually receive messages.
So since anyone can drop a message into this inbox, the agent then can copy that itself into its own what we call a trajectory. Basically, it's task history.
So it can be yourself prompting this or a human. It could be other agents. And it could also be just a system on a schedule waking up. And the way we chose to architect this is that for each agent, we have a separate inbox where any of these sources would send in messages. And so you might have a message here like, what's the status? And you can imagine you have this agent. And this agent is an always on agent that might be working, right? And so you can imagine it has done three actions here, a request, a tool call, and it got some result. And then at this point, the agent is ready to actually receive messages. So since anyone can drop a message into this inbox, the agent then can copy that itself into its own what we call a trajectory. It's task history. And this is the type of interaction that I think you're familiar with if you're using agents overall. So that's the first design principle behind this agent runtime. I'll go through a few more here.
And so the trajectory in which the agent is working in, which is the history of what has happened so far, and really the basis for any sort of memory for the agent, right? And we designed this trajectory with Git as inspiration. And so the trajectory, what is it? It's an append only log where each event points towards a parent, the previous event. And because of this, you get a nice capability just like in Git where you can fork things, right? So you can have two events pointing to the same parent, which essentially creates a fork. And because of that, you can spin up parallel agents at any point of time in the history without having to duplicate all of the shared history. And semantically, it's a bit unclear what would happen if you merge this. So unlike Git, we cannot merge agent trajectories, but we can spawn them outright and these agents can talk to each other.
The other thing that we made sure to design for is that this agent trajectory includes the full history and everything that happens with the agent. And so every tool call, a bunch of other things happening on the platform if a tool call failed or succeeded, and a bunch of things that might not be fully relevant for a prompt. But then what we've done is to make sure that we have this append only log. And from that, we can actually build a prompt that we would feed into the actual LLM. And you might ask, why would you want to do this? Well, one reason is that when you build a prompt, if you have a long history, you probably want to do some sort of compaction. You want to summarize part of that history in the earlier steps, for example. But this summarization would differ. For example, if you use different models with different context lengths, you would probably think differently about when you should summarize or not. And so by separating the prompt from the actual task history, we're able to render prompts for any type of model or any type of task that we can find the best and optimal prompt for.
So to show this event history in progress, we have this debug tool here. So here it's just a recording of me dragging this slider in our UI. And you can see on the right that the UI is updating as I'm dragging this along. And you have 156 events here. And each of those is an event in this event history. And you can see how the UI can render any point in history. And this is just showcasing that at any point in time, we have full control of the UI or anything else happening on this platform, thanks to this history detailing everything that has happened.
The last piece I'll go over here on the runtime itself is that the process that is running these agents is separate from the actual task history. And so the process is almost entirely stateless in that between each call, each tool call, each turn, it will actually just persist into the task history. And so you can have a process common goal. And then the question is, why do we care about this? Well, at Lovable, this system, we deploy to it 700 times per day. So that's about once every two minutes. And you can imagine if you have an agent working for 10 hours, you want to not disrupt that agent when it's working, right? This agent is doing something for a customer. But at the same time, we want to make sure that this agent is running on the latest deploy. And it might be a new feature or something like that. But it might also be like a security vulnerability in the Linux kernel. And it's like, okay, we need to update this ASAP. And so to do that, thanks to this separation between the actual history and the processes, we can actually make sure that we have one agent that is working on one task. But we can have different processes taking up and actually doing the compute behind that work. So this task can keep on working while we have different deploys working on it, be it for 10 hours or even longer, right? So that's the agent runtime.
The second piece of this platform, right, is the computer. So this is where the work is actually happening. And we've been through a lot of iterations and a lot of vendors working with providing these sandboxes for the computer for the agent to work in. And we've landed in the system that we've worked really hard now to develop, which is checkpointing a computer. And so you can imagine you come to Lovable, you start a new project. We have this common what we call a golden checkpoint, which contains the OS and the system services. It has common tools installed and a dev server that is ready to start. And this checkpoint includes everything on disk, memory, and also running processes. And so when you start a new project, you get all of that for free. And all of that is copied over in about 230 milliseconds. And so once you start a project, you might have some specific code and some dependencies within that project. And that is also checkpointed as you go. And so each time the agent is running and it finishes a turn, we will actually save a checkpoint of that computer. And from that, we're able to, again, very quickly, sub-second, spin that computer up whenever you need it. That means we can save on resources by spinning this down if you leave for, say, 10 minutes or so and come back. We can just spin it up extremely quickly so you don't even notice this. And even requests in transit will not even be dropped in this setup.
The other thing we can do thanks to this checkpointing is that just like the trajectory itself in the agent runtime, we can also fork the computer. And when we do this, for example, we have a feature in Lovable that is called drafts where you work in different environments of what you're doing. And to support that, we need to fork the computer that you're working in. And here we have the example of doing two at the same time. And you can imagine doing hundreds of these, right? And so we've had to do some optimizations to make this feasible to actually run.
So one of these optimizations is copy on write on the RAM itself. And so creating one of these forks of a computer is basically free in terms of the RAM that it's using. But as soon as you start writing in a process to RAM, we will copy that page over. And only then will you start having to allocate new memory.
And there's another optimization here also, which is that each of these sandboxes require a few hundreds of megabytes of memory. And that would take a few seconds to stream in if you have it in cold object storage. And then it has to go to disk and then into memory of this VM. But thanks to being able to stream the memory, we can actually boot up the machine before all of the memory is actually ready on it. So the memory that always uses comes first. And then some processes and so on will start to work as soon as the memory gets there. And this also shaves off some extra startup time.
And then we started asking ourselves, how can we make this even more efficient and even more faster for our users? And so you might be familiar with Vite. It's this great dev server that most of the meta frameworks out there in the JavaScript ecosystem is using. And so we took that and we forked it and we rewrote it in Rust. And that made our code starts two times faster when we went from getting this preview from 14 seconds to three seconds. And the main thing that we made faster is that Vite uses Node.js. And we were able to drop that dependency off Vite itself and just have this Rust binary. So that made the memory footprint be 6.5 times less in these machines. And by taking control of the applications that we're running in these computers, we're also able to control how we write to memory. And so when we control how we write to memory, we're even more optimizing if you remember back to the copy on write solution when we're drafting different computers. And so we're able to run this extremely efficiently so that we can run lots and lots of agents in parallel and agents can explore different solutions to solving a bug or improving the performance of your applications and so on. And so this has been fun.
And that made our code start two times faster when we went from getting this preview from 14 seconds to three seconds. The main thing that we made faster is that Vite uses Node.js. We were able to drop that dependency off Vite itself and just have this Rust binary. So that made the memory footprint be 6.5 times less in these machines. And by taking control of the applications that we're running in these computers, we're also able to control how we write to memory. And so when we control how we write to memory, we're even more optimizing if you remember back to the copy on write solution when we're drafting different computers.
And so we're able to run this extremely efficiently so that we can run lots and lots of agents in parallel and have agents explore different solutions to solving a bug or improving the performance of your applications and so on. And so this has been fun. But the last piece now is about verification. And of course, this computer and this dev service is a big piece of being able to verify what an agent is doing. And if you look at verification, you can think of these feedback loops, right? The agent needs to get information. It took an action. Was this a good action or was it a bad action? And you can think of it as this inner loop and this outer loop.
So this inner loop is during the turn of the agent. And you have obvious things such as the build working. Do we have lint errors or type errors in the code that we're running? And then you can check for runtime errors in the preview that you're running. You can also have within this computer a headless browser where the agent can explore the web app it's building or whatever it's building, right? And a bunch of other things that we're using to help verify within the turn of an agent. But then you also have this outer loop, which is between each turn and the turn you can think of as when the agent is yielding to you as a user.
And between each turn, you might get some info on the product itself from production from your users, right? And so you can look at how your visitors are behaving, what users are telling you online. You can do automatic A-B tests and actually change some copy and see if it's improving conversion and so on. And then you can also take these business metrics. And remember, this goes back to the capabilities I showed you. By having control over these things, we can make sure that we can optimize how the agent is getting this outer feedback loop.
So we can make sure that if you're running payments, we can actually track those transactions and conversions and make sure that the agent can actually help you optimize not only the code, right, but the business strategy around your product. And so those are really the three things that we've been working on. And we'll continue to build out these capabilities and this architecture around really orchestrating these LMs into agents. And so this agentic system that we're building is running billions of tokens per minute. And these computers, right, we can spawn up with each agent and we can have multiple agents use one computer.
And now we're back to this quite beautiful setup where you have agents talking to agents and they're orchestrating. And this time it's actually working. And it's working at scale thanks to some of these optimizations. And so if you're curious to try this out, you can head to level.dev and you'll see our previews spinning up and so on. But you'll get a very simple and nice interface and you won't have to care about all of this stuff. Thank you so much. It's been a pleasure. And yeah, I hope you learned something. Thanks so much. Thanks for having me. But then what we've done is to make sure that we have this append only log.
And from that, we can actually build a prompt that we would feed into the actual LLM. And you might ask, why would you want to do this? Well, one reason is that when you build a prompt, if you have a long history, you probably want to do some sort of compaction. You want to summarize part of that history in the earlier steps, for example. But this summarization would differ. For example, if you use different models with different context lengths, you would probably think differently about when you should summarize or not.
And so by separating the prompt from the actual task history, we're able to render prompts for any type of model or any type of task that we can kind of find the best and optimal prompt for.
So to show this event history in progress, we have this debug tool here. So here it's just a recording of me dragging this slider in our UI. And you can see on the right that the UI is kind of updating as I'm dragging this along. And you have 156 events here. And each of those is an event in this event history. And you can see how the UI can render kind of any point in history. And this is just showcasing that at any point in time, we have full control of, say, the UI or anything else happening on this platform, thanks to this history kind of detailing everything that has happened.
The last piece I'll go over here on the runtime itself is that the process that is running these agents, they're separate from the actual task history. And so the process is almost entirely stateless in that between each call, each tool call, each turn, it will actually just persist into the task history. And so you can have a process common goal. And then the question is, why do we care about this? Well, at Lovable, this system, we deploy to it 700 times per day. So that's about once every two minutes. And you can imagine if you have an agent working for 10 hours, you want to not disrupt that agent when it's working, right? This agent is doing something for a customer.
But at the same time, we want to make sure that this agent is running on the latest deploy. And it might be a new feature or something like that. But it might also be like a security vulnerability in the Linux kernel. And it's like, okay, we need to update this ASAP. And so to do that, thanks to this separation between the actual history and the processes, we can actually make sure that we have one agent that is working on one task. But we can have different processes taking up and actually doing the compute behind that work. So this task can keep on working while we have different deploys working on it, be it for 10 hours or even longer, right?
So that's the agent runtime. The second piece of this platform, right, is the computer. So this is where the work is actually happening. And we've been through a lot of iterations and a lot of vendors kind of working with providing these sandboxes for the computer for the agent to work in. And we've landed in the system that we've worked really hard now to develop, which is checkpointing a computer. And so you can imagine you come to Lovable, you start a new project. We have this common what we call a golden checkpoint, which contains the OS and the system services. It has common tools installed and a dev server that is ready to start.
And this checkpoint, it includes everything on disk, memory, and also running processes. And so when you start a new project, you get all of that for free. And all of that is copied over in about 230 milliseconds. And so once you start a project, you might have some specific code and some dependencies within that project. And that is also checkpointed as you go. And so each time the agent is running and it finishes a turn, we will actually save a checkpoint of that computer. And from that, we're able to, again, very quickly, sub-second, spin that computer up whenever you need it.
That means we can save on resources by kind of spinning this down if you leave for, say, 10 minutes or so and come back. We can just spin it up extremely quickly so you don't even notice this. And even kind of requests in transit will not even be dropped in this setup. The other thing we can do thanks to this checkpointing is that just like the trajectory itself in the agent runtime, we can also fork the computer. And when we do this, for example, we have a feature in level that is called drafts where you kind of work in different environments of what you're doing. And to support that, we need to fork the computer that you're working in.
And here we have kind of the example of doing two at the same time. And you can imagine doing hundreds of these, right? And so we've had to do some optimizations to make this feasible to actually run. So one of these optimizations is copy and write on the RAM itself. And so creating one of these forks of a computer is basically free in terms of the RAM that it's using. But as soon as you start writing in a process to RAM, we will kind of copy that page over. And only then will you start having to allocate new memory. And there's another optimization here also, which is that each of these sandboxes require a few hundreds of megabytes of memory.
And that would take a few seconds to stream in if you have it in like cold object storage. And then it has to go to disk and then into memory of this VM. But thanks to being able to stream the memory, we can actually boot up the machine before all of the memory is actually ready on it. So the memory that always uses comes first. And then some processes and so on will start to work as soon as the memory gets there. And this also shaves off some extra startup time. And then we started asking ourselves, how can we make this even more efficient and even more faster for our users? And so you might be familiar with Vite.
It's this great dev server that most of the meta frameworks out there in the JavaScript ecosystem is using. And so we took that and we forked it and we rewrote it in Rust. And that made our code starts two times faster when we went from getting this preview from 14 seconds to three seconds. And the main kind of thing that we made faster is that Vite uses Node.js. And we were able to drop that dependency off Vite itself and just have this Rust binary. So that made the memory footprint be 6.5 times less in these machines. And by taking control of the applications that we're running in these computers, we're also able to control kind of how we write to memory.
And so when we control how we write to memory, we're even more optimizing if you remember back to the kind of the copy on write solution when we're drafting different computers. And so we're able to run this extremely efficiently so that we can run lots and lots of agents in parallel and kind of have agents explore different solutions to solving a bug or improving the performance of your applications and so on. And so this has been fun. But the last piece now is about verification. And of course, this kind of computer and this dev service is a big piece of being able to verify what an agent is doing.
And if you look at verification, you can think of these feedback loops, right? That the agent needs to get information. It took an action. Was this a good action or was it a bad action? And you can think of it as this inner loop and this outer loop. So this inner loop is during the turn of the agent. And you have kind of obvious things such as like the build working. Do we have lint errors or type errors in the code that we're running? And then you can check for runtime errors in the preview that you're running.
You can also have within this computer a headless browser where the agent can go in and kind of explore the web app it's building or whatever it's building, right? And a bunch of other things that we're using to help verify within the turn of an agent. But then you also have this outer loop, which is kind of between each turn and the turn you can think of like when the agent is yielding to you as a user. And between each turn, you might get some info on the product itself from production from your users, right? And so you can look at how your visitors are behaving, what users are telling you online.
You can do automatic A-B tests and actually change some copy and see if it's improving conversion and so on. And then you can also take these business metrics. And remember, this goes back to kind of the capabilities I showed you. By having control over these things, we can make sure that we can optimize how the agent is getting this outer feedback loop. So we can make sure that if you're running payments, we can actually track those transactions and conversions and make sure that the agent can actually help you optimize not only the code, right, but the business strategy around your product. And so those are really the three things that we've been working for.
And we'll continue to kind of build out these capabilities and this architecture around really orchestrating these LMs into agents. And so this agentic system that we're building is running billions of tokens per minute. And these computers, right, we can spawn up with each agent and we can have multiple agents use one computer. And now we're kind of back to this quite beautiful setup where you have agents talking to agents and they're orchestrating. And this time it's actually working. And it's working at scale thanks to some of these optimizations. And so if you're curious to try this out, you can head to level.dev and you'll see our previews spinning up and so on.
But you'll get a very simple and nice interface and you won't have to care about all of this stuff. Thank you so much. It's been a pleasure. And, yeah, I hope you learned something. Thanks so much. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness. Thanks for having me, my goodness.
Thanks for having me, my goodness. Textning.nu