Free YouTube Transcribe

Video transcript

Loop Engineering explained in 8min..

Caleb Writes Code · 1,672 words · 8 min read

Want to search this transcript, jump the video from any line, or download it as TXT, SRT, or VTT?

Open in the transcript tool

Full transcript

Intro

0:00Well, here we are again with yet another

0:02term called loop engineering. And it

0:04wasn't even that long ago we had harness

0:06engineering. So, is this just a

0:07marketing hype or is there actually

0:09something substantial behind loop

0:11engineering? Let's walk down from prompt

0:13engineering all the way to loop

0:14engineering to see why we need it each

0:16step of the way. We all know by now what

Prompt Engineering

0:19prompt engineering is. Let's say I start

0:20with the prompt, you are a helpful

0:22customer service rep. Please be nice to

0:24my customers. This is prompt engineering

0:26because you are prompting the agent by

0:28implicitly telling the agent what to do.

0:30And we can then ask AI any question and

0:32the agent will impersonate a customer

0:35service rep based on the prompt we just

0:37generated. That makes sense and super

0:39simple. So why do we need context

0:40engineering? Turns out this prompt that

0:42we just created lives inside of the

0:44agents context window and we still have

0:47a lot of room left in our context to do

0:50something more useful. So what if we

0:52gave the agent autonomy to invoke tools

0:54to start filling up its own context

0:57based on what the prompt actually needs?

0:59This was the beginning of context

Context Engineering

1:01engineering where the agent could now

1:02access files to load and make changes or

1:05even use MCP to start interacting with

1:08databases and external applications to

1:10load its own context. Cool. Context

1:12engineering makes sense. So then why do

1:14we need harness engineering? Well,

1:16there's actually no inherent flaw to

1:18context engineering, but rather it has

1:20limitations. Context engineering is not

1:23really good at tasks that take longer

1:25than 5 to 10 minutes long. And here's

1:26why. Tasks that take long tend to

1:28require more context than what the agent

1:31can handle. And while it could keep

1:33summarizing its own context as it

1:35approached the limit, it was extremely

1:37leaky where important details started to

1:40get lost in each step of the

Harness Engineering

1:42summarization. So essentially we needed

1:44a system outside of context engineering

1:47to better manage internally its own

1:50context from outside in and this very

1:52external system is what we call harness

1:55engineering. Harness engineering manages

1:57the context from the outside and helps

2:00the agent runtime to work on tasks that

2:02help break down the user's requirement

2:05into a more stable execution. Let's look

2:07at a few examples to make sure that we

2:09understand this more concretely and

2:11we'll use chatib and clot code since

2:13it's something that we all have hands-on

Sponsor: Verda

2:15experience in. But before we dive in,

2:17today's video is sponsored by Verta. If

2:18you write code for a living, you

2:20probably hit a point where your own

2:21machine just can't handle what you're

2:23trying to build. And that's the gap that

2:25Verta fills in. Verta is a full stack AI

2:27cloud built for the whole model life

2:29cycle. from a single GPU instance and

2:30instant clusters to serverless inference

2:33and manage endpoints. It isn't a general

2:35purpose cloud with AI bolted on after

2:37the fact. It's built specifically for AI

2:39work by people who actually train and

2:41serve models. So the workflow is

2:43designed around how you'd actually use

2:44it. And the workflow is the part that I

2:46like. You sign up, spin up an instance,

2:48and pick your GPU, anything from the new

2:50GB300 down to an older V100. You then

2:53drop in your SSH key, and you're

2:55straight in from your own terminal. I

2:56just SSH in from VS Code, drag my code

2:59across, and I've got all the VRAMm that

3:01the card gives me to run without ever

3:03leaving my editor. There's also a CLI if

3:06you'd rather stay in the terminal start

3:07to finish. Spin instances up, manage

3:10them, and connect all from the command

3:12line. On the hardware side, you get

3:13serious NVIDIA GPUs like B300's with

3:16NVLink, Infiniband, and fast NVME

3:18storage for workloads where interconnect

3:20and throughput actually matter. And if

3:22you're working with data or model

3:24weights you can't afford to expose, Vera

3:26supports confidential computing, so your

3:28workload stays encrypted while it's

3:30actually running on GPU, not just

3:31sitting in storage. Link in the

3:33description. Use code Caleb-50 to get

3:35$50 off of compute for just $5. That's

3:3890% off of your first top up. Thanks

3:40again, Vera, for sponsoring. Asking

Practical Examples

3:42Chachib the question, "How many

3:44cheeseburgers can I fit between the

3:46Earth and the Moon?" This is solely

3:47using prompt engineering because it

3:49doesn't need anything external to answer

3:52a very simple question. It can just

3:54reason through what it already knows to

3:56answer my question. Now asking chacheti

3:59what is the latest discovery that NASA

4:01made. This now has to use context

4:03engineering because it has to search the

4:05web and gather relevant information from

4:08NASA to help answer my question. So

4:10context engineering helps bringing

4:12information from the web autonomously.

4:14Now when I ask clot code, can you clone

4:16the entire NASA website? This is all

4:19done by harness engineering because the

4:21NASA website as you can imagine is

4:23really complex and simply relying on

4:26context engineering on tasks like this

4:28will start to choke midway through. So

4:30harness engineering provides an external

4:32mechanism to help manage the context and

4:35the runtime for the agent to work

4:37through a long list of tasks. Now you

Loops

4:39might have noticed a pattern that

4:41emerges from this and that pattern is

4:43the concept of loops. For context

4:45engineering, there's a loop where the

4:47agent recursively calls tool after tool

4:51autonomously until it thinks that it has

4:53enough context to answer your question.

4:55And for harness engineering, there's

4:57also a loop where the agent has a list

4:59of tasks outside of the context window

5:01to keep iterating task after task until

5:04the entire operation is finished. So

5:07what we find is that we are essentially

5:09stacking loop on top of another loop.

5:11Now we get to loop engineering which is

5:13yet another loop in itself. I know is

5:16there even an end to this. So loop

5:17engineering stacks another loop outside

5:20of harness engineering layer to guide

5:22the harness externally. But why why do

5:25we even need yet another scaffolding?

5:27Again at the heart of loop engineering

5:29loop engineering targets the human

5:31interaction in actually prompting the

5:33agent to do something. Everything that

5:35we have seen so far involves a human

5:38asking the agent questions like, "How

5:40many cheeseburgers can I fit between

5:41Earth and the moon? What is the latest

5:43news on NASA?" Or even clone the NASA's

5:46website. These are prompts that require

5:47me to actually prompt the agent. But

Why Loops?

5:50what if we built a scaffolding outside

5:52of this so that the agent can also

5:54prompt itself on what it thinks it needs

5:57to do? That is the heart and the spirit

5:59of what loop engineering tries to

6:01target. And if all of this sounds hokeyp

6:03pokey to you, you're probably not alone.

6:05There's a lot of people saying loop

6:07engineering is just a buzzword and

6:09that's trying to encourage people to

6:11just burn more tokens and create more AI

6:13slop. And so far, we have really yet to

6:16see loop engineering in action that

6:18really makes a huge difference. But it

6:20could be the next evolution in our

6:22engineering philosophy as agents expand

6:25its scopes in what it can help us with.

6:28And it does raise a really interesting

6:29debate and discussion around all of

6:31this. So what exactly is loop

6:34engineering and how does all of it work?

6:36Addiosman wrote a blog describing loop

6:38engineering with six components. But we

6:41don't want to read all of this. So

6:42instead of boring you with details, I'm

Loop Example

6:44going to give you a potential use case

6:46of loop engineering that help you wrap

6:48your head around what loop engineering

6:50could look like. Let's say I built a

6:52website that keeps track of the World

6:54Cup scores. And when I ask Codeex to

6:56build me a World Cup website, Codex will

6:58use prompt, context, and harness

7:00engineering to build this beautifully

7:02written website. Now, there's one

7:04problem here, and that problem is that

7:06the World Cup games are happening every

7:08single day. And that means in order to

7:11maintain the website that I just created

7:13through Codeex, I have to keep prompting

7:15the agent to frequently update the site

7:17and also work on bug fixes that people

7:20might find on the website. But what if I

7:22just created a schedule task inside of

7:24Codeex to check every hour for updates

7:26as new information becomes available?

7:29And what if I do the same for bug fixes

7:31where the agent just checks autonomously

7:33for bugs that are reported by users and

7:36fix them. What you're seeing here is

7:37that we are beginning to create this

7:39loop outside of harness engineering

7:41where it's self-guided rather than

7:43humanguided to maintain my website. And

7:46because I have skills and plugins

7:47already installed on my codeex

7:49environment, the agent can access an

7:51existing knowledge base to keep building

7:53and improving its knowledge along the

7:55way. And the agent can also use sub

7:57agents to verify its own work and also

8:00the ability to work on multiple fixes at

8:02the same time by using what's called

8:04work tree to prevent runtime

8:06contamination along the way. All of

8:07these that I just mentioned are

8:09essential ingredients to what makes loop

8:12engineering what it is. And that is the

8:14six components that Addi Osmani wrote in

8:16his blog. Automation, workree, skills,

8:19plugins and connectors, sub aents and

8:21state are components of loop

Conclusion

8:23engineering. And while this World Cup

8:25website that I just created is just an

8:27example of what loop engineering could

8:29look like, the true potential of what

8:31loop engineering could really be is

8:34still somewhat theoretical. And one

8:35thing to keep in mind is that loop

8:37engineering doesn't necessarily mean

8:38that all the engineering philosophy

8:40underneath is less important or even

8:43less needed that before. It's just

8:45agents growing in scope and building on

8:47top of each other.

This transcript was generated from the captions YouTube publishes for this video. Get the transcript of any YouTube video atfreeyoutubetranscribe.com: free, unlimited, no sign-up.