The three moving parts
- The lease — the orchestrator’s statement that a specific agent owns a specific task for a specific time window.
- Progress reports — structured checkpoints the agent writes when it has something to say, not on a timer.
- Fencing tokens — monotonic counters that prevent a revived zombie from writing over a fresh owner.
Lease acquisition
When the orchestrator assigns a task, it hands the adapter a lease record:Lease renewal
The default lease window is 5 minutes. The adapter renews automatically at the 60% mark, not the 100% mark, to give itself room to retry if the renewal call fails. Renewal is asynchronous and cheap (a single HTTP call to the tool proxy). You do not call it from your agent logic. If you find yourself thinking about renewals, something is wrong. If the adapter cannot renew (network dropped, orchestrator down, the agent’s process is hung), the lease expires and the orchestrator reassigns the task. Any writes the old agent attempts after that point are rejected.Progress reports (structured checkpoints)
The agent writes progress reports using thereport_progress tool.
A report looks like this:
- At the start of a task, after reading the context
- When the agent has finished one sub-step and is about to start another
- When the agent hits a decision point and wants a record of what it decided and why
- Before any tool call that will take a long time (a crawl, a build, a model run)
- Whenever the agent thinks the current context might get compacted
Release, not finish
When an agent thinks the task is done, it callsmark_complete
with its final output. That call releases the lease and moves the
task to the review state for a parent agent or a human to decide
whether it actually is done.
A completed task cannot be edited. If the reviewer decides the work
is wrong, they create a new task for the fix. This is a deliberate
choice: mutable task history is a source of audit trail drift.
If the agent wants to hand off to a human mid-task, it calls
request_human_help, which releases the lease and parks the task
in the handoff queue.
If the agent wants to hand off to another agent mid-task, it calls
delegate_subtask, which creates a child task under the current
one and continues to hold the parent lease.
What happens on failure
If the agent process dies:- The adapter notices via process group monitoring and sends a release to the tool proxy
- The orchestrator marks the run as failed and captures the exit code
- The workspace is preserved (failed runs are kept for 7 days by default)
- The task is either retried (if the workflow says so) or escalated to a human
- The lease expires on its own schedule
- The orchestrator reaps the lease via the lease reaper job
- Same as above from step 3
- Nothing writes. The agent’s next tool call fails with a clear “orchestrator unavailable” error.
- The agent’s adapter should exit cleanly; if it does not, the user kills it manually.
- When the orchestrator restarts, it resumes pending runs from their last checkpoint. Agents restart from the last checkpoint, not from scratch.
Tool calls that cost money
Any tool call that touches real infrastructure (spawns a subprocess, makes a network request, writes to a real database) is metered. The tool proxy adds the cost to the agent’s budget envelope before returning the result. If the call would put the agent over its envelope, the call is refused with abudget_exceeded error. The agent can catch this,
report progress with blockers, and either self-escalate or wait
for a top-up.
Summary
- Lease holds for 5 minutes by default, renewed automatically at 60% of the window
- Progress reports are written when something changes, not on a timer
- Fencing tokens make zombie writes impossible
mark_completereleases the lease and moves the task to reviewrequest_human_helpreleases the lease and parks the taskdelegate_subtaskcreates a child and holds the parent lease- Tool calls are metered and can be refused if over-budget
Next
- Writing a skill for the unit of logic you will actually be writing most of the time.
- Task workflow for the full shape of a task run.
- Cost reporting for how to keep your agent inside its budget envelope.