Loop Engineering from First Principles — Kyle Mistele, HumanLayer
Read full transcript 13 segments
-
Hey everybody, my name is Kyle. Hey everybody, my name is Kyle. Hums are really powerful, don't get me wrong, are really powerful, don't get me wrong, but so much of the discourse around them but so much of the discourse around them but so much of the discourse around them is hype and just really not helpful, is hype and just really not helpful, is hype and just really not helpful, right? We I think we have this idea just right? We I think we have this idea just right? We I think we have this idea just kind of as an industry somehow that we kind of as an industry somehow that we kind of as an industry somehow that we can like pipe a prompt and a loop to a can like pipe a prompt and a loop to a can like pipe a prompt and a loop to a coding agent and that we can build coding agent and that we can build coding agent and that we can build software this way, right? software this way, right? software this way, right? Maybe we're investing a lot of time in Maybe we're investing a lot of time in Maybe we're investing a lot of time in verifiers. Maybe you have six different verifiers. Maybe you have six different verifiers. Maybe you have six different code review agents. But at the end of code review agents. But at the end of code review agents. But at the end of the day, if we're doing this, we're the day, if we're doing this, we're the day, if we're doing this, we're still building 40,000line PRs that just still building 40,000line PRs that just still building 40,000line PRs that just nobody wants to read, right? And this nobody wants to read, right? And this nobody wants to read, right? And this isn't a throchet to Jeff Huntley, right? isn't a throchet to Jeff Huntley, right? isn't a throchet to Jeff Huntley, right? This is Ralph is an innovative uh it's a This is Ralph is an innovative uh it's a This is Ralph is an innovative uh it's a sharp tool that works very well for sharp tool that works very well for sharp tool that works very well for certain types of problems. It works very certain types of problems. It works very certain types of problems. It works very well if you're not building on a team well if you're not building on a team well if you're not building on a team and it works very well if you're not and it works very well if you're not and it works very well if you're not working on critical systems. But most of working on critical systems. But most of working on critical systems. But most of us are working on teams and we don't fit us are working on teams and we don't fit us are working on teams and we don't fit in that box. So today I want to talk in that box. So today I want to talk in that box. So today I want to talk about how to build loops that work in about how to build loops that work in about how to build loops that work in large complex code bases for systems large complex code bases for systems large complex code bases for systems that have real customers, real users, that have real customers, real users, that have real customers, real users, real regulatory obligations and service real regulatory obligations and service real regulatory obligations and service level agreements and everything else level agreements and everything else level agreements and everything else that keeps us from shipping yolo 40,000 that keeps us from shipping yolo 40,000 that keeps us from shipping yolo 40,000 line PRs straight to production. In line PRs straight to production. In line PRs straight to production. In other words, I want to talk about how to other words, I want to talk about how to other words, I want to talk about how to build loops for the real world.
-
build loops for the real world. build loops for the real world. If you're not aware, uh, this post If you're not aware, uh, this post If you're not aware, uh, this post actually dates back to July. It went actually dates back to July. It went actually dates back to July. It went viral this past January, which is when a viral this past January, which is when a viral this past January, which is when a lot of us, I think, started building lot of us, I think, started building lot of us, I think, started building loops. And of course, much more loops. And of course, much more loops. And of course, much more recently, I'm sure y'all are going to recently, I'm sure y'all are going to recently, I'm sure y'all are going to see this slide a lot this week. Uh, but see this slide a lot this week. Uh, but see this slide a lot this week. Uh, but Peter Steinberger said that we shouldn't Peter Steinberger said that we shouldn't Peter Steinberger said that we shouldn't be prompting coding agents anymore, be prompting coding agents anymore, be prompting coding agents anymore, right? We should just be designing loops right? We should just be designing loops right? We should just be designing loops that prompt our agents. Of course, Open that prompt our agents. Of course, Open that prompt our agents. Of course, Open Claw is notoriously built on loops. Claw is notoriously built on loops. Claw is notoriously built on loops. Loops build the code. The loops review Loops build the code. The loops review Loops build the code. The loops review the code. They merge and release the the code. They merge and release the the code. They merge and release the code. They find and fix the bugs. code. They find and fix the bugs. code. They find and fix the bugs. There's even loops for finding and There's even loops for finding and There's even loops for finding and fixing bugs and the loops that are fixing bugs and the loops that are fixing bugs and the loops that are merging the things, right? It's loops merging the things, right? It's loops merging the things, right? It's loops all the way down. It's uh Boris Churnney all the way down. It's uh Boris Churnney all the way down. It's uh Boris Churnney also the creator of Claude Code recently also the creator of Claude Code recently also the creator of Claude Code recently said that this is his entire job as an said that this is his entire job as an said that this is his entire job as an engineer now is just writing loops to engineer now is just writing loops to engineer now is just writing loops to prompt Claude. And eventually we might prompt Claude. And eventually we might prompt Claude. And eventually we might not even need loops, right? We're just not even need loops, right? We're just not even need loops, right? We're just gonna have like swarms of agents gonna have like swarms of agents gonna have like swarms of agents designing loops to prompt agents designing loops to prompt agents designing loops to prompt agents building swarms for loops and like I building swarms for loops and like I building swarms for loops and like I don't know somewhere we're like writing don't know somewhere we're like writing don't know somewhere we're like writing production code I assume and in fact all production code I assume and in fact all production code I assume and in fact all of our loops that we're building are of our loops that we're building are of our loops that we're building are producing so much code that we can't producing so much code that we can't producing so much code that we can't possibly read all of it right so we possibly read all of it right so we possibly read all of it right so we might as well just not read any of it might as well just not read any of it might as well just not read any of it right we're we're investing in right we're we're investing in right we're we're investing in verification and in code review but all verification and in code review but all verification and in code review but all this code is readon this was the thesis this code is readon this was the thesis this code is readon this was the thesis of a conference that uh was here in town of a conference that uh was here in town of a conference that uh was here in town last month. So, a lot of smart people at last month. So, a lot of smart people at last month. So, a lot of smart people at the Frontier Labs think that this is the the Frontier Labs think that this is the the Frontier Labs think that this is the future of software development. And if future of software development. And if future of software development. And if you're doing this, you're moving 10x you're doing this, you're moving 10x you're doing this, you're moving 10x faster and everybody else is getting
-
faster and everybody else is getting faster and everybody else is getting left behind. Now, it's not clear how left behind. Now, it's not clear how left behind. Now, it's not clear how well this works yet. Uh took six months well this works yet. Uh took six months well this works yet. Uh took six months to fix the cloud code terminal flicker. to fix the cloud code terminal flicker. to fix the cloud code terminal flicker. The open code team wrote a renderer in a The open code team wrote a renderer in a The open code team wrote a renderer in a fraction of that time. And open claw, of fraction of that time. And open claw, of fraction of that time. And open claw, of course, also notoriously has stability course, also notoriously has stability course, also notoriously has stability issues. issues. issues. What is abundantly clear, however, is What is abundantly clear, however, is What is abundantly clear, however, is that this is really expensive if that this is really expensive if that this is really expensive if you don't work at a frontier lab and you don't work at a frontier lab and you don't work at a frontier lab and have an unlimited token budget. And all have an unlimited token budget. And all have an unlimited token budget. And all this code that we're writing is actually this code that we're writing is actually this code that we're writing is actually really expensive, right? Matt PCO talked really expensive, right? Matt PCO talked really expensive, right? Matt PCO talked about this recently. Uh, bad code is about this recently. Uh, bad code is about this recently. Uh, bad code is much more expensive in the age of agents much more expensive in the age of agents much more expensive in the age of agents than it it has ever been at any point in than it it has ever been at any point in than it it has ever been at any point in the past. So today I want to talk about the past. So today I want to talk about the past. So today I want to talk about what I think works in the real world and what I think works in the real world and what I think works in the real world and what we've started doing at human layer what we've started doing at human layer what we've started doing at human layer which to be clear is still building which to be clear is still building which to be clear is still building loops right I think loops are super loops right I think loops are super loops right I think loops are super powerful but we can design loops and powerful but we can design loops and powerful but we can design loops and still read the code in fact we can still read the code in fact we can still read the code in fact we can design loops that make it easier to read design loops that make it easier to read design loops that make it easier to read the code because the loops are making the code because the loops are making the code because the loops are making the code better solve hard problems in the code better solve hard problems in the code better solve hard problems in complex code bases with loops and we can complex code bases with loops and we can complex code bases with loops and we can build our software factory incrementally build our software factory incrementally build our software factory incrementally but uh to do this is going to take some but uh to do this is going to take some but uh to do this is going to take some real engineering y'all So let's talk real engineering y'all So let's talk real engineering y'all So let's talk about control theory. Control theory is about control theory. Control theory is about control theory. Control theory is all about how we drive a dynamic system all about how we drive a dynamic system all about how we drive a dynamic system which would be your codebase towards which would be your codebase towards which would be your codebase towards some desired stable or optimal end some desired stable or optimal end some desired stable or optimal end state. Right? You have a sensor that state. Right? You have a sensor that state. Right? You have a sensor that measures the current state of the world.
-
measures the current state of the world. measures the current state of the world. You have your set point, right? The You have your set point, right? The You have your set point, right? The desired state of the world. And the desired state of the world. And the desired state of the world. And the difference between those two things is difference between those two things is difference between those two things is your measured error. You have a your measured error. You have a your measured error. You have a controller that reads that measured controller that reads that measured controller that reads that measured error and turns it into a control signal error and turns it into a control signal error and turns it into a control signal about an incremental change to apply to about an incremental change to apply to about an incremental change to apply to the system. We have an actuator that the system. We have an actuator that the system. We have an actuator that applies that change to the system which applies that change to the system which applies that change to the system which is undergoing disturbances in the is undergoing disturbances in the is undergoing disturbances in the meantime and then we reme-measure meantime and then we reme-measure meantime and then we reme-measure recomputee our measured error and we're recomputee our measured error and we're recomputee our measured error and we're back where we started. Now this sounds back where we started. Now this sounds back where we started. Now this sounds really complicated and it can be. I have really complicated and it can be. I have really complicated and it can be. I have a twin brother actually who's an a twin brother actually who's an a twin brother actually who's an aerospace engineer. This is how they aerospace engineer. This is how they aerospace engineer. This is how they keep fighter jets from falling out of keep fighter jets from falling out of keep fighter jets from falling out of the sky. Uh but uh it's probably a the sky. Uh but uh it's probably a the sky. Uh but uh it's probably a little bit simpler than most of you all little bit simpler than most of you all little bit simpler than most of you all think. Does anyone have one of these? think. Does anyone have one of these? think. Does anyone have one of these? Uh a thermostat uses a control loop, Uh a thermostat uses a control loop, Uh a thermostat uses a control loop, right? Uh for for any of our European right? Uh for for any of our European right? Uh for for any of our European friends in the audience, it's part of friends in the audience, it's part of friends in the audience, it's part of something we have uh here in the states, something we have uh here in the states, something we have uh here in the states, it's called air conditioning. And uh most of us probably use control And uh most of us probably use control loops on a daily basis, right? loops on a daily basis, right? loops on a daily basis, right? Kubernetes autoscaling systems are built Kubernetes autoscaling systems are built Kubernetes autoscaling systems are built on control loops. Infrastructurees code on control loops. Infrastructurees code on control loops. Infrastructurees code uses a desired state, current state, uses a desired state, current state, uses a desired state, current state, iterative change like control loop iterative change like control loop iterative change like control loop pattern. Postgress's uh autovacuum in pattern. Postgress's uh autovacuum in pattern. Postgress's uh autovacuum in React's virtual DOM both use or React's virtual DOM both use or React's virtual DOM both use or approximate control loops. Control loops approximate control loops. Control loops approximate control loops. Control loops are ideal when we have a system that we are ideal when we have a system that we are ideal when we have a system that we want to change a problem we can measure want to change a problem we can measure want to change a problem we can measure and a way to get feedback on the result and a way to get feedback on the result and a way to get feedback on the result of that change. Like good software of that change. Like good software of that change. Like good software engineers have always been taught to do.
-
engineers have always been taught to do. engineers have always been taught to do. Control loops change a system Control loops change a system Control loops change a system incrementally instead of just trying to incrementally instead of just trying to incrementally instead of just trying to get straight to the end state get straight to the end state get straight to the end state immediately all at once and risk blowing immediately all at once and risk blowing immediately all at once and risk blowing everything up, right? They help us to everything up, right? They help us to everything up, right? They help us to avoid over steering and destabilizing avoid over steering and destabilizing avoid over steering and destabilizing the system and it minimizes risk. the system and it minimizes risk. the system and it minimizes risk. So control loops are the opposite of So control loops are the opposite of So control loops are the opposite of what I'm going to call a blind Ralph what I'm going to call a blind Ralph what I'm going to call a blind Ralph loop. They're how we avoid PRs that look loop. They're how we avoid PRs that look loop. They're how we avoid PRs that look like this because nobody wants to review like this because nobody wants to review like this because nobody wants to review this, right? Which is not to say that this, right? Which is not to say that this, right? Which is not to say that all Ralph loops are blind loops. The all Ralph loops are blind loops. The all Ralph loops are blind loops. The best Ralphs are actually applying best Ralphs are actually applying best Ralphs are actually applying control theory. I know Jeff Huntley is control theory. I know Jeff Huntley is control theory. I know Jeff Huntley is out in the hall somewhere wandering out in the hall somewhere wandering out in the hall somewhere wandering around. If you go talk to him, he's around. If you go talk to him, he's around. If you go talk to him, he's going to tell you the same thing, right? going to tell you the same thing, right? going to tell you the same thing, right? that Ralph is a a teaching device and I that Ralph is a a teaching device and I that Ralph is a a teaching device and I think some of us read it a little too think some of us read it a little too think some of us read it a little too literally but this is how we should have literally but this is how we should have literally but this is how we should have always been building loops but the other always been building loops but the other always been building loops but the other issue with Ralph loops is they're not issue with Ralph loops is they're not issue with Ralph loops is they're not incremental right it's just a bash loop incremental right it's just a bash loop incremental right it's just a bash loop so we have to build a gentic control so we have to build a gentic control so we have to build a gentic control loops and to do that we start by loops and to do that we start by loops and to do that we start by defining a set point which is the defining a set point which is the defining a set point which is the desired end state of our codebase with desired end state of our codebase with desired end state of our codebase with respect to some property of it and we respect to some property of it and we respect to some property of it and we add a sensor there's a lot of ways to add a sensor there's a lot of ways to add a sensor there's a lot of ways to build a sensor it can be strictly build a sensor it can be strictly build a sensor it can be strictly deterministic your eslint rules your as deterministic your eslint rules your as deterministic your eslint rules your as GP, your pack work, or it can be GP, your pack work, or it can be GP, your pack work, or it can be non-deterministic. You can have an agent non-deterministic. You can have an agent non-deterministic. You can have an agent and a skill and a bunch of natural and a skill and a bunch of natural and a skill and a bunch of natural language rules. And you could also just language rules. And you could also just language rules. And you could also just have a pipeline, like a combination of have a pipeline, like a combination of have a pipeline, like a combination of the two. So, how do we build a gentic?
-
the two. So, how do we build a gentic? the two. So, how do we build a gentic? Whoops, there we go. Now, uh this is all Whoops, there we go. Now, uh this is all Whoops, there we go. Now, uh this is all theory, right? Practically speaking, and theory, right? Practically speaking, and theory, right? Practically speaking, and because we're using agents, we can blur because we're using agents, we can blur because we're using agents, we can blur the lines a little bit between system the lines a little bit between system the lines a little bit between system components. So, Aiden buys React Doctor, components. So, Aiden buys React Doctor, components. So, Aiden buys React Doctor, for example, is fantastic. It is uh it's for example, is fantastic. It is uh it's for example, is fantastic. It is uh it's a great way to catch all of the React a great way to catch all of the React a great way to catch all of the React slot that Claude snuck into your slot that Claude snuck into your slot that Claude snuck into your codebase last week, but uh it's a hybrid codebase last week, but uh it's a hybrid codebase last week, but uh it's a hybrid sensor and controller. It tells you what sensor and controller. It tells you what sensor and controller. It tells you what are all the problems with your React are all the problems with your React are all the problems with your React code and also by the way, what are the code and also by the way, what are the code and also by the way, what are the top three things you should fix and how top three things you should fix and how top three things you should fix and how do you fix them. Similarly, our do you fix them. Similarly, our do you fix them. Similarly, our controller and actuator might actually controller and actuator might actually controller and actuator might actually just be a single agent deciding on an just be a single agent deciding on an just be a single agent deciding on an incremental change to make and then incremental change to make and then incremental change to make and then applying it in the same context window. applying it in the same context window. applying it in the same context window. But I want to zoom in on the controller But I want to zoom in on the controller But I want to zoom in on the controller a little bit because without one or a little bit because without one or a little bit because without one or without a welltuned one, we might make without a welltuned one, we might make without a welltuned one, we might make too large of a change all at once or we too large of a change all at once or we too large of a change all at once or we might make the wrong change entirely. might make the wrong change entirely. might make the wrong change entirely. And if you put that in a loop, you're in And if you put that in a loop, you're in And if you put that in a loop, you're in trouble pretty quickly. trouble pretty quickly. trouble pretty quickly. So we can use control loops to root out So we can use control loops to root out So we can use control loops to root out bad patterns and to clean up our code, bad patterns and to clean up our code, bad patterns and to clean up our code, but we can actually use them for all but we can actually use them for all but we can actually use them for all sorts of things, right? We could make sorts of things, right? We could make sorts of things, right? We could make sure that our API is compliant with sure that our API is compliant with sure that our API is compliant with someone else's open API spec. We can someone else's open API spec. We can someone else's open API spec. We can make sure that our MCP server is make sure that our MCP server is make sure that our MCP server is compliant with whatever version of the compliant with whatever version of the compliant with whatever version of the uh the MCP specification that we're uh the MCP specification that we're uh the MCP specification that we're currently on. Haven't checked. You could currently on. Haven't checked. You could currently on. Haven't checked. You could mirror a project from Python into mirror a project from Python into mirror a project from Python into TypeScript or vice versa. You could even TypeScript or vice versa. You could even TypeScript or vice versa. You could even maintain your uh Vbased slop fork of maintain your uh Vbased slop fork of maintain your uh Vbased slop fork of Nex.js against the upstream. The key Nex.js against the upstream. The key Nex.js against the upstream. The key questions are can we find something we questions are can we find something we questions are can we find something we can measure? Can we apply changes can measure? Can we apply changes can measure? Can we apply changes incrementally? And can we get feedback
-
incrementally? And can we get feedback incrementally? And can we get feedback on the quality of those changes? To on the quality of those changes? To on the quality of those changes? To illustrate that, I'm going to walk illustrate that, I'm going to walk illustrate that, I'm going to walk through a control loop that we use through a control loop that we use through a control loop that we use internally at human layer. Uh for our internally at human layer. Uh for our internally at human layer. Uh for our loop, we are incrementally migrating our loop, we are incrementally migrating our loop, we are incrementally migrating our RPC API to effect. We adopted it for RPC API to effect. We adopted it for RPC API to effect. We adopted it for some of our raceprone code. We like it, some of our raceprone code. We like it, some of our raceprone code. We like it, so we're adopting it across the rest of so we're adopting it across the rest of so we're adopting it across the rest of our codebase. If you've never seen our codebase. If you've never seen our codebase. If you've never seen effects code before, the code on the effects code before, the code on the effects code before, the code on the right is just the kind of trivial right is just the kind of trivial right is just the kind of trivial procedure on the left rewritten in procedure on the left rewritten in procedure on the left rewritten in effect. Uh the syntax is really weird. effect. Uh the syntax is really weird. effect. Uh the syntax is really weird. We're psychos. We really like it. It's We're psychos. We really like it. It's We're psychos. We really like it. It's not for everybody. That's okay. Uh this not for everybody. That's okay. Uh this not for everybody. That's okay. Uh this isn't a talk about effect, so we'll keep isn't a talk about effect, so we'll keep isn't a talk about effect, so we'll keep moving. Clicker's not working. Cool. So, step Clicker's not working. Cool. So, step one, we have to build our sensor to find one, we have to build our sensor to find one, we have to build our sensor to find unmigrated procedures. We can have an unmigrated procedures. We can have an unmigrated procedures. We can have an agent do this or we could use GP or RIP agent do this or we could use GP or RIP agent do this or we could use GP or RIP Grep, but instead we're going to use as Grep, but instead we're going to use as Grep, but instead we're going to use as Grep because it's really powerful. It's Grep because it's really powerful. It's Grep because it's really powerful. It's a great tool to have in your toolbox for a great tool to have in your toolbox for a great tool to have in your toolbox for building loops. It's language agnostic. building loops. It's language agnostic. building loops. It's language agnostic. It's out of band from your TypeScript It's out of band from your TypeScript It's out of band from your TypeScript config or ESLint rules, which if you're config or ESLint rules, which if you're config or ESLint rules, which if you're a TypeScript developer, you have watched a TypeScript developer, you have watched a TypeScript developer, you have watched Claude disable those with inline Claude disable those with inline Claude disable those with inline comments. Uh but so we can just write a comments. Uh but so we can just write a comments. Uh but so we can just write a simple rule that finds unmigrated simple rule that finds unmigrated simple rule that finds unmigrated procedures uh based on the pattern above procedures uh based on the pattern above procedures uh based on the pattern above and we over time we can even layer on and we over time we can even layer on and we over time we can even layer on more rules that describe other patterns more rules that describe other patterns more rules that describe other patterns we want to get rid of with granular we want to get rid of with granular we want to get rid of with granular include and exclude paths. If you have a include and exclude paths. If you have a include and exclude paths. If you have a multilingual monor repo like we do uh multilingual monor repo like we do uh multilingual monor repo like we do uh it'll work for any language you could it'll work for any language you could it'll work for any language you could possibly imagine. And we can just scan possibly imagine. And we can just scan possibly imagine. And we can just scan our codebase and it'll produce a long our codebase and it'll produce a long our codebase and it'll produce a long list of violations. Uh way too long in list of violations. Uh way too long in list of violations. Uh way too long in fact it'll give you about 50 keys per fact it'll give you about 50 keys per fact it'll give you about 50 keys per violation. So, we're just going to violation. So, we're just going to violation. So, we're just going to filter it down to four and we're going filter it down to four and we're going filter it down to four and we're going to sort it deterministically. Why are we to sort it deterministically. Why are we to sort it deterministically. Why are we doing that? At the beginning, I said
-
doing that? At the beginning, I said doing that? At the beginning, I said this was going to be practical. And so, this was going to be practical. And so, this was going to be practical. And so, we're going to step outside of our we're going to step outside of our we're going to step outside of our control loop paradigm for a second control loop paradigm for a second control loop paradigm for a second because before we start incrementally because before we start incrementally because before we start incrementally migrating procedures one at a time, we migrating procedures one at a time, we migrating procedures one at a time, we need to enforce that all new procedures need to enforce that all new procedures need to enforce that all new procedures are using effect, right? So, we're going are using effect, right? So, we're going are using effect, right? So, we're going to run a full scan once on main, sort to run a full scan once on main, sort to run a full scan once on main, sort all the violations deterministically, all the violations deterministically, all the violations deterministically, and track it in our version control. And and track it in our version control. And and track it in our version control. And then on every new PR we can see if it then on every new PR we can see if it then on every new PR we can see if it the branch added any unmigrated the branch added any unmigrated the branch added any unmigrated procedures. Right? So this is our procedures. Right? So this is our procedures. Right? So this is our control loop and our system is control loop and our system is control loop and our system is undergoing disturbances. In this case uh undergoing disturbances. In this case uh undergoing disturbances. In this case uh all of our teammates shipping cloud slot all of our teammates shipping cloud slot all of our teammates shipping cloud slot and this is how we make sure that and this is how we make sure that and this is how we make sure that they're not undoing our loop's work. they're not undoing our loop's work. they're not undoing our loop's work. This doesn't map directly to a part of This doesn't map directly to a part of This doesn't map directly to a part of the control loop but we can kind of like the control loop but we can kind of like the control loop but we can kind of like squint at it a little bit and call it a squint at it a little bit and call it a squint at it a little bit and call it a disturbance dampener. So now that we've disturbance dampener. So now that we've disturbance dampener. So now that we've stopped the bleeding we can actually stopped the bleeding we can actually stopped the bleeding we can actually design our controller. For a simple design our controller. For a simple design our controller. For a simple controller, we could just controller, we could just controller, we could just deterministically pick the first deterministically pick the first deterministically pick the first violation from the list. You can use violation from the list. You can use violation from the list. You can use bash and jq. Or we could get a little bash and jq. Or we could get a little bash and jq. Or we could get a little cleverer and use as grep to find the cleverer and use as grep to find the cleverer and use as grep to find the smallest unmigrated procedure and always smallest unmigrated procedure and always smallest unmigrated procedure and always pick the smallest one to reduce the pick the smallest one to reduce the pick the smallest one to reduce the risk.
-
risk. risk. Uh we could have an agent make the Uh we could have an agent make the Uh we could have an agent make the decision if we really want to. I don't decision if we really want to. I don't decision if we really want to. I don't think you should ever send an agent to think you should ever send an agent to think you should ever send an agent to do deterministic code's job, but you do deterministic code's job, but you do deterministic code's job, but you certainly can. In fact, depending on the certainly can. In fact, depending on the certainly can. In fact, depending on the complexity, we could have the agent pick complexity, we could have the agent pick complexity, we could have the agent pick the procedure to migrate and just do it the procedure to migrate and just do it the procedure to migrate and just do it at the same time like we just talked at the same time like we just talked at the same time like we just talked about. But we can make this even more about. But we can make this even more about. But we can make this even more powerful, right? Because we're not just powerful, right? Because we're not just powerful, right? Because we're not just migrating to effect for the sake of it. migrating to effect for the sake of it. migrating to effect for the sake of it. We're doing it because it's helpful for We're doing it because it's helpful for We're doing it because it's helpful for handling errors and for helping us handling errors and for helping us handling errors and for helping us instrument our code better. And so what instrument our code better. And so what instrument our code better. And so what we could do if we want to get really we could do if we want to get really we could do if we want to get really clever is we can look at our telemetry clever is we can look at our telemetry clever is we can look at our telemetry and figure out which procedures have the and figure out which procedures have the and figure out which procedures have the most errors or the least instrumentation most errors or the least instrumentation most errors or the least instrumentation or has a gap in our APM, right? And when or has a gap in our APM, right? And when or has a gap in our APM, right? And when we send a control signal to our actuator we send a control signal to our actuator we send a control signal to our actuator agent, we can include not just the agent, we can include not just the agent, we can include not just the procedure to migrate, but also all the procedure to migrate, but also all the procedure to migrate, but also all the data about the things that we're trying data about the things that we're trying data about the things that we're trying to fix with this migration so that the to fix with this migration so that the to fix with this migration so that the actuator agent can actually make the actuator agent can actually make the actuator agent can actually make the code better instead of just doing a code better instead of just doing a code better instead of just doing a onetoone migration. Oh man, there we go. So next is building Oh man, there we go. So next is building our actuator. Our actuator is just an our actuator. Our actuator is just an our actuator. Our actuator is just an agent plus a skill. Um, bring your CLI agent plus a skill. Um, bring your CLI agent plus a skill. Um, bring your CLI coding agent of choice. You should spend coding agent of choice. You should spend coding agent of choice. You should spend a lot of time on the skill. Not all of a lot of time on the skill. Not all of a lot of time on the skill. Not all of that should be up front. You'll want to that should be up front. You'll want to that should be up front. You'll want to iterate on it over time based on what iterate on it over time based on what iterate on it over time based on what works. At human layer, we like to build works. At human layer, we like to build works. At human layer, we like to build out what we call golden patterns by hand out what we call golden patterns by hand out what we call golden patterns by hand before setting the agent loose. These before setting the agent loose. These before setting the agent loose. These are just like idiomatic handwritten are just like idiomatic handwritten are just like idiomatic handwritten examples for the agent to follow because examples for the agent to follow because examples for the agent to follow because they're just pattern replicators and they're just pattern replicators and they're just pattern replicators and otherwise you're getting what's in the otherwise you're getting what's in the otherwise you're getting what's in the docks or what the agent knows from the docks or what the agent knows from the docks or what the agent knows from the internet. And so we pipe the skill plus internet. And so we pipe the skill plus internet. And so we pipe the skill plus our control signal into our actuator our control signal into our actuator our control signal into our actuator agent. And the skill of course should
-
agent. And the skill of course should agent. And the skill of course should include a response template. And the include a response template. And the include a response template. And the agent's going to work and work and work agent's going to work and work and work agent's going to work and work and work and it'll produce a final response. And and it'll produce a final response. And and it'll produce a final response. And then we're going to deterministically then we're going to deterministically then we're going to deterministically commit and push and create a PR using commit and push and create a PR using commit and push and create a PR using the final message as our PR description. the final message as our PR description. the final message as our PR description. Now all we have to do is actually run Now all we have to do is actually run Now all we have to do is actually run the loop, right? Uh my recommendation is the loop, right? Uh my recommendation is the loop, right? Uh my recommendation is to use GitHub actions or your GitLab or to use GitHub actions or your GitLab or to use GitHub actions or your GitLab or your CircleCI or whatever else you're your CircleCI or whatever else you're your CircleCI or whatever else you're using because it has access to your using because it has access to your using because it has access to your code. It has access to your secrets and code. It has access to your secrets and code. It has access to your secrets and it has great dispatch and scheduling it has great dispatch and scheduling it has great dispatch and scheduling primitives. Right? We don't need a new primitives. Right? We don't need a new primitives. Right? We don't need a new cluster for this. So we can write a cluster for this. So we can write a cluster for this. So we can write a workflow that runs a single iteration of workflow that runs a single iteration of workflow that runs a single iteration of the loop sense control actuate and the loop sense control actuate and the loop sense control actuate and creates a PR and then we can schedule creates a PR and then we can schedule creates a PR and then we can schedule this to run once a day. And every this to run once a day. And every this to run once a day. And every morning we walk into the office to a morning we walk into the office to a morning we walk into the office to a small incremental PR that's low risk. small incremental PR that's low risk. small incremental PR that's low risk. And when we first did this, it was And when we first did this, it was And when we first did this, it was actually really frustrating and we actually really frustrating and we actually really frustrating and we turned the loop off and it uh because we turned the loop off and it uh because we turned the loop off and it uh because we had to constantly update the skill. We had to constantly update the skill. We had to constantly update the skill. We had to constantly check out the branch, had to constantly check out the branch, had to constantly check out the branch, change the skill, change the code, change the skill, change the code, change the skill, change the code, commit and push. And our loop was commit and push. And our loop was commit and push. And our loop was actually really high friction, right? actually really high friction, right? actually really high friction, right? But there's a better way to do this uh But there's a better way to do this uh But there's a better way to do this uh where we can put a human on the loop in where we can put a human on the loop in where we can put a human on the loop in a really low friction way to resteere it a really low friction way to resteere it a really low friction way to resteere it when it goes wrong. And the way to do when it goes wrong. And the way to do when it goes wrong. And the way to do this is to just create a feedback file this is to just create a feedback file this is to just create a feedback file that's tracked in version control just that's tracked in version control just that's tracked in version control just as a markdown file, right? we can as a markdown file, right? we can as a markdown file, right? we can deterministically load it into our deterministically load it into our deterministically load it into our actuator agents context every time that actuator agents context every time that actuator agents context every time that it runs after we run the controller.
-
it runs after we run the controller. it runs after we run the controller. Then we can add a label to the PR. Then we can add a label to the PR. Then we can add a label to the PR. Right? Each workflow needs to be able to Right? Each workflow needs to be able to Right? Each workflow needs to be able to identify PRs that it created since there identify PRs that it created since there identify PRs that it created since there might be a bunch of different loops might be a bunch of different loops might be a bunch of different loops running and we only want workflows to running and we only want workflows to running and we only want workflows to respond to feedback from uh comments on respond to feedback from uh comments on respond to feedback from uh comments on their PRs. And we're going to add a their PRs. And we're going to add a their PRs. And we're going to add a comment trigger to each loop workflow so comment trigger to each loop workflow so comment trigger to each loop workflow so that when a user leaves a slashiterate that when a user leaves a slashiterate that when a user leaves a slashiterate comment on the PR, uh the loop workflow comment on the PR, uh the loop workflow comment on the PR, uh the loop workflow is going to pick that up. It's going to is going to pick that up. It's going to is going to pick that up. It's going to deterministically load all of the PR deterministically load all of the PR deterministically load all of the PR context, the diff, the comments, the context, the diff, the comments, the context, the diff, the comments, the review comments, the description into review comments, the description into review comments, the description into the agents context along with the skill, the agents context along with the skill, the agents context along with the skill, and it's going to instruct the agent to and it's going to instruct the agent to and it's going to instruct the agent to fix the code, but also to update that fix the code, but also to update that fix the code, but also to update that feedback file, right? Looks kind of like feedback file, right? Looks kind of like feedback file, right? Looks kind of like this. And the benefit of doing this way this. And the benefit of doing this way this. And the benefit of doing this way is that now that feedback file with is that now that feedback file with is that now that feedback file with instructions is tracked in your version instructions is tracked in your version instructions is tracked in your version control. You can see how you've changed control. You can see how you've changed control. You can see how you've changed it over time. You can revert it if you it over time. You can revert it if you it over time. You can revert it if you need to. need to. need to. So, the next thing we're going to do is So, the next thing we're going to do is So, the next thing we're going to do is add flow control. Because the other add flow control. Because the other add flow control. Because the other problem that we had when we did this was problem that we had when we did this was problem that we had when we did this was that if we were at a customer site for a that if we were at a customer site for a that if we were at a customer site for a week or if we were traveling or spent week or if we were traveling or spent week or if we were traveling or spent six days working on slides instead of six days working on slides instead of six days working on slides instead of writing code, uh the PRs from all of our writing code, uh the PRs from all of our writing code, uh the PRs from all of our loops would just stack up. They'd loops would just stack up. They'd loops would just stack up. They'd duplicate work. They'd conflict and we duplicate work. They'd conflict and we duplicate work. They'd conflict and we wouldn't get around to doing it. And wouldn't get around to doing it. And wouldn't get around to doing it. And like the loops work is important, but like the loops work is important, but like the loops work is important, but it's not that important. And so now we it's not that important. And so now we it's not that important. And so now we just had all this like junk we had to just had all this like junk we had to just had all this like junk we had to deal with that wasn't important. So this deal with that wasn't important. So this deal with that wasn't important. So this is actually a really easy problem to fix is actually a really easy problem to fix is actually a really easy problem to fix uh because each loop and its workflow uh because each loop and its workflow uh because each loop and its workflow has a label that gets attached to PRs.
-
has a label that gets attached to PRs. has a label that gets attached to PRs. When the workflow first runs uh before When the workflow first runs uh before When the workflow first runs uh before we check out the code and install the we check out the code and install the we check out the code and install the dependencies and run our sense actu or dependencies and run our sense actu or dependencies and run our sense actu or sense control actuate steps, we can just sense control actuate steps, we can just sense control actuate steps, we can just check and see if the last PR that we check and see if the last PR that we check and see if the last PR that we created or any PR with the loop's label created or any PR with the loop's label created or any PR with the loop's label on it is open. And if so, we just shut on it is open. And if so, we just shut on it is open. And if so, we just shut down, right? Because this means that the down, right? Because this means that the down, right? Because this means that the last time that a human uh reviewed the last time that a human uh reviewed the last time that a human uh reviewed the code from this loop was before the loop code from this loop was before the loop code from this loop was before the loop ran, right? No human reviewed the last ran, right? No human reviewed the last ran, right? No human reviewed the last output. So there's no reason to stack up output. So there's no reason to stack up output. So there's no reason to stack up even more work for humans to review. even more work for humans to review. even more work for humans to review. This way we have exactly one PR at most This way we have exactly one PR at most This way we have exactly one PR at most open per loop at a time. No stacking, no open per loop at a time. No stacking, no open per loop at a time. No stacking, no duplication. Hopefully no conflicts. And duplication. Hopefully no conflicts. And duplication. Hopefully no conflicts. And of course once you're feeling confident of course once you're feeling confident of course once you're feeling confident in the loop, we're going to want to in the loop, we're going to want to in the loop, we're going to want to speed it up, right? I have 150 RPC speed it up, right? I have 150 RPC speed it up, right? I have 150 RPC procedures to migrate. If I do one at a procedures to migrate. If I do one at a procedures to migrate. If I do one at a time, it's going to take six months, time, it's going to take six months, time, it's going to take six months, which is way longer than I want to wait. which is way longer than I want to wait. which is way longer than I want to wait. Fortunately, there's a lot of ways to Fortunately, there's a lot of ways to Fortunately, there's a lot of ways to pick up the the velocity of our loop. Uh pick up the the velocity of our loop. Uh pick up the the velocity of our loop. Uh we could have our controller pick three we could have our controller pick three we could have our controller pick three procedures to migrate instead of one at procedures to migrate instead of one at procedures to migrate instead of one at a time or five. Uh we could have our a time or five. Uh we could have our a time or five. Uh we could have our controller pick three or five and then controller pick three or five and then controller pick three or five and then do each of those in a separate do each of those in a separate do each of those in a separate implementation phase, which will be both implementation phase, which will be both implementation phase, which will be both cheaper and more reliable since each cheaper and more reliable since each cheaper and more reliable since each migration gets its own context window.
-
migration gets its own context window. migration gets its own context window. Or we could just run the workflow four Or we could just run the workflow four Or we could just run the workflow four times and give one PR to each of four times and give one PR to each of four times and give one PR to each of four people on the team. So let's put it all people on the team. So let's put it all people on the team. So let's put it all together. We built a control loop that together. We built a control loop that together. We built a control loop that improves our code incrementally and improves our code incrementally and improves our code incrementally and we're actually reading the code. It has we're actually reading the code. It has we're actually reading the code. It has adaptive flow control so we're not adaptive flow control so we're not adaptive flow control so we're not creating a bunch of loop or a bunch of creating a bunch of loop or a bunch of creating a bunch of loop or a bunch of work that nobody wants to review. And we work that nobody wants to review. And we work that nobody wants to review. And we can resteer it on the fly in a super low can resteer it on the fly in a super low can resteer it on the fly in a super low friction way. If you want to try this friction way. If you want to try this friction way. If you want to try this yourself, uh we built a skill. Please yourself, uh we built a skill. Please yourself, uh we built a skill. Please try it out. My Twitter handle is down try it out. My Twitter handle is down try it out. My Twitter handle is down there on the bottom. Please share it. I there on the bottom. Please share it. I there on the bottom. Please share it. I would love to see what you build. And if would love to see what you build. And if would love to see what you build. And if you get excited by this, uh at Human you get excited by this, uh at Human you get excited by this, uh at Human Layer, we're hiring here in San Layer, we're hiring here in San Layer, we're hiring here in San Francisco. And if you're working on Francisco. And if you're working on Francisco. And if you're working on mission critical systems and want to mission critical systems and want to mission critical systems and want to figure out how to get more out of AI, figure out how to get more out of AI, figure out how to get more out of AI, we'd love to chat. Thank you so much. we'd love to chat. Thank you so much. we'd love to chat. Thank you so much. [applause]
Summary
The main theme is the hype surrounding AI coding agents and the need for practical application in real-world software development. Key subjects include "loops" for prompting agents, large codebases, critical systems, and the challenges of building with teams. The practical takeaway is that effective loops are crucial for building robust software for actual customers, not just for theoretical experimentation.