Kill a background command
Ends a background command and the processes it left running, and returns its final state. Safe to call twice, and safe on a command that has already ended: the call then returns that command’s final state unchanged and still ends what it left running.
What is ended: every process that carries the command’s environment variable
MEADOW_EXEC_ID, which children inherit, and, while one of those is still in
the command’s session, every other process in that session. A child in the
command’s process group, one that started its own session with setsid, and
one that cleared its environment but stayed in the session are all ended. A
process that cleared its environment and also left the session cannot be told
apart from others and is not ended. TERM is sent first, KILL after 2 seconds.
The returned stdout and stderr are empty and the offsets are 0. Read the
output with GET /v1/sandboxes/{sandbox_id}/execs/{exec_id}.
If Meadow cannot confirm that the command ended, the call returns 502. Call it again.
Scope: sandboxes.
Authentication
A Meadow API key, sent as Authorization: Bearer mdw_.... The header
x-api-key: mdw_... is accepted in its place.
Path parameters
The sandbox id returned by POST /v1/sandboxes. It must belong to the key’s project.
The id returned when the background command was started.
Response headers
Meadow’s id for this request, req_ and 24 hex characters. Every response
carries it, including errors, streams and unknown routes. Every error in the
Error schema repeats it as request_id. Quote it when you report a problem.
Response
running: still going.exited: ended on its own. Readexit_code.killed: ended by the kill call.killedwith a nullexit_codemeans the sandbox was deleted or timed out before the command ended.timed_out: killed attimeout_seconds.failed: Meadow could not learn how the command ended.failure_reasonsays why. This value is new (2026-11-24): a client with a fixed list of statuses must add it, and should treat any status other thanrunningas final.
Set when status is failed.
state_lost: the command’s state inside the sandbox (its files under/tmp/.meadow-exec, or the process that supervises it) was gone for more than 2 minutes, so the exit code is unknown andexit_codeis null. The command itself may have finished.sandbox_lost: the vendor lost the sandbox while the command was running. The sandbox readsfailedwithfailure_reasonprovider_lost. This value is new (2026-11-24). These commands readkilledwith a nullexit_codebefore.provider_unreachable: for 10 minutes the vendor answered “not found” or “not running” on every call about this command while it reported the sandbox as running. Meadow stopped tracking this one command. Other commands and the sandbox are not changed. The command itself may still be running. New on 2026-11-24.
More values can be added. Treat one you do not know as an unknown outcome.
Output from stdout_offset onward. Empty in the start and kill responses.
Error output from stderr_offset onward. Empty in the start and kill responses.
The byte offset after the returned stdout. Pass this on the next read.
The byte offset after the returned stderr. Pass this on the next read.
True when the command wrote more than 16 MiB to stdout and only the first 16 MiB is kept, or when this read is served from the part Meadow keeps after the sandbox ended and it starts later than the offset you asked for. Absent otherwise.
True when the command wrote more than 16 MiB to stderr and only the first 16 MiB is kept, or when this read is served from the part Meadow keeps after the sandbox ended and it starts later than the offset you asked for. Absent otherwise.