YouTube2Text

I Built A Self-Improving AI Software Factory — Transcript

by Owain Lewis · 3,138 words · 447 segments · language en · Watch on YouTube

Full transcript

  1. 0:00Today we're talking about software
  2. 0:01factories and how they can make your
  3. 0:02agentic coding more consistent, more
  4. 0:03measurable, and more scalable. This
  5. 0:05isn't going to be one of those hype
  6. 0:06videos where I tell you to stop using
  7. 0:07coding agents locally because I think
  8. 0:09that would be terrible advice. I'm still
  9. 0:10using local coding agents for a lot of
  10. 0:12my work. But I think there are many
  11. 0:14advantages of using a software factory.
  12. 0:16One of the big challenges with agentic
  13. 0:18coding is that when you change your
  14. 0:19models, your prompts, your harnesses, or
  15. 0:21your skills, [music] it's not very easy
  16. 0:23to know whether those things make any
  17. 0:25valuable difference. So the advantage of
  18. 0:26a software factory is it gives you a
  19. 0:28repeatable way of measuring and
  20. 0:30improving your process over time. So in
  21. 0:32this video I'm going to break down a
  22. 0:33software factory that I built. I'm going
  23. 0:35to show you how to set it [music] up and
  24. 0:36configure it. I'm going to show you the
  25. 0:37architecture of a software factory. And
  26. 0:40more importantly, we're going to talk
  27. 0:41about how you can use evaluations and
  28. 0:42software factories to improve your
  29. 0:44coding process over time. You can make
  30. 0:46some drastic improvements in terms of
  31. 0:48your own [music] efficiency and learn a
  32. 0:51lot about your own agentic coding
  33. 0:52process by following some of the ideas
  34. 0:54in this video. This is going to be a big
  35. 0:56topic. So all of the resources and
  36. 0:58everything you need to get started, I'll
  37. 0:59link for free in the description below.
  38. 1:00So let's get into it. I personally think
  39. 1:02about a software factory as
  40. 1:03infrastructure for running coding agents
  41. 1:05through a defined process. So what I
  42. 1:07mean by that is you put work into the
  43. 1:09system and it will run through a defined
  44. 1:11process the same way every single time
  45. 1:13and you record metrics and data about
  46. 1:15that that particular run. So this allows
  47. 1:17you to see everything that's going on to
  48. 1:20manage coding without having to think
  49. 1:22about you know work trees and branches
  50. 1:24and how to set up the local environment.
  51. 1:26You just delegate the work and the
  52. 1:27factory or the system will take care of
  53. 1:29it for you. And I think about two parts
  54. 1:31of the architecture. The data plane and
  55. 1:33the control plane. So the control plane
  56. 1:35is where you manage the work. And then
  57. 1:37the data plane is made up of the
  58. 1:39workers. The workers are essentially
  59. 1:41delegating to coding agents. They're
  60. 1:42setting up your environments. They're
  61. 1:44doing the work. So the useful
  62. 1:46distinction really is between the worker
  63. 1:48and the agent harness. So the worker
  64. 1:50lives on the data plane. You could have
  65. 1:51multiple workers across multiple
  66. 1:53different virtual machines. You could
  67. 1:54run this on a Kubernetes cluster if you
  68. 1:56wanted to. So you admit work to the
  69. 1:58control plane which will queue up the
  70. 2:00work. And then the workers are just
  71. 2:02going to pull tasks off the queue and
  72. 2:05then delegate those to the right coding
  73. 2:06agents and make sure the work gets done.
  74. 2:08And then the workers are going to, you
  75. 2:10know, record the results of that work
  76. 2:12and then send it back to the control
  77. 2:13plane so that you can actually see
  78. 2:15what's going on in a cycle. So the way
  79. 2:17that I personally like to set this up is
  80. 2:18using an SSH tunnel because I'm just a
  81. 2:21solo developer. I don't need to deal
  82. 2:22with any security headaches or complex
  83. 2:24infrastructure setups. I just put this
  84. 2:26onto a virtual machine. I run it on the
  85. 2:28virtual machine, but then I use an SSH
  86. 2:29tunnel to forward to access this
  87. 2:32machine. So essentially what this does
  88. 2:34is we can run our software factory and
  89. 2:36our agents on a virtual machine with no
  90. 2:39public internet access. So we can have
  91. 2:40these completely secure and private, but
  92. 2:43then we can use an SSH tunnel to connect
  93. 2:45to them on our local machine. So I'll
  94. 2:47show you how that works now. So I have
  95. 2:49this deployed on a virtual machine. So I
  96. 2:51can go onto the machinist virtual
  97. 2:53machine and this is just an abundu
  98. 2:56instance. And then if I type the
  99. 2:57machinist
  100. 3:00command, you can see here we have a CLI
  101. 3:02tool that has a bunch of different
  102. 3:03options. We can run our workers straight
  103. 3:05away. You can see here I'm signed in
  104. 3:07with my subscription, but the agents are
  105. 3:09running on a virtual machine, not on my
  106. 3:11laptop. So when I run this command, it
  107. 3:14will allow me to go to my browser and
  108. 3:16now access the UI. So this is the
  109. 3:19machinist UI. You can see here we have a
  110. 3:21bunch of work that's been completed, a
  111. 3:22bunch of work in progress. So you can
  112. 3:24see a list of all of the stuff that
  113. 3:25we've been working on. Uh you can see
  114. 3:27analytics here about what's going on. So
  115. 3:30you can see the average task time is 18
  116. 3:32minutes and we have 15 million tokens
  117. 3:33used so far. I only set this up
  118. 3:35yesterday. And we have workers. You
  119. 3:38could have multiple different workers.
  120. 3:39You could run the workers on, you know,
  121. 3:41cloud instances, Kubernetes jobs,
  122. 3:44however you want to set this up. I only
  123. 3:45have one worker right now which is
  124. 3:47running on the same virtual machine as
  125. 3:50the control plane. This is connected and
  126. 3:52the worker will then just take the tasks
  127. 3:54and dispatch them to coding agents. If
  128. 3:56you're working on many things at once or
  129. 3:58you're working in a big team, you might
  130. 3:59want to have more workers added to the
  131. 4:00pool. And then you can see here the
  132. 4:03prompts that we're running. These are
  133. 4:05the actual agent definitions. So every
  134. 4:07single task when we send a task through
  135. 4:09machinist is given to a foreman
  136. 4:12coordinator. The coordinator will be
  137. 4:14responsible for taking the task and then
  138. 4:17basically working through it in a
  139. 4:19sequence delegating the work to coding
  140. 4:21agents or sub agents. The goal here is
  141. 4:23to have this one agent spin up sub aents
  142. 4:27implement the code change and follow a
  143. 4:29defined sequence. So even down to how we
  144. 4:32manage labels. It's all configured here.
  145. 4:34It's all defined. But this is the
  146. 4:36repeatable process that every single
  147. 4:38coding task will go through in the
  148. 4:41system. So as you make changes to this
  149. 4:43specific prompt, every single task that
  150. 4:46you do will be using the same prompt
  151. 4:49every single time. So this is how you
  152. 4:50build the consistency. I have two
  153. 4:53triggers set up. You can define triggers
  154. 4:55within the factory. So this first
  155. 4:59trigger will monitor the repository. So
  156. 5:01every so often it will run a health
  157. 5:03check. It will scan the codebase using a
  158. 5:06cheaper model, find bugs, find issues in
  159. 5:08the codebase, and raise tickets. And
  160. 5:10then the other trigger that we have is a
  161. 5:12GitHub watching trigger. You can
  162. 5:14configure all kinds of different
  163. 5:15triggers within your repositories. And
  164. 5:18this will then monitor for a specific
  165. 5:20label on a task. When the agent sees
  166. 5:23that there's a particular label, it will
  167. 5:26then pull that work into the factory. So
  168. 5:27it's a way of getting work into the
  169. 5:29system. And so the nice thing about
  170. 5:31having a factory system like this is you
  171. 5:33get a historical record of all of the
  172. 5:35work that you've been doing. And so you
  173. 5:36can see as you start to change your
  174. 5:38models and you start to change your
  175. 5:39prompts, you can see the difference it
  176. 5:41makes on the system overall. So if you
  177. 5:43want to make a change or use a different
  178. 5:44model, you can run that for a couple of
  179. 5:46days, collect a bunch of data, and then
  180. 5:48start to see what difference it makes in
  181. 5:49terms of the cycle time, how effectively
  182. 5:52the tasks are being completed. So this
  183. 5:54is kind of a way of experimenting a lot
  184. 5:55with your coding setup. So just quickly
  185. 5:58within the codebase, you can see here
  186. 5:59that we have our configuration. So let's
  187. 6:02go ahead and take a look at some
  188. 6:03examples. So this is the configuration
  189. 6:06for the server. So you can see here we
  190. 6:08have the database which is just using
  191. 6:10SQite. So we have the max concurrent
  192. 6:12jobs. Then we have a forman job or a
  193. 6:15foreman agent. And this is a prompt
  194. 6:17definition. We're using codecs. And then
  195. 6:19we have a audit job as well. Again these
  196. 6:22are just prompt definitions.
  197. 6:24And if we go into the worker
  198. 6:26configuration you can see here we're
  199. 6:27configuring the executors. So we're
  200. 6:29using codeex or claude and we've defined
  201. 6:32the models that are available to the
  202. 6:34executor. You can build in any executor
  203. 6:36here. You could have multiple different
  204. 6:38coding executors and you can start
  205. 6:40experimenting then with different setups
  206. 6:42to see what makes a difference. This is
  207. 6:44the foreman prompt. This is the prompt
  208. 6:45that every single task inside the system
  209. 6:47is going to be running through. It
  210. 6:49controls the workflow and it delegates
  211. 6:51work to sub aents. So we're just working
  212. 6:52on a single GitHub issue. I also have a
  213. 6:55bunch of somewhat deterministic evals as
  214. 6:57well. So I can do automated checking and
  215. 6:58automated testing to make sure that the
  216. 7:00the right labels the right workflow is
  217. 7:02being followed. So you can also define a
  218. 7:04bunch of automated tests as well in the
  219. 7:07spirit of like evaluating and improving
  220. 7:09your system over time. So when it comes
  221. 7:11to software factories, you can either
  222. 7:12run your infrastructure locally or you
  223. 7:13can run it in the cloud. I've chosen to
  224. 7:15run my infrastructure in the cloud. So
  225. 7:17both the control plane and the workers
  226. 7:19are running on virtual machines. You
  227. 7:21could also run this using things like
  228. 7:23Kubernetes containers. You can run these
  229. 7:26using Cloud Run jobs. You can run this
  230. 7:28in a million different ways. I like to
  231. 7:30keep it simple and because it's just me
  232. 7:32working on this, I'm using a simple
  233. 7:34virtual machine setup. If you're working
  234. 7:36in a team environment, you might do this
  235. 7:37differently. Taking a look at the
  236. 7:39pricing across all of these different
  237. 7:40providers. There are a whole bunch of
  238. 7:43options when it comes to this. I
  239. 7:45personally use Google Cloud for almost
  240. 7:46all of my professional work, but I find
  241. 7:49that the virtual machines are pretty
  242. 7:50expensive. You can see here even for
  243. 7:52like an E2 medium in London is $32 a
  244. 7:56month plus the disk usage. So this
  245. 7:58starts to add up quite quickly. Whereas
  246. 7:59if you use a Hetsner virtual machine,
  247. 8:02it's significantly cheaper. So you can
  248. 8:04see here I'm now running an Iuntu 16 gig
  249. 8:06in Helsinki. So this is just a cheapish
  250. 8:09virtual machine. Like I said, if cost is
  251. 8:12a concern, you can just run this
  252. 8:13locally. You don't need to run it in the
  253. 8:15cloud. But I find running these agents
  254. 8:17in the cloud helps me think better about
  255. 8:19the infrastructure. It helps me kind of
  256. 8:22separate out my local development
  257. 8:23environment from the the infrastructure
  258. 8:25that where I'm running my coding agents.
  259. 8:27So Google Cloud is where I run most of
  260. 8:28my infrastructure, but I find that the
  261. 8:30virtual machines are relatively
  262. 8:31expensive when compared with something
  263. 8:34like HTNA where you can get a bigger
  264. 8:36virtual machine for much less money. The
  265. 8:38next thing I want to show you is the
  266. 8:40idea of eval. And this is kind of where
  267. 8:42I started with this whole experiment.
  268. 8:43the idea that I want to start improving
  269. 8:45my process over time and experiment with
  270. 8:47different models and see with data
  271. 8:49what's actually working. You can
  272. 8:51obviously do this with your local coding
  273. 8:53setup. So all of your coding agents will
  274. 8:55emit logs or JSON files containing a
  275. 8:57bunch of metadata that an agent can
  276. 8:59interpret. The difference here with a
  277. 9:02factory is that we're using the same
  278. 9:03prompt every single time. So every
  279. 9:05single task that runs through our
  280. 9:06factory goes through exactly the same
  281. 9:08series of steps. So this was a very
  282. 9:10simple example. I just said, "Can you
  283. 9:11connect to the remote virtual machine
  284. 9:13instance, review the outputs of the
  285. 9:14latest coding runs, find ways to improve
  286. 9:17our prompt to make it more efficient in
  287. 9:18terms of token usage?" And so the agent
  288. 9:22then would SSH into the machine. It's
  289. 9:24reviewed all of the output and the data
  290. 9:25in the database. And you can see here we
  291. 9:27have a bunch of interesting data. So you
  292. 9:29can see here the the times taken for
  293. 9:32these particular issues. You can see
  294. 9:34here the number of tokens used, the
  295. 9:35number of commands run, the number of
  296. 9:37agent weights as well. So what I'm
  297. 9:39thinking now is I might actually
  298. 9:40experiment with using more deterministic
  299. 9:42Python scripts. So within the machinist
  300. 9:44setup, you can run an agent, but you can
  301. 9:46also run a script. And so what I might
  302. 9:48do is experiment with something like
  303. 9:49this where we have a essentially a
  304. 9:52deterministic script that will monitor
  305. 9:55CI delegate to an agent. And this might
  306. 9:57be a lot more token efficient generally
  307. 10:00when working with agents. So by moving
  308. 10:02this to a script, it's going to be
  309. 10:04cheaper, more predictable, more
  310. 10:05testable, and gives the same structured
  311. 10:07output every time. And so I think this
  312. 10:10is something that I'm going to do next.
  313. 10:12So this is useful feedback just by
  314. 10:14analyzing our runs, looking for ways to
  315. 10:17improve. Now, what I can do is go ahead
  316. 10:19and write a script to improve. So I'm
  317. 10:22going to go ahead and cut a task to do
  318. 10:24this, and then I'm just going to go and
  319. 10:25try experimenting with this now over
  320. 10:28time. So now we found a very specific
  321. 10:30improvement to my workflow. And this
  322. 10:32would improve everything about my
  323. 10:33workflow to be honest because I'm using
  324. 10:36the same coding loop on every single
  325. 10:37task every single day. So if you can
  326. 10:39imagine that implementing this one
  327. 10:41change to my workflow could save me, you
  328. 10:43know, a significant number of tokens
  329. 10:45every single time I use a coding agent.
  330. 10:48This is going to be a massive
  331. 10:49improvement to my overall workflow. So
  332. 10:51you can see that this could save you a
  333. 10:52ton of money, make your process more
  334. 10:54reliable. Having this ability to do this
  335. 10:56in a in a kind like a repeated way is
  336. 10:58super useful. So what I'm going to do
  337. 11:00now is add a label as before. So we're
  338. 11:03going to add a machinist cued uh label
  339. 11:07or requested label, sorry. And then
  340. 11:09we're just going to basically get the
  341. 11:11agents to go and build this for us and
  342. 11:13then start to measure and experiment and
  343. 11:15see if this makes an improvement to our
  344. 11:17overall workflow. If this does make an
  345. 11:20improvement to the workflow on the
  346. 11:21factory instance, I will then also
  347. 11:23incorporate the same code, the same
  348. 11:25workflow on my local development setup
  349. 11:27as well, just day-to-day. So when it
  350. 11:29comes to software development, there's a
  351. 11:30big difference between working by
  352. 11:31yourself as a solo developer or working
  353. 11:33in a team environment. So I personally
  354. 11:35work both as a solo developer. I run my
  355. 11:37own AI business. I do a lot of side
  356. 11:39projects, but I also work in a large
  357. 11:41enterprise environment with, you know,
  358. 11:42hundreds or thousands of developers. And
  359. 11:45there's a big difference between those
  360. 11:46two situations. In a team environment, I
  361. 11:49think there's a lot of benefits from
  362. 11:51having shared infrastructure where
  363. 11:52everyone is using the same workflows and
  364. 11:54systems to implement code changes. That
  365. 11:57way, as a team collectively, you can
  366. 11:59make changes to your setup, your
  367. 12:00prompts, your configuration, and those
  368. 12:03changes benefit every single person in
  369. 12:04the team. This is far better, in my
  370. 12:06opinion, than every single developer in
  371. 12:08the team. Using different models, using
  372. 12:10different harnesses, using different
  373. 12:11prompts, different skills. There's no
  374. 12:13way to kind of have consistency across
  375. 12:15the team in terms of the workflow or get
  376. 12:17any kind of repeatability and it's just
  377. 12:20very hard to make improvements in that
  378. 12:21situation. With a software factory,
  379. 12:24everybody is using the same process. Any
  380. 12:26change you make to your software factory
  381. 12:27configuration benefits every single
  382. 12:30person in the team. And this is the same
  383. 12:32going back to the analogy about CI/CD.
  384. 12:34It's the same idea that the system can
  385. 12:36be improved and it benefits everybody so
  386. 12:39that you have massive massive leverage
  387. 12:41compared to individual people doing
  388. 12:43everything completely differently with
  389. 12:45different agent harnesses and different
  390. 12:46skills, different prompting abilities,
  391. 12:49different techniques, etc. I much prefer
  392. 12:51this idea of a common systems approach
  393. 12:54to implementing software. So I
  394. 12:56personally found it really valuable to
  395. 12:58be using a software factory. I think
  396. 12:59this idea of experimenting and trying
  397. 13:01out different techniques and seeing what
  398. 13:03works and then improving your process is
  399. 13:04probably the most valuable part [music]
  400. 13:06of the software factory process as well
  401. 13:07as having a very repeatable and reliable
  402. 13:09way of working with these coding agents.
  403. 13:12So, I'm going to be using this in my own
  404. 13:13workflow, but like I said, you don't
  405. 13:15need to use a software factory for
  406. 13:16everything you do. If you're working on
  407. 13:18design or iterative work, it doesn't
  408. 13:20make sense to me to be using a software
  409. 13:22factory cuz you need to stay close to
  410. 13:23[music] the code. You want to iterate.
  411. 13:25You want to go back and forth. if you
  412. 13:26want to see things in the browser and
  413. 13:28move very very fast. So I don't think
  414. 13:30that's a good use case. I think I'm
  415. 13:31still going to be using coding agents
  416. 13:33locally but in conjunction with a
  417. 13:34software factory. So I'm going to be
  418. 13:36using software factories for things like
  419. 13:38queuing up large amounts of work that
  420. 13:39happen overnight and then just
  421. 13:41delegating those and sequencing them and
  422. 13:43making sure they run repeatedly and get
  423. 13:45done. And then in the morning I can
  424. 13:46review those tasks. But any kind of work
  425. 13:48where I need to do experimentation, you
  426. 13:50know, I need to talk to an agent, think
  427. 13:52through a problem, um, anything like
  428. 13:54that, then I'm going to still use a
  429. 13:56local coding setup. I hope you found the
  430. 13:58video useful. If you did, please
  431. 14:00remember to like and subscribe. It
  432. 14:01massively helps out the channel. And
  433. 14:03I'll see you in the next one. Take care.
  434. 14:04[music] If you want to go deeper on
  435. 14:06building AI systems, using Aentic coding
  436. 14:08tools, leveling up your career as a
  437. 14:09consultant, as a freelancer, or inside a
  438. 14:12company, I cover all of those things
  439. 14:14inside my community. I've been a
  440. 14:15software engineer for the last 20 years.
  441. 14:17I've been both an independent AI
  442. 14:19engineer. I've worked as a director of
  443. 14:20engineering in a large organization. And
  444. 14:22I've also freelance and build software
  445. 14:25every single day. So, if you need help
  446. 14:26with any of these things, you can check
  447. 14:28out the link in the description below.

About this transcript

This page contains the full transcript of I Built A Self-Improving AI Software Factory by Owain Lewis, generated from the public captions YouTube serves with the video. The transcript has 3,138 words across 447 segments, with the original timestamps preserved so you can click any line to jump to that moment in the embedded player.

What you can do with it

Use the transcript to take notes, quote the speaker, build a study guide, generate a summary with ChatGPT or Claude via the YouTube Summary tool, or export it as a timed subtitle file with YouTube to SRT. You can also re-open it in the transcriber to choose a caption track available on the video.

Free YouTube transcript tool

YouTube2Text is a free YouTube transcript generator — no signup, no daily limit. Paste any YouTube link and get the full transcript instantly, with timestamps, click-to-jump, caption language selection, AI prompts for ChatGPT, Claude, and Gemini, and exports to TXT, SRT, VTT, or Markdown.