Durable Jobs and Monitors
Meerkat’s detached job subsystem owns long-running execution outside an agent turn. Submission commits a stable job record before returning. The generatedDetachedJobMachine then owns attempts, leases, fencing, progress,
cancellation, retry, and terminal result.
Background Shell Jobs
The agent-side shell tool submits a durable, non-resumable job whenbackground: true:
job_id. Use shell_job_status, shell_jobs,
and shell_job_cancel from the same shell tool surface.
The job record and its terminal delivery survive restart, but the Unix process
does not become resumable. If the process is lost, the current attempt becomes
worker_lost after its committed lease expires. Meerkat never silently
replays a non-resumable shell command.
Adding & to the command does not create a durable job. Without
background: true, Meerkat uses the foreground shell path and returns no
job_id. Even when the shell exits normally, the runtime attempts to
terminate its process group. If cleanup fails, the tool reports an error
and the runtime retains custody of the group and retries cleanup. A shell
exit code is not proof that every descendant has exited.
Lifecycle And Restart Contract
Safe job projections use these phases:
Worker attempt IDs and fence tokens are host-only. App projections expose the
job ID, runner, phase, restart class, attempt count, progress, cancellation
request, terminal result, subscription count, and delivery backlog.
Public JSON-RPC Surface
The public job surface is JSON-RPC plus the generated Python and TypeScript SDKs. There is no general REST, CLI, or public MCP job-management surface. Agent shell tools provide their own job-oriented commands.
Read a job:
jobs/retry does not grant callers a second execution authority. The machine
admits it only from a compatible loss state and keeps the existing job ID and
attempt history.
SDK Method Names
Durable Delivery Subscriptions
A subscription has a caller-stablesubscription_id, target session_id,
and delivery kind:
recordstores the observation without notifying the conversation.notificationproduces durable user-visible notification delivery without opening a provider turn.eventrequests ordinary agent work withhandling_mode: "steer"or"queue".
delivery <id> (sequence <n>) for session <id> is blocked (NotReady(OriginalAdmissionPending)): ....
Nothing is stored for the cause; each retry reads it again.
A job a mob member’s session submits is addressed to the member rather than to
that session: its notifications and terminal are applied in whichever session
serves the member when they are delivered, so an explicit-resume repoint to a
successor session does not strand them. A member respawned under the same
identity is a new generation and never receives an earlier generation’s rows.
Jobs submitted before 0.9.3 keep their session’s address.
A delivery to a dormant member wakes it first. When the wake is refused, the
row is never settled: it stays pending, in order, and is retried on later
wakes, also when the member is broken, so an operator who repairs the member
still gets every delivery.
Script Monitors
monitors/start is a convenience submission surface over the same durable job
authority. It starts an agent-authored process under the host’s own
authority: a session’s tool policy does not bind it. The host must have a
persistent realm, shell capability, and an explicit project or
working-directory context.
framed_jsonlaccepts typed notification, progress, checkpoint, and completion frames. A notification never terminalizes the job.linesturns stdout lines into notifications. It cannot provide stable per-observation identity and therefore requiresnon_resumable. Prefer framed JSONL for replay-sensitive work.
checkpoint_resumable, replayable, or
non_resumable. They cannot claim adoptable, because an ordinary script has
no stable external runner handle that proves adoption.
Inside an agent session, the shell tool family carries the related
monitor_start tool, on with shell where the session has durable job and
blob stores. It uses event_steer and event_queue shorthand for event
delivery and otherwise shares the durable monitor authority.
After a host restart a session’s recorded resumable monitor is run again at
the session’s next shell job call, and only while the session may still start
one: under a profile that denies monitor_start, gates it without a grant,
or is read-only, and under a tool filter that hides it, the session does not
run it again. A monitor the session’s own tool started then ends as
needs_attention with the failure code monitor_start_not_permitted; a
monitor that monitors/start started is left as it is, and waits for the
host’s next call. monitors/start and
jobs/cancel for a session run its recorded resumable monitors again under
the host’s authority, whatever the session’s profile denies.
Health
jobs/health returns:
status is ok, degraded, or unreadable. degraded means the census
actually observed a wedged condition. unreadable means the census could not
establish any result. Independently, truncated coverage has the shape
{"kind":"truncated","scanned":N,"limit":N} and makes phase counts lower
bounds.
pending_outbox_jobs and runtime_inbox_backlog name different seams. The
first is realm-scoped and counts jobs whose delivery has not reached a runtime.
The second is host-store scoped and counts deliveries a host runtime accepted
but has not drained, including sessions from other logical realms served by
that store. Legitimately long or awaited work is not degraded by duration
alone.
Compose Without Merging Authorities
Schedule
ScheduledDurableJobRunnable derives a stable submission key from the
occurrence, submits or ensures the job, and lets the occurrence complete after
durable acceptance. Schedule redelivery then finds the same job instead of
launching duplicate work. Schedule owns due time; the job machine owns the
execution.
WorkGraph
JobWorkGraphLink associates a job with a commitment.
When composed by a host, JobTerminalEvidenceProjector projects typed terminal
evidence only; it neither requests closure nor closes the item. An authorized
host or agent must separately request WorkGraph closure with the current item
revision under the normal completion policy. Job success is not itself the
required confirmation. Job execution also works when WorkGraph is disabled.
Waiting Sessions
Embedding hosts useJobAwaitCoordinator::await_job to create a durable
DetachedJobWait operation for a session. It records intentional waiting and
can be reconstructed after restart; it never keeps a provider call open.
Notification subscriptions are independent from this wait binding.
