# "The Art of Loop Engineering: How to Build Agents That Improve Over Time"
<!--
ref: @content/youtube/langchain/the-art-of-loop-engineering-how-to-build-agents-that-improve-over-time
tags: [loop engineering, agent loop, verification loop, event-driven agents, self-improvement, evals, human in the loop, memory]
version: 2
updated_at: 2026-11-22T09:16:36.071Z
-->

**[Watch on YouTube](https://www.youtube.com/watch?v=jPPiZ22DY3g)**

# The Art of Loop Engineering: How to Build Agents That Improve Over Time

*Synthesized from Sydney's talk on LangChain, 2026-07-23.*

Sydney, a product manager on the open source team at LangChain and formerly a software engineer, presents a webinar (after a short product intro video) followed by audience questions.

## Core Thesis
Sydney argues that an agent's advantage lies less in the agent itself than in the loops built around it. She describes four nested, composable loops: the core agent loop, a verification loop, an event-driven loop and a self-improvement (hill climbing) loop, with human approval placed where it adds value.

## Key Insights
- **Loop 1, core agent loop.** A model receives context, calls tools, gets observations and repeats until done. Engineering here means giving the right tools, matching model strength to task difficulty to manage cost, and writing good tool descriptions.
- **Loop 2, verification loop (a slash-goal style loop).** A grader scores the result against criteria and feeds failures back into the agent loop. Sydney's example is "implement this feature and don't stop until all tests pass and coverage is at 95%". DCode, LangChain's terminal coding agent built on Deep Agents, shows the rubric up front for review, and the same goal or rubric middleware can be plugged into any LangChain or Deep Agents agent. It helps most when using a cheaper model on hard tasks. For the docs agent, the grader checks that all links resolve and CI passes before notifying a human.
- **Loop 3, event-driven loop.** Triggers (scheduled or event-based) start agents inside Slack, GitHub, email and calendars, where people already work; the agent updates a system, which prompts further triggers. Sydney's examples are a morning calendar summarizer and an email assistant, plus a Slack channel for docs requests that returns a pull request.
- **Loop 4, hill climbing loop.** A background agent (called Engine at LangChain) reads traces to find failure modes such as bad tool arguments, missed tool calls or ignored preferences, then edits prompts, tools, skills and memory in the source. It covers procedural changes and memory consolidation (an email assistant learning to be formal with a boss). It is hard to trust without evals to catch regressions.
- **Automation levels.** Loop 1 automates work, loop 2 adds reliable checks, loop 3 improves the surrounding system, loop 4 improves the agent. A hypothetical loop 5 would auto-merge harness changes that pass an RL-style eval environment.
- **Human approval points.** Sensitive tool calls (send email, book travel), the grader cycle, workflow artifacts such as PRs, and harness code changes.
- **Q&A.** Memory contents are agent-specific, and evals show whether saved memory helps; two memory styles are repo wikis and personal wikis (OpenWiki, built on Deep Agents). Loops add latency, trading correctness against cost; set timeouts and cycle caps on sub agents. Compress earlier attempts to fight context rot. A verification loop is described as "an eval in a trench coat" and is proven only with online evals. A newly released eval engineering skill generates evals from traces and interviews the user. Two eval types are wanted, baseline unit-test style and hard end-to-end. Change memory, skills and prompts before architecture, because failures usually come from missing information, not model weakness.
- **Events.** Interrupt 2026 is in New York on September 24 and in London on October 13.

## Actionable Takeaways
1. Start with a core loop, then add a grader with explicit, human-reviewable criteria.
2. Trigger agents from Slack, GitHub or email, and send approval requests to those same places.
3. Run a background agent over traces to propose prompt, tool, skill and memory changes, gated by an eval suite.
4. Keep baseline evals strong so regressions are caught.
5. Prefer changing memory, skills and prompts before changing agent architecture.
6. Add timeouts and maximum cycle counts to bound latency and cost.

## Notable Quotes
> "this just sounds like an eval in a trench coat" — Sydney

> "the advantage is not just in the agent that you build to automate work, but rather in the loops that you build around it" — Sydney

> "automation does not necessarily mean removing humans" — Sydney

---

*Related: `@content/web/huggingface/2026-11-23-cua-see-self-evolving-evals` · `@protocol/memento` · `@content/youtube/eo-global/the-problem-with-ai-agents-no-one-is-talking-about-yutori-abhishek-das` · `@content/youtube/nate-herk/i-tested-openai-s-dots-vs-meta-s-muse-what-you-need-to-know` · `@content/youtube/nate-herk/5000-hours-of-building-ai-in-just-17-minutes`*

---

*You're reading a protocol on [protocol.supply](https://protocol.supply) — hosted, searchable knowledge for AI agents. Think Agent Skills, as an API: bootstrap once (`curl -sL https://api.protocol.supply/bootstrap`), search (`/search?q=…`), fetch (`/@repo/slug`).*

*Any skill can become a protocol, and any protocol installs as a local skill — tell your agent "install this as a skill" or see [`@protocol/protocol-to-skill`](https://api.protocol.supply/@protocol/protocol-to-skill).*