Speaker Notes

Anthropic Workshop: Build Agents That Run for Hours — Ash Prabaker & Andrew Wilson

Building long-running autonomous coding agents requires separating generation from rigorous evaluation, simplifying harness architecture as frontier models improve, and maintaining persistent file-based state for seamless collaboration.

AI Engineer · 1:15:40 · YouTube ↗

Talk · 2 speakers  Advanced · Architecture and harness design

Highlights

6 clips · 9 min of 76 min
    • LLMs suffer from generation bias and struggle to rigorously critique their own work.
    • Tuning a separate critic model to be intentionally harsh is highly tractable.
    • Separating generation from evaluation mirrors the human gap between creating and critiquing.
    • Generator and evaluator agents negotiate exact feature definitions before code is written.
    • Asynchronous file-based markdown enables structured back-and-forth agreements.
    • This approach bridges vague user stories into concrete, testable assertions without over-specifying upfront.
    • Claude out of the box is a poor general QA agent due to sycophancy and generosity biases.
    • The primary debugging loop is reading traces to find where model judgment diverges from human intent.
    • Pipelines can be built to parse and feed transcript data back into prompt updates.
    • As frontier models improve, overly complex harnesses like context resetting and frequent sprint decomposition can be dropped.
    • Newer models can maintain coherence over multi-hour continuous builds without force-feeding features.
    • Simplifying the harness setup often reduces costs while sustaining execution quality.
    • Complex context-reset mechanisms can be dropped as newer models handle long sessions natively.
    • Sprint decomposition granularity can be relaxed when model planning capabilities advance.
    • Harness design should evolve to fill remaining model gaps rather than staying static.
    • Using the file system for shared state makes it easy for models to grep and pick up where things left off.
    • Instructing the model to write structured JSON logs of actions, bugs, and fixes creates actionable history.
    • Live-updating documentation files help developers jump back in to collaborate via tools like Claude Code.
    • Avoid sharing the generator's internal traces or reasoning directly with the evaluator or vice versa.
    • Letting the evaluator judge only the final output prevents muddying thoughts between model streams.
    • The generator must independently reflect on raw failure feedback to figure out its own fixes.

Questions this video answers

8 · every answer cites the moment it was said
01 Why do long-running agents fail out of the box? 2 sources · 2:47

Long-running agents struggle due to finite context windows, context rot, and anxiety near the end of sessions. Additionally, models exhibit poor planning capabilities and are inherently bad at judging their own code output objectively.

02 What primitives are included in the Agent SDK harness? 2 sources · 5:04

The Agent SDK provides foundational primitives like the core agent loop driven by Claude, tool calling via MCP servers, and sub-agent delegation. It also includes permission systems and custom commands to build specialized harnesses.

03 How does the Ralph Wiggum loop execute prompts? 2 sources · 8:28

The Ralph Wiggum loop takes a prompt and runs it repeatedly on a loop until all tasks are complete. The core idea is to deterministically repeat execution rather than relying on unpredictable success.

04 Why separate roles into a generator and an evaluator? 2 sources · 18:51

Splitting the agent into a generator and a GAN-inspired evaluator overcomes the model's inability to judge its own work. While building is hard, an evaluator can be effectively tuned to be harsh and thoroughly test apps using tools like Playwright.

05 How do generator and evaluator agents negotiate completion? 2 sources · 25:33

Before writing code, the generator and evaluator negotiate what done means by passing markdown files back and forth on disk. The evaluator pushes back on scope or test cases until both agents mutually agree on a concrete testing contract.

06 How should harness designs change as frontier models improve? 2 sources · 34:54

As models become more capable, you can simplify your harness by dropping complex scaffolding like context resetting or sprint decomposition. Newer models can handle longer continuous sessions with simple compaction rather than force-fed single-feature loops.

07 How do you maintain state for long-running agents instead of relying on context windows? 2 sources · 36:28

You should use a file system for shared state to avoid hitting context window limits in long-running tasks. Instructing the harness to log learnings and JSON status files leaves structured breadcrumbs for future model passes or human developers.

08 How does the generator-critic harness handle failed coding attempts? 2 sources · 47:14

Instead of trying to patch up a messy, failing code context indefinitely, newer frontier models are surprisingly willing to throw away bad work and restart from scratch. This allows them to hill-climb effectively against the evaluator's rubric without human intervention.

Section-by-section summary

17 parts

Core failure modes in long-running agents

Extended agent runs fail due to finite context limits and context rot, poor out-of-the-box planning, and sycophantic self-evaluation where models approve incomplete features. Addressing these issues requires specialized scaffolding around the core LLM loop.

Co-evolving model weights and harness scaffolding

Anthropic's Agent SDK provides core primitives like sub-agents, tool execution via MCP, and permission systems. Harnesses and base models co-evolve, with scaffolding filling model gaps until future training absorbs those capabilities.

Iterative execution using the Ralph Wiggum loop

The Ralph Wiggum technique runs prompts on a repeated loop until tasks complete, favouring predictable failure over unpredictable success. Single-session implementations use stop hooks and max iterations to maintain execution flow.

Structuring long-running harnesses with persistent artifacts

Initializers break vague prompts down into persistent artifacts like feature JSON files, progress logs, and init scripts. A fresh-context loop then incrementally implements features, runs smoke tests, and commits progress.

Splitting roles into a GAN-inspired generator and evaluator

Borrowing from GANs, the harness splits duties between a generator and a separate evaluator agent. The evaluator uses Playwright to test live pages and grade outputs, allowing the system to discard failing paths and restart from scratch.

Systematically evaluating aesthetic taste and design criteria

To prevent generic AI slop aesthetics, the evaluator grades code against weighted rubrics covering design, originality, craft, and functionality. Few-shot examples calibrate the evaluator to converge on desired human tastes.

Negotiating completion contracts between agents

Before coding begins, the generator and evaluator negotiate what completion means through markdown files on disk. The evaluator pushes back on scope and edge cases, ensuring verification targets concrete, agreed-upon assertions.

Adapting harness complexity as model intelligence scales

As newer models gain superior context retention and planning skills, harnesses should be simplified by removing unnecessary context resets and reducing evaluation frequency. Monitoring model traces remains the primary debugging loop for refining prompts.

Core primitives for building long-running coding agents

Developers can build similar self-contained agent loops using primitives like auto mode, custom sub-agents for evaluation, browser automation tools, and packaging grading rubrics into skills.

Iterating prompts on common model weak points for reuse

While individual app setups vary, common patterns like front-end design standards and anti-patterns can be generalized into reusable prompts. This helps the evaluator catch aesthetic issues like AI slop across multiple projects.

Single continuous sessions replace strict window segmentation

Although earlier models required strict task slicing to stay within optimal context windows, recent models with large, reliable context can handle continuous runs with compaction. This reduces the need for complex multi-session workarounds.

Generators easily discard failed work to start fresh

When faced with a strict evaluation rubric, newer models are remarkably willing to delete failing implementations and restart from scratch rather than getting trapped in defensive loops. This mimics human developers seeking a clean slate.

Leave structured breadcrumbs for future model and human passes

Using the file system for state allows long-running agents to record what they tried, what failed, and what passed into a JSON log. Combined with a live-updating doc of the file structure, these breadcrumbs let developers seamlessly pick up the work in Claude Code.

Generator-critic harnesses versus multi-agent teams

The explicit generator-critic pattern works well for autonomous generation, while agent teams offer alternative collaboration frameworks. Ultimately, both approaches overlap, and developers should experiment to see what fits their specific workflow best.

Defining strict rubrics to make agent evaluation scientific

Measuring the quality of a greenfield agent harness relies on specifying detailed rubrics for design, code quality, and API design. The evaluator's role is to push the builder to hill-climb against these criteria throughout the run.

Autonomous greenfield execution versus human-in-the-loop oversight

The primary goal of these long-running harnesses is to achieve fully autonomous execution on greenfield projects without manual babysitting. While hooks and reviews can be added, baking stability into the prompt loop is preferred over constant human intervention.

Developing empathy for the model by reading raw traces

Understanding agent failures requires building an empathetic skill set through extensive review of raw execution traces. Putting oneself in the model's shoes helps refine prompt instructions and prevent recurring missteps.

0:00 / 1:15:40
k play/pause · f fullscreen · m mute
n next · p previous clip · t highlights/full
< > slower/faster · / search what was said
  • Ralph Wiggum loop6× · first 7:59

    A simple harness technique that runs prompts repeatedly in a loop until tasks are complete.

  • Agent SDK5× · first 4:57

    A framework containing core primitives to build general-purpose agent harnesses.

  • Playwright5× · first 19:17

    A tool used by evaluator agents to open live pages and test app functionality.

  • Generator-evaluator pattern10× · first 25:07

    A core architecture loop where one agent generates code and an adversarial evaluator assesses it against strict criteria.

  • Compaction6× · first 9:29

    Summarizing context to allow models to maintain coherence across very long continuous sessions.

  • Playwright MCP5× · first 19:17

    A model context protocol tool used for robust browser control and web app testing.