method run. Each run shows on the dashboard under Production. Production runs are in the Startup plan (Pricing). To run them on Method’s servers instead of your workers, see Method Cloud.
1. Connect the app
Run this in the Method’s folder:- makes a service key named after the app folder, and writes
METHOD_API_KEYto the app’s.env(it makes the file or adds the line). It does not show the key. It adds.envto.gitignore. - publishes the current Method file if the Method has no published version.
- finds the app’s language (Node or Python) and prints the install line and the code to add.
- lists the secret names that the Method declares. Set them where the app runs.
method login) when there is no METHOD_API_KEY.
2. Run the Method
Python
Node
method.run starts a worker in the app’s process (Python: in a child process). Nothing else needs to run. The worker stops when no method.run call is waiting. To run workers in separate processes, start the app with new Method({ worker: false }) (Python: Method(worker=False)) and run:
--concurrency sets how many runs one worker runs at the same time.
idempotency_key: the same key returns the same run. The same key with other values returns 409.version:"published"(default) or a version ID. A run stays on one version.method.runs.get(RUN_ID)andmethod.runs.cancel(RUN_ID)read and cancel a run.
3. Questions (ask steps)
Anask step stops the run until someone answers. The worker saves the run folder, reports the question, and stops: no process waits. After the answer, a worker continues the run and keeps the finished steps. The run waits until it is answered or cancelled. A step’s limits.timeout_ms sets a deadline: after it, the run fails with “No answer within …”.
The app answers when it starts the run with an ask handler. The handler gets the run ID, the step, the question, and the form (the JSON Schema of the step’s out types). Return the answer, or return nothing and answer later.
webhook_url also makes the app the answerer: the webhook gets a needs_input event with the question, and the app answers with POST /v1/runs/RUN_ID/answer {"answer": {…}}.
The team answers when the app has no handler and no webhook. The question goes to the Inbox on the dashboard, and an email goes to the person who last published the Method. The email has a link that answers the question one time, with no sign-in.
The server checks each answer against the step’s out types. On your computer, method answer RUN_ID shows the question, and method answer RUN_ID --answer '{"approved": true, "note": "…"}' answers it. Local runs (method run FILE) take answers with --human FILE as before.
4. Run content and privacy
run_data: account(default): the server keeps the inputs, the questions, the answers, and the result. The result is inGET /v1/runs/RUN_IDand in the webhook.run_data: device, or the organization setting Keep run content on devices: the library encrypts the inputs, the questions, the answers, and the saved run folder with a key that it derives from the app’sMETHOD_API_KEY(HKDF-SHA256, AES-256-GCM). The server keeps only the encrypted data and a hash of the key, so it cannot read them. Only a worker with the same key can run the run. The result stays on the worker computer: the library returns it when its own worker ran the run, andmethod workerprints it as one JSON line. The webhook carries only{run_id, status}and the encrypted question.- For a device run, the dashboard and the email show only “A question is waiting on run RUN_ID”. Answer it in the app’s handler, or with
method answer RUN_IDin the app folder (its.envhas the key).
5. Webhooks
Each webhook has the headerMethod-Signature: t=TIMESTAMP,v1=HMAC, where HMAC is the hex HMAC-SHA256 of TIMESTAMP.BODY with the key’s webhook secret (method keys create --name NAME prints it once). Verify the raw body:
HTTP API
All routes takeAuthorization: Bearer METHOD_API_KEY.
POST /v1/runs{method, inputs, version?, idempotency_key?, webhook_url?}→{run_id, version_id, status: "queued"}.GET /v1/runs/RUN_ID→ status, attempts, timing, steps (names, status, timing),questionwhile the run waits, andresult(account runs).POST /v1/runs/RUN_ID/answer{answer}→ the run, queued again.POST /v1/runs/RUN_ID/cancelcancels a queued or waiting run at once and a running run at the worker’s next heartbeat.