Claude for Long-Horizon Tasks: Lance Martin's Four Rules for Agents That Run for Hours

AI Engineer 2026: Anthropic Talks
21 parts- 1Claude for Long-Horizon Tasks: Lance Martin's Four Rules for Agents That Run for HoursCurrent
- 2Inside the Claude Managed Agents Workshop: Pets, Cattle, Outcomes and Dreaming
- 3How Anthropic Builds: Mike Krieger on Being Unreasonable With Claude
- 4How Jarred Sumner Ships Millions of Lines of Agent-Written Code
- 5A Field Guide to Fable: Thariq Shihipar on Unhobbling Claude and Finding Your Unknowns
- 6Claude Tag Lands 65% of Anthropic's Product PRs: Takeaways From Cat Wu and Thariq Shihipar
- 71,000 Claude Agents, Git and a Database: How Fable 5.2 Formalized Fermat Without a Custom Harness
- 8Your Old Prompts Are Making Claude Worse: Lance Martin's Checklist for Frontier Models
- 9Why One Agent Isn't Enough: Anthropic on Flows, UltraCode and Running 1,000 Agents
- 10Tokens Should Have Jobs: Anthropic's Case for Advisors, Graders and Dreamers
- 11Give the Agent a Budget, Not a Token: Anthropic's CI Team on Safe Agent Permissions
- 12Rethinking Claude Code Best Practices: Lydia Hallie on Getting Out of the Loop Safely
- 13How Anthropic Merges 30,000 Code Changes a Day: Addy Osmani on Verifying the Software Factory
- 14Using LLMs to Secure Source Code: Eugene Yan's Six-Step Pipeline From Anthropic
- 15From Messages API to Managed Agents: Anthropic's Applied AI Team on Harnesses That Go Stale
- 16Forward Deployed Engineering 101: When Your AI Startup Needs FDEs, From Palantir to Anthropic
- 17The Enterprise Tech Stack for AI Agents: Why Your POC Stalls and How to Design Past It
- 18The Claude Certified Architect Exam as a Field Guide to Agentic Engineering
- 19The Future of MCP: David Soria Parra on Connectivity, Progressive Discovery and Skills Over MCP
- 20Gateways Are All You Need: How Anthropic Thinks About MCP in the Enterprise
- 21How to Build Agents That Run for Hours: Anthropic's Planner, Generator and Evaluator Harness
TL;DR
Lance Martin of Anthropic on building long-horizon agents: decouple the brain from the hands, verify in a separate context, dream to fix memory, and go org-level.
Lance Martin works on the Claude Platform at Anthropic, including Claude Managed Agents. At the AI Engineer World's Fair 2026 they gave a 25-minute talk on what changes when a model can work unattended for many hours instead of a few minutes. It is one of the most compact statements of how Anthropic is thinking about agent architecture right now, and it is worth watching in full.
Source: Claude for Long-Horizon Tasks, Lance Martin, AI Engineer World's Fair 2026. Talk page with slides and corrected transcript: ai.engineer.
What follows is our read of the talk: the four themes, what we think they mean for people building agents, and where we would push back.
The Window Has to Move With the Light#
Martin opens with a metaphor. The model is a light source; products are windows that let the light through. When the light changes, the old window stops showing what the model can do.
They sketch three regimes using METR's task-horizon measurements (which measure how long a task takes a human expert, at a given agent success rate, not how long the agent runs):
- Minutes of autonomy (roughly the Opus 3 era, 2024). Autocomplete and chat make sense because the human steers after every small unit of work.
- About an hour (the synchronous coding-agent era). Claude Code runs locally where you can watch and intervene. Martin admits that early asynchronous agents in this regime felt bad: the agent leaves, hits an error, and is back in your inbox ten minutes later.
- Many hours (now). Delegation finally pays off because the agent can get a lot done between check-ins.
The API surface tracked the same curve. The Messages API is prompt in, response out, and you build and deploy your own harness. The Agent SDK hands you Claude Code's harness to call programmatically. Managed Agents, released in April 2026, packages the harness and the deployment infrastructure together. The rest of the talk is the set of ideas underneath that last layer.
The practical takeaway: if your product UX was designed when agents could only do an hour of work, it is probably the wrong window now.
Theme 1: Decouple the Brain From the Hands#
The first Managed Agents prototype put the harness and the sandbox in the same container. Two problems showed up:
- Fragility. If the container died, the session died with it. For a ten-hour run that is unacceptable.
- Credential exposure. Leaving secrets in the same box as a highly capable model that runs unwatched for hours is, in Martin's word, "spooky."
The fix splits the system into three parts:
%% title: Brain, session and hands in Managed Agents
flowchart TD
H[Harness: stateless brain]:::emphasis --> S[Session: append-only event log]
H --> C1[Container A]
H --> C2[Container B]
V[Credential vault] -.-> HThe harness is a stateless process. The session is an append-only event log. The "hands" are just sandboxes where tools run, and a single harness can drive many of them. If a harness or a sandbox dies, nothing is lost because the session survives, and credentials live in a separate vault rather than in any sandbox. Anthropic's engineering blog has the long version: Scaling Managed Agents: Decoupling the brain from the hands.
The part we found most interesting is the context-engineering consequence. Martin connects it to the Recursive Language Models work: if the session is a persistent, never-rewritten object the model can query, then compaction stops being destructive. Normal compaction throws away whatever did not make the summary. Here the summary is just a view, and the model can always go back and fetch the original events.
That is a real design rule you can apply today even without Managed Agents: keep the raw log, treat summaries as a cache. If your agent framework overwrites history when it compacts, you have built in a slow memory leak of exactly the details you will need at hour six.
Theme 2: Verify in a Separate Context#
The second theme is one most agent builders have learned the hard way. Ask a model to do the work and then grade the work in the same context, and you get confabulation. The context is full of the model's own reasoning, and it is not tuned to be critical.
Anthropic's answer is to give verification its own context window, with its own goal or rubric, and loop:
- A build context does the work.
- A verifier context checks it against a measurable end state.
- The loop exits only when the independent verifier is satisfied.
In Claude Code the primitive is a goal; in Managed Agents it is called outcomes. Same idea.
Martin's demonstration was OpenAI's Parameter Golf challenge, which asks a model to train a small language model on eight H100s in under ten minutes, scored on loss. They set up an outcomes loop with Managed Agents and let frontier Claude models iterate until the benchmark's experimental criteria were met. They report it finished in exactly twenty iterations.
Their framing of why this works is the line we would put on a sticky note: instead of the human being the source of steering, you encode the signal into the environment, so the model can self-correct when the verifier pushes back. We have written about the same shift in loop engineering; this talk is a good argument that it gets stronger, not weaker, as models improve.
Theme 3: Self-Learning, and Why Agents Need to Dream#
Martin borrows from neuroscience. During the day the hippocampus writes fast, short-term traces. At night, an offline process consolidates the important parts into long-term memory and lets the rest fade.
Claude agents can use both halves:
- In-band memory. Give the model memory tools, which in practice means a directory it can write files to. Martin shows Claude Plays Pokemon: Sonnet 3.5 wrote tactical, low-value notes and made limited progress; newer models write strategic notes and get much further. They also cite an open benchmark they ran (Continued Learning Bench) where a sequential SQL question-answering task improves across model generations when memory writes are allowed between steps.
- Out-of-band memory ("dreaming"). In-band memory has a flaw: notes written mid-task are locally optimal. They help finish the current task, sometimes encode a wrong lesson, and rarely consider future tasks. Dreaming is an offline pass over past sessions and the memory store that corrects and consolidates. Anthropic shipped this as a Managed Agents feature; see Dreaming and outcomes in Managed Agents and our earlier write-up on dreaming and outcomes.
Their key observation on what separates stronger models: the difference is mostly in distillation. Weaker models save specific facts. Stronger models save the abstraction that will generalize to the next session.
Do not prescribe a memory schema#
The best part of the Q&A came from a question about file systems versus databases. Martin's answer: the substrate barely matters. What hurts performance is telling the model in advance what types of memories to save. A general, programmable substrate (files, or a database with simple primitives) that the model structures itself beats a hand-designed memory taxonomy. They call this "Bitter Lesson-pilled."
That cuts against a lot of current memory products, which ship with fixed categories like preferences, facts and episodes. If you are evaluating a memory provider, this is a good question to ask it: can the model reorganize memory itself, or is it filling in your form?
Theme 4: Org-Level Harnesses#
The last theme is about Claude Tag. Martin acknowledges that a lot of people looked at it and saw "a Slackbot." Their argument is that the Slack surface is the least interesting part. What matters is that it is an organization-level harness:
- It has its own identity and credentials, not tied to one employee.
- It has organizational context, not just one person's local setup.
- Everyone gets a fully configured harness on day one, instead of new hires spending weeks wiring up their own connectors.
They predict two UX shifts follow: agents become proactive (watch org context and tell me what I need to know) and multiplayer (many people steering one harness at once). Our deeper look at the product is in Claude Tag as an agent workspace.
Why the Frontier Gap Is Not Just the Model#
An audience member asked why frontier models hold a lead on long-horizon benchmarks. Martin noted that both frontier Claude models and OpenAI's recent Codex models sit in what they called the twelve-plus-hour regime on METR, and then made the more useful point: long-horizon agents need memory, prompt-injection resistance, a failure-tolerant architecture and security, all at once. Frontier labs have invested in all of those, which may explain part of the product gap.
Our Take#
This is a talk about infrastructure dressed up as a talk about models. The four themes are really four places where a naive agent loses work over a long run: a dead container, a self-graded result, a wrong lesson stuck in memory, and a harness that only one person can use.
Two things to apply this week, whatever stack you are on:
- Make history append-only. Summaries are views; the log is the truth.
- Split the grader from the worker. Even a cheap second context with a crisp rubric beats asking the same context "are you done?"
Where we would push back: dreaming costs offline compute, and the evidence shown on stage was mostly anecdotal (Pokemon). Martin says Anthropic has run evals showing it helps, but you should run your own before paying for it on every agent.
FAQ#
What does "decoupling the brain from the hands" mean?#
The harness (the brain) runs as a stateless process, the session is stored as an append-only event log, and tools execute in separate sandboxes (the hands). If any piece fails the session survives, and credentials never sit inside a sandbox.
What is dreaming in Claude Managed Agents?#
An offline process that reviews past sessions and the agent's memory store, then corrects and consolidates memories. It fixes notes written mid-task that were locally useful but wrong or too narrow for future tasks.
Should agent memory live in a file system or a database?#
According to Martin, either works. What matters is giving the model a general substrate with simple primitives and letting it structure memory itself, rather than prescribing a fixed memory schema.
Sources#
- Claude for Long-Horizon Tasks - video and talk page
- Scaling Managed Agents: Decoupling the brain from the hands - Anthropic Engineering
- METR task-completion time horizons
- Recursive Language Models
- Introducing Claude Tag
The Full Series#
This post is part of our coverage of Anthropic's talks at AI Engineer 2026:
- Inside the Claude Managed Agents Workshop: Pets, Cattle, Outcomes and Dreaming
- How Anthropic Builds: Mike Krieger on Being Unreasonable With Claude
- How Jarred Sumner Ships Millions of Lines of Agent-Written Code
- A Field Guide to Fable: Thariq Shihipar on Unhobbling Claude and Finding Your Unknowns
- Claude Tag Lands 65% of Anthropic's Product PRs: Takeaways From Cat Wu and Thariq Shihipar
- 1,000 Claude Agents, Git and a Database: How Fable 5.2 Formalized Fermat Without a Custom Harness
- Your Old Prompts Are Making Claude Worse: Lance Martin's Checklist for Frontier Models
- Why One Agent Isn't Enough: Anthropic on Flows, UltraCode and Running 1,000 Agents
- Tokens Should Have Jobs: Anthropic's Case for Advisors, Graders and Dreamers
- Give the Agent a Budget, Not a Token: Anthropic's CI Team on Safe Agent Permissions
- Rethinking Claude Code Best Practices: Lydia Hallie on Getting Out of the Loop Safely
- How Anthropic Merges 30,000 Code Changes a Day: Addy Osmani on Verifying the Software Factory
- Using LLMs to Secure Source Code: Eugene Yan's Six-Step Pipeline From Anthropic
- From Messages API to Managed Agents: Anthropic's Applied AI Team on Harnesses That Go Stale
- Forward Deployed Engineering 101: When Your AI Startup Needs FDEs, From Palantir to Anthropic
- The Enterprise Tech Stack for AI Agents: Why Your POC Stalls and How to Design Past It
- The Claude Certified Architect Exam as a Field Guide to Agentic Engineering
- The Future of MCP: David Soria Parra on Connectivity, Progressive Discovery and Skills Over MCP
- Gateways Are All You Need: How Anthropic Thinks About MCP in the Enterprise
- How to Build Agents That Run for Hours: Anthropic's Planner, Generator and Evaluator Harness
Continue Reading#
Get the next deep dive like this in your inbox
One email a week on Anthropic and the rest of the AI dev stack. Free.
Read next on Claude Code
Claude Managed Agents Public Beta: What's Actually Available vs What's Gated
Claude Managed Agents public beta reviewed: what ships today, which orchestration features are gated behind a research preview, what it costs, and when to DIY.
8 min readClaude Managed Agents: Dreaming, Outcomes, and Multi-Agent Orchestration Explained
Claude Managed Agents added dreaming, outcomes and multi-agent orchestration in 2026. How each primitive works and when to use the three together.
8 min readLong-Running Agents Need Harnesses, Not Hope
Long-running coding agents need a harness: task contracts, scoped workspaces, logs, checkpoints, verification gates, and cost limits to recover from failure.
9 min readTechnical content at the intersection of AI and development. Building with AI agents, Claude Code, and modern dev tools - then showing you exactly how it works.








