Effective harnesses for long-running agents
by Anthropic
Anthropic's two-agent pattern for keeping a coding agent productive across dozens of context windows.
Overview
Effective harnesses for long-running agents is a November 26, 2025 post on Anthropic's engineering blog, written by Justin Young with contributions from several Anthropic teams. It tackles a concrete failure: when an agent works on a project spanning many context windows, every new session starts with no memory of the last, like an engineer arriving for a shift with no handover. The post is organised around the long-running agent problem, environment management, a table of agent failure modes and their fixes, and future work. Its solution is a two-part harness built on the Claude Agent SDK. An initializer agent runs once and writes an init.sh script that starts the dev server, a claude-progress.txt log, a feature_list.json of requirements each marked passing or failing, and an initial git commit. A coding agent then runs in every later session: it reads the progress file and git log, checks that the app still works, implements one failing feature, tests it, and ends with a descriptive commit. The four failure modes it addresses are declaring victory too early, leaving buggy or undocumented state, marking features done without testing, and not knowing how to run the app. End-to-end testing uses a Puppeteer MCP server, so Claude verifies features through the browser the way a user would. The pattern ships as the open-source autonomous-coding quickstart in the anthropics/claude-quickstarts repository, which adds an OS-level sandbox and a bash command allowlist for unattended runs.
At a Glance
- Topic
- Agentic
- Level
- Intermediate
- Format
- Guide
- Cost
- Free
- Duration
- ~20 min read; the companion quickstart runs 5-15 min per agent session and many hours for a full app
- Provider
- Anthropic
- Hands-on
- Yes — code/exercises
- Certificate
- None
What You’ll Learn
- ✓Why agents lose track of progress when one task spans many context windows
- ✓How to split a harness into a one-time initializer agent and a repeating coding agent
- ✓How to use a feature_list.json of pass/fail requirements to stop premature completion claims
- ✓How to hand off state between agent sessions with a progress file and git history
- ✓How to write an init.sh so every new session can start the app reliably
- ✓How to verify features end to end with browser automation through a Puppeteer MCP server
- ✓How to constrain an unattended agent with a bash allowlist and project-only filesystem access
Highlights
- •A failure-mode table maps four observed agent failures to a specific fix in both the initializer agent and the coding agent
- •Comes with a runnable autonomous-coding quickstart in anthropics/claude-quickstarts (~17.7k GitHub stars) that generates a 200-test feature list and builds an app across many sessions
- •The quickstart demonstrates defence in depth for unattended runs: an OS-level sandbox, project-directory-only file access and a bash command allowlist enforced by a security hook
- •Discussed on Hacker News (125 points, 37 comments), where practitioners push back that JSON feature lists reinvent issue trackers and that the last 30% of a project stays expensive
- •Uses plain artifacts (a text log, a JSON file and git) rather than a proprietary memory service, so the pattern ports to other agent frameworks
Who It’s For
Best For
- ✓Developers building autonomous coding agents that must run for hours without supervision
- ✓Teams running the Claude Agent SDK or Claude Code in headless or scheduled pipelines
- ✓Engineers designing memory and handoff between agent sessions
Prerequisites
- •Experience running an LLM coding agent such as Claude Code or a comparable CLI agent
- •Comfortable with git, shell scripts and running a Node.js web dev server
- •For the quickstart: an Anthropic API key, Python, and the Claude Code CLI installed via npm
FAQ
What is Effective harnesses for long-running agents?
An Anthropic engineering guide on getting AI coding agents to make steady progress on tasks too large for one context window. It is aimed at developers building autonomous agents with the Claude Agent SDK or a similar harness, and shows how to structure an initializer agent, a coding agent and on-disk state so one agent can build a full application over many sessions.
Is Effective harnesses for long-running agents free?
Effective harnesses for long-running agents is free to access.
What level is Effective harnesses for long-running agents for?
Effective harnesses for long-running agents is aimed at a intermediate audience. Recommended background: Experience running an LLM coding agent such as Claude Code or a comparable CLI agent, Comfortable with git, shell scripts and running a Node.js web dev server, For the quickstart: an Anthropic API key, Python, and the Claude Code CLI installed via npm.
How long does Effective harnesses for long-running agents take?
Expect roughly ~20 min read; the companion quickstart runs 5-15 min per agent session and many hours for a full app. Most learners work through it at their own pace.
What will I learn from Effective harnesses for long-running agents?
You'll learn: Why agents lose track of progress when one task spans many context windows; How to split a harness into a one-time initializer agent and a repeating coding agent; How to use a feature_list.json of pass/fail requirements to stop premature completion claims; How to hand off state between agent sessions with a progress file and git history; How to write an init.sh so every new session can start the app reliably; How to verify features end to end with browser automation through a Puppeteer MCP server; How to constrain an unattended agent with a bash allowlist and project-only filesystem access.
Topics
Sources
This page was written from 3 sources, 2 on domains other than anthropic.com.