DocsCore concepts

View as Markdown

Runs & conventions

Anywhere is unopinionated by default: bring Claude Code, Codex, OpenCode, a custom Python/TypeScript/Go/Rust agent, or a plain shell script. Any command that exits works out of the box with no workflow SDK.

When you want richer portal summaries, rendered HTML reports, kept transcripts, or explicit completion for a long-lived process, opt into any of the small file and HTTP conventions below. Every run’s outcome, kept input, output, note, and artifacts are stored for the worker’s newest 50 runs so you and your agents can inspect and pull runs without waking the worker, and replay past runs on demand.

What a run receives

Input / variable Description
stdin For webhook triggers and anywhere run < payload.json, the raw request body (up to 1 MiB) piped byte for byte. Empty on cron runs.
ANYWHERE_WEBHOOK_HEADERS Present on webhook runs and replays with headers: request headers encoded as a JSON object with lower-case keys (up to 16 KiB).
ANYWHERE_RUN_ID The run’s UUID.
ANYWHERE_RUN_DIR Dedicated folder at /var/lib/anywhere/runs/<run-id>, pre-created with an empty artifacts/ subfolder. The newest 50 run folders also remain on the worker’s disk.
ANYWHERE_RUN_URL Direct URL to this run’s page in the portal (for Slack or issue links; access requires workspace sign-in).
ANYWHERE_RUN_SCHEDULED_AT Cron runs only: the time the cron named, in RFC 3339 UTC (2026-11-19T08:00:00Z). Optional to read; a run that starts late can still work on the period it was meant for.
ANYWHERE_MEMORY_BYTES The worker’s effective memory ceiling in bytes, useful for sizing heap limits or concurrency pools.
ANYWHERE_CPUS The worker’s effective CPU ceiling (for example 2 or 0.5), useful for sizing parallelism.

Optional conventions

Use none, one, or all of these — nothing in anywhere.toml needs to be enabled:

Convention Purpose
Normal exit code Exit 0 for succeeded, non-zero for failed. Works for any CLI or script with zero platform code.
$ANYWHERE_RUN_DIR/note One-line summary (first line, up to 200 bytes) shown beside the run in the portal and in anywhere runs.
$ANYWHERE_RUN_DIR/artifacts/ & index.html Up to 10 MiB / 200 regular files uploaded at run end. index.html opens as the run’s front page on a sandboxed, cookieless host without waking the worker.
$ANYWHERE_RUN_DIR/artifacts/transcript.jsonl Optional harness-written event or conversation log (scrubbed of secrets before writing). Anywhere is harness-agnostic and stores it as an ordinary text artifact, with no schema lock-in.
POST http://127.0.0.1:7682/_anywhere/done Signals completion from inside the sandbox if your harness or background process does not exit on its own.

How a run ends

A run normally ends when its command exits. It is marked succeeded only when it ends as exited or done with exit code 0. Every other ending is failed.

Ending Meaning
exited Command exited on its own with its exit code.
done Code inside the sandbox called /_anywhere/done with exit_code (0 if omitted).
timed_out Run exceeded timeout; process group received SIGTERM, then SIGKILL 10 seconds later.
cancelled Ended by anywhere sleep WORKER, or a queued webhook run cancelled before starting.
sandbox_stopped A deploy, secret apply, pause, crash, or out-of-memory kill stopped the sandbox mid-run.
lost No ending arrived within timeout + 2 minutes. Never shown as a success.
not_started Host refused or could not start the run (for example worker_busy during a deploy), or a cron run was skipped (run_skipped, run_missed); the run’s error says which.

Ending a harness that stays open (/_anywhere/done)

If your run launches a background server or harness that never exits on its own, signal completion over loopback from inside the sandbox (no token required):

curl -fsS -X POST http://127.0.0.1:7682/_anywhere/done
curl -fsS -X POST -d '{"exit_code":1}' "http://127.0.0.1:7682/_anywhere/done/$ANYWHERE_RUN_ID"

Always prefer the second form with $ANYWHERE_RUN_ID whenever multiple triggers can overlap on the same worker: omitting the run ID while more than one run is active returns 409 run_ambiguous. The helper answers 204 and stops the run’s process group.

Notes, artifacts, reports & transcripts

Write files anywhere inside $ANYWHERE_RUN_DIR:

  • Summary note ($ANYWHERE_RUN_DIR/note): First line, up to 200 bytes (for example 3 new errors, 4 ongoing, 2 gone). Shown right beside the run in the portal and in anywhere runs. Write what happened on success, and the fix on failure.
  • Artifacts ($ANYWHERE_RUN_DIR/artifacts/): Every regular file under artifacts/, up to 10 MiB total and 200 files (no symlinks, FIFOs, or paths over 255 bytes).
    • artifacts/index.html is the run’s front page.
    • .html and image files open as real web pages from a separate, cookieless, sandboxed pages host via 12-hour per-person links, without waking the worker.
    • .md, .txt, .json, .jsonl, .csv, and source files render inline in the portal as escaped text.
    • Other files download directly.
  • Optional transcripts ($ANYWHERE_RUN_DIR/artifacts/transcript.jsonl): If you want a full step-by-step audit trail of an agent run, have your wrapper script write the harness’s JSON-lines stream (for example Claude Code --output-format stream-json --verbose or Codex --json) to artifacts/transcript.jsonl after scrubbing any secrets. Because the platform never couples to a harness format, it stores and displays transcript.jsonl as an ordinary artifact you can inspect in the portal or download with anywhere runs pull.
  • Kept output: The run’s first 64 KiB and newest 1 MiB of stdout/stderr are stored automatically.

Write HTML reports self-contained with inline CSS (the sandboxed pages host blocks external origins and carries no cookies). When an agent processes untrusted external text (errors, issues, webhooks), have the agent output structured data and render the HTML from escaped templates without inline <script> tags.

Run inputs and replay

Anywhere keeps the original input body and webhook headers for every active or queued run and, of the runs still kept, for the newest 50 ended runs that received input. You can read kept inputs without waking the worker, or start a fresh replay run on demand:

anywhere runs input RUN_ID --worker issue-responder            # print the kept input body
anywhere runs input RUN_ID --headers --worker issue-responder  # print kept webhook headers as JSON
anywhere runs replay RUN_ID --worker issue-responder           # start a new run with the same input

You can also click Replay directly on the run’s page in the portal.

  • Replays start a new run (waking the worker if asleep) using the trigger’s current run command and timeout, feeding the original kept input body and headers. Cron runs replay with an empty input.
  • Replays bypass dedupe_header so you can deploy a fix and safely re-run a failed webhook delivery.
  • If a run has no kept input, anywhere runs input returns 409 no_input. For a non-cron run whose input fell outside the newest 50 ended runs with input, anywhere runs replay returns 409 input_not_kept.

Inspecting runs from the CLI

anywhere runs --worker triage                                   # newest 50 runs with status, duration, and note
anywhere runs --worker triage --trigger on-issue --limit 20     # filter by trigger name and count
anywhere runs RUN_ID --worker triage                            # full record, note, artifacts, and output
anywhere runs pull RUN_ID ./out --worker triage                 # download output.txt, artifacts/, and kept input
anywhere runs link [RUN_ID] --worker triage                     # generate a 12-hour link to open HTML artifacts
anywhere runs input RUN_ID [--headers] --worker triage          # read kept input body or headers
anywhere runs replay RUN_ID --worker triage                     # replay a run using its kept input
anywhere --json runs RUN_ID --worker triage                     # structured JSON for agents

A worker keeps every run for 30 days after it ends, and its newest 50 ended runs whatever their age, skipped and missed cron records counting among the 50; older runs are deleted for good, with their output, artifacts and input, and anywhere runs RUN_ID then answers run_not_found. A run still going or waiting is never deleted.

anywhere runs pull saves output.txt, artifacts/, and — when the run has kept input — input and input-headers.json. None of the anywhere runs read commands wake a sleeping worker. Artifact links expire after 12 hours or immediately when you sign out or revoke the token that created them.

For agents:Markdown (/docs/runs-and-artifacts.md)Index (/llms.txt)