AgentScope Durable: Durable Execution for Always-On AI Agents
AgentScope Durable provides a durable execution framework for AI agents, separating task lifecycles from process lifecycles to support automatic recovery, session replay, async tool execution, event-driven wakeup, and parallel task threads — enabling always-on agents that survive disconnections, restarts, and long-running operations.
Reading font

The main consumer of tokens is shifting from humans triggering tasks to autonomously running agents. Agent tasks now span hours or days, exceeding the lifetime of browser connections, service requests, and processes. This article shares the thinking and practice behind durable execution for agents, with the implementation open-sourced as AgentScope Durable.
01 Persistence Is Not a New Concept
Classic software persistence — compute, storage, and data persistence — all answer: what to save, where to save, and how to resume after interruption. Compute persistence saves progress (e.g., model weights, optimizer state, step count) so training can resume from a checkpoint after a machine failure. Storage persistence ensures volumes outlive compute instances. Data persistence guarantees written records survive process restarts.
02 Common Persistence Techniques
Key techniques include redundant replicas, write-ahead logging, snapshots, and checkpoints. Redundant replicas protect against infrastructure failure but not logical errors. Write-ahead logging (e.g., database WAL) persists changes before applying them, enabling recovery. Snapshots capture state at a point in time; checkpoints add the execution position needed to resume (e.g., stream processing offsets).
03 From Data Persistence to Task Persistence
Durable Execution separates task lifecycle from process lifecycle. Agent tasks now run for hours or days, surpassing process lifetimes. A Harness organizes context, tool calls, task loops, and interaction control. Durable Harness adds persistent state and recovery rules so agents continue the same task after process exit — not merely saving chat logs but turning agents into uninterruptible compute services.
04 What Is AgentScope Durable?
Vercel's durable-harness (Oct 2024) implements durable execution via persistent logs and reliable queues. AgentScope Durable provides an enterprise-grade framework with: automatic recovery after interruption, session replay, in-execution user interjections, and async tool execution in isolated sandboxes. Tasks retain progress across user disconnects, service restarts, or instance replacements.
Example: A dev agent investigates a fault, modifies code, runs a 20-minute test, then awaits approval (possibly next day). The user closes the page; a rolling deploy replaces the instance. The task must not restart. AgentScope Durable preserves task identity, context, execution position, tool operations, and wait conditions. Users reconnect to the original task; new instances read confirmed results; test completion or approval resumes execution.
Interactions become clearer: "Summarize after investigation" queues as a follow-up task; "Don't modify production config" injects as an interjection at a safe boundary without retracting already-issued tool calls. Durable ensures continuity, not correctness — tests may fail, models may err; the framework preserves facts, results, and continuation conditions.
05 AgentScope Durable Architecture and Execution Flow
Three-layer responsibility separation:
ReActAgent : reasoning loop — autonomous model reasoning, action, and continued reasoning based on results.
HarnessAgent : context organization — compression, long-term memory, workspace, skills, sub-agents.
Durable : task acceptance, cross-instance recovery, async tool calls, persistent waits, result delivery, event replay, persistent storage.
Durable splits reasoning (Brain) and tool execution (Hands). Brain retains Harness, context, and decisions, selecting Executors via tool bindings. Hands receive calls, manage state and output, and execute in Sandboxes or external systems. Native permission checks still apply before tool invocation.
Execution flow: a request enters DurableRuntime, which persists the task and schedules the agent. HarnessAdapter integrates the agent's native checkpoints into SessionBackend so the execution position is readable on next invocation. For independent tools, Runtime delegates to Executor (Hands), waits for results, then continues the original task.
Components can co-locate in one JVM or deploy separately. API services handling only submit/query/observe need not run the agent loop; execution hosts explicitly start Runtime to claim and advance persistent tasks. Durable embeds independently, without requiring a Managed Agents platform.
Five concrete capabilities for Always-on:
Request queuing and in-execution interjection : new work via submit creates new Turns queued by acceptance order; supplements via steer apply to the current Turn at safe boundaries. Durable records acceptance order and supplemental requirements.
Session disconnect/reconnect and replay : app persists Session, Thread, Turn identities; on reconnect, reads message history, state snapshots, and cursor-based persistent events to resume the original task. Replay reconstructs the user-visible process without re-invoking models or tools.
Long-running tool async execution and precise recovery : Durable stores executionId, parameters, execution state, result, and whether the agent has consumed the result. Recovery respects actual state: still running → wait; completed → deliver result; uncertain → verify — never blindly re-run.
Event wakeup and auto-claim after long-task interruption : RocketMQ async messages detect changes promptly; periodic scans act as fallback. Instances acquire execution leases via shared Backend; lease expiry triggers handoff to a compatible instance; fencing prevents stale instances from overwriting new progress.
Parallel repair and independent review via Threads : a Session contains multiple Threads, each with its own history, checkpoints, and task queues, advancing in parallel when resources allow. File, credential, and Sandbox sharing requires explicit configuration.
All five capabilities share three foundations:
Stable identities : Session, Thread, Turn, requestId, executionId — enabling tasks and tool ops to be located after interruption.
Persistent records : checkpoints, tool execution records, persistent events — documenting progress and confirmed results.
Explicit rules : save-then-deliver results, consume-then-acknowledge, lease and fencing for execution authority — deciding who continues from where.
Queuing/interjection and reconnect/replay address user-task interaction; async tools and event wakeup address task-resource handoff; Threads address multi-task organization (not a recovery mechanism per se). Capabilities interdepend: precise recovery relies on Brain-Hands separation (tools run in Hands, letting Brain exit and later rejoin); auto-claim needs shared Backend for state visibility; reconnect requires the app to preserve task identities.
The key is not just storing state but forming explicit collaborative relationships among task identity, execution progress, tool results, and execution authority.
06 From Task Persistence to Continuous Service Loops
Task persistence is a means; the goal is reliably executing every always-on task, even continuously owning a responsibility. Example: a dev agent evolves from "handle this incident" to "continuously monitor service health, investigate anomalies, drive fixes, and track verification." This requires orchestrating multiple work items: when to start, when to wait, what to retain, when to involve users.
Anthropic's "Building always-on agents" describes a recurring cycle: event arrives → wake agent → complete work → save info → wait for next action. Event inbox, timers, memory, permissions, and message outbox jointly sustain this cycle.
Beyond Durable's persistent execution, a complete continuous service loop needs reasoning, context management, application-provided event ingestion, business scheduling, and message delivery.
AgentScope Durable Harness open-source implementation: https://java.agentscope.io/v2/zh/intro
For questions about attribution, corrections or content rights, please contactand we will review it promptly.