@b3os/cli 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (214) hide show
  1. package/README.md +87 -8
  2. package/assets/b3os-run.py +137 -0
  3. package/assets/skill/b3os/SKILL.md +111 -0
  4. package/dist/commands/_agents.d.ts +14 -0
  5. package/dist/commands/_agents.js +33 -0
  6. package/dist/commands/_agents.js.map +1 -0
  7. package/dist/commands/_common.js +6 -2
  8. package/dist/commands/_common.js.map +1 -1
  9. package/dist/commands/_context.d.ts +49 -0
  10. package/dist/commands/_context.js +260 -0
  11. package/dist/commands/_context.js.map +1 -0
  12. package/dist/commands/_next.d.ts +39 -0
  13. package/dist/commands/_next.js +77 -0
  14. package/dist/commands/_next.js.map +1 -0
  15. package/dist/commands/agent.d.ts +42 -0
  16. package/dist/commands/agent.js +218 -0
  17. package/dist/commands/agent.js.map +1 -0
  18. package/dist/commands/app.d.ts +2 -5
  19. package/dist/commands/app.js +229 -69
  20. package/dist/commands/app.js.map +1 -1
  21. package/dist/commands/auth.d.ts +70 -2
  22. package/dist/commands/auth.js +308 -33
  23. package/dist/commands/auth.js.map +1 -1
  24. package/dist/commands/docs.d.ts +54 -0
  25. package/dist/commands/docs.js +202 -0
  26. package/dist/commands/docs.js.map +1 -0
  27. package/dist/commands/doctor.d.ts +23 -0
  28. package/dist/commands/doctor.js +313 -0
  29. package/dist/commands/doctor.js.map +1 -0
  30. package/dist/commands/init.d.ts +38 -1
  31. package/dist/commands/init.js +259 -60
  32. package/dist/commands/init.js.map +1 -1
  33. package/dist/commands/listen.d.ts +30 -0
  34. package/dist/commands/listen.js +194 -0
  35. package/dist/commands/listen.js.map +1 -0
  36. package/dist/commands/manifest.d.ts +13 -1
  37. package/dist/commands/manifest.js +59 -7
  38. package/dist/commands/manifest.js.map +1 -1
  39. package/dist/commands/mcp.d.ts +25 -2
  40. package/dist/commands/mcp.js +120 -11
  41. package/dist/commands/mcp.js.map +1 -1
  42. package/dist/commands/sandbox.d.ts +35 -6
  43. package/dist/commands/sandbox.js +208 -9
  44. package/dist/commands/sandbox.js.map +1 -1
  45. package/dist/commands/setup.d.ts +39 -0
  46. package/dist/commands/setup.js +203 -0
  47. package/dist/commands/setup.js.map +1 -0
  48. package/dist/commands/tool.d.ts +109 -1
  49. package/dist/commands/tool.js +635 -47
  50. package/dist/commands/tool.js.map +1 -1
  51. package/dist/config.d.ts +30 -6
  52. package/dist/config.js +39 -8
  53. package/dist/config.js.map +1 -1
  54. package/dist/ctx.d.ts +5 -45
  55. package/dist/ctx.js +25 -160
  56. package/dist/ctx.js.map +1 -1
  57. package/dist/docs/index.json +1 -0
  58. package/dist/docs/pages/actions/call.md +300 -0
  59. package/dist/docs/pages/actions/catalog/airtable.md +737 -0
  60. package/dist/docs/pages/actions/catalog/arxiv.md +166 -0
  61. package/dist/docs/pages/actions/catalog/chainalysis-sanctions.md +125 -0
  62. package/dist/docs/pages/actions/catalog/coingecko.md +1558 -0
  63. package/dist/docs/pages/actions/catalog/deps-dev.md +465 -0
  64. package/dist/docs/pages/actions/catalog/dexscreener.md +568 -0
  65. package/dist/docs/pages/actions/catalog/discord.md +784 -0
  66. package/dist/docs/pages/actions/catalog/finnhub.md +776 -0
  67. package/dist/docs/pages/actions/catalog/frankfurter.md +438 -0
  68. package/dist/docs/pages/actions/catalog/github.md +1853 -0
  69. package/dist/docs/pages/actions/catalog/gmail.md +575 -0
  70. package/dist/docs/pages/actions/catalog/google-calendar.md +654 -0
  71. package/dist/docs/pages/actions/catalog/google-drive.md +502 -0
  72. package/dist/docs/pages/actions/catalog/google-sheets.md +700 -0
  73. package/dist/docs/pages/actions/catalog/hacker-news.md +542 -0
  74. package/dist/docs/pages/actions/catalog/http.md +824 -0
  75. package/dist/docs/pages/actions/catalog/hyperliquid.md +942 -0
  76. package/dist/docs/pages/actions/catalog/jira.md +920 -0
  77. package/dist/docs/pages/actions/catalog/kalshi.md +917 -0
  78. package/dist/docs/pages/actions/catalog/linear.md +1030 -0
  79. package/dist/docs/pages/actions/catalog/markets.md +21 -0
  80. package/dist/docs/pages/actions/catalog/morpho.md +247 -0
  81. package/dist/docs/pages/actions/catalog/notion.md +1077 -0
  82. package/dist/docs/pages/actions/catalog/nws.md +485 -0
  83. package/dist/docs/pages/actions/catalog/open-meteo.md +559 -0
  84. package/dist/docs/pages/actions/catalog/polymarket.md +1523 -0
  85. package/dist/docs/pages/actions/catalog/pushbullet.md +220 -0
  86. package/dist/docs/pages/actions/catalog/resend.md +307 -0
  87. package/dist/docs/pages/actions/catalog/s3.md +513 -0
  88. package/dist/docs/pages/actions/catalog/sec-edgar.md +487 -0
  89. package/dist/docs/pages/actions/catalog/slack.md +2629 -0
  90. package/dist/docs/pages/actions/catalog/stripe.md +1405 -0
  91. package/dist/docs/pages/actions/catalog/wikipedia.md +379 -0
  92. package/dist/docs/pages/actions/catalog.md +46 -0
  93. package/dist/docs/pages/actions/limits.md +50 -0
  94. package/dist/docs/pages/actions/model-tools.md +225 -0
  95. package/dist/docs/pages/actions/packs.md +148 -0
  96. package/dist/docs/pages/actions/settings.md +69 -0
  97. package/dist/docs/pages/actions/tools.md +244 -0
  98. package/dist/docs/pages/actions/triggers.md +149 -0
  99. package/dist/docs/pages/actions.md +88 -0
  100. package/dist/docs/pages/compat/anthropic.md +168 -0
  101. package/dist/docs/pages/compat/e2b.md +194 -0
  102. package/dist/docs/pages/compat/firecrawl.md +138 -0
  103. package/dist/docs/pages/compat/openai.md +168 -0
  104. package/dist/docs/pages/concepts/auth.md +151 -0
  105. package/dist/docs/pages/concepts/beta.md +55 -0
  106. package/dist/docs/pages/concepts/glossary.md +71 -0
  107. package/dist/docs/pages/concepts/ids.md +98 -0
  108. package/dist/docs/pages/concepts/jobs.md +229 -0
  109. package/dist/docs/pages/concepts/latency.md +138 -0
  110. package/dist/docs/pages/concepts/limits.md +191 -0
  111. package/dist/docs/pages/concepts/stack.md +59 -0
  112. package/dist/docs/pages/concepts/timing.md +86 -0
  113. package/dist/docs/pages/concepts/usage.md +110 -0
  114. package/dist/docs/pages/design/b3os-yaml.md +370 -0
  115. package/dist/docs/pages/design/deploy-from-github.md +122 -0
  116. package/dist/docs/pages/design/observability.md +134 -0
  117. package/dist/docs/pages/errors.md +1824 -0
  118. package/dist/docs/pages/infer/chat.md +570 -0
  119. package/dist/docs/pages/infer/limits.md +55 -0
  120. package/dist/docs/pages/infer/messages.md +185 -0
  121. package/dist/docs/pages/infer/responses.md +173 -0
  122. package/dist/docs/pages/infer/settings.md +154 -0
  123. package/dist/docs/pages/infer/speech.md +323 -0
  124. package/dist/docs/pages/infer.md +154 -0
  125. package/dist/docs/pages/introduction.md +162 -0
  126. package/dist/docs/pages/platform/addresses.md +174 -0
  127. package/dist/docs/pages/platform/call-log.md +99 -0
  128. package/dist/docs/pages/platform/custom-domains.md +104 -0
  129. package/dist/docs/pages/platform/keys.md +79 -0
  130. package/dist/docs/pages/platform/limits.md +57 -0
  131. package/dist/docs/pages/platform/members.md +101 -0
  132. package/dist/docs/pages/platform/requests.md +116 -0
  133. package/dist/docs/pages/platform/settings.md +129 -0
  134. package/dist/docs/pages/platform/webhooks.md +68 -0
  135. package/dist/docs/pages/platform.md +67 -0
  136. package/dist/docs/pages/quickstart/mcp.md +94 -0
  137. package/dist/docs/pages/quickstart/sandbox-agent.md +205 -0
  138. package/dist/docs/pages/quickstart/scrape.md +134 -0
  139. package/dist/docs/pages/quickstart.md +45 -0
  140. package/dist/docs/pages/render/inspections.md +162 -0
  141. package/dist/docs/pages/render/limits.md +72 -0
  142. package/dist/docs/pages/render/screenshots.md +179 -0
  143. package/dist/docs/pages/render/settings.md +431 -0
  144. package/dist/docs/pages/render/styles.md +342 -0
  145. package/dist/docs/pages/render/videos.md +272 -0
  146. package/dist/docs/pages/render.md +118 -0
  147. package/dist/docs/pages/routines/callables.md +174 -0
  148. package/dist/docs/pages/routines/definitions.md +361 -0
  149. package/dist/docs/pages/routines/limits.md +117 -0
  150. package/dist/docs/pages/routines/runs.md +328 -0
  151. package/dist/docs/pages/routines/settings.md +104 -0
  152. package/dist/docs/pages/routines/triggers.md +339 -0
  153. package/dist/docs/pages/routines.md +216 -0
  154. package/dist/docs/pages/sandboxes/agents.md +217 -0
  155. package/dist/docs/pages/sandboxes/commands.md +272 -0
  156. package/dist/docs/pages/sandboxes/images.md +166 -0
  157. package/dist/docs/pages/sandboxes/limits.md +143 -0
  158. package/dist/docs/pages/sandboxes/ports.md +260 -0
  159. package/dist/docs/pages/sandboxes/settings.md +358 -0
  160. package/dist/docs/pages/sandboxes/snapshots.md +423 -0
  161. package/dist/docs/pages/sandboxes/swarms.md +146 -0
  162. package/dist/docs/pages/sandboxes/volumes.md +131 -0
  163. package/dist/docs/pages/sandboxes.md +231 -0
  164. package/dist/docs/pages/sdks/cli.md +121 -0
  165. package/dist/docs/pages/sdks/mcp.md +169 -0
  166. package/dist/docs/pages/sdks/python.md +146 -0
  167. package/dist/docs/pages/sdks/typescript.md +202 -0
  168. package/dist/docs/pages/sdks.md +282 -0
  169. package/dist/docs/pages/settings.md +33 -0
  170. package/dist/docs/pages/vault/limits.md +46 -0
  171. package/dist/docs/pages/vault.md +133 -0
  172. package/dist/docs/pages/vision/agent-browser.md +115 -0
  173. package/dist/docs/pages/vision/crawl.md +333 -0
  174. package/dist/docs/pages/vision/extract.md +152 -0
  175. package/dist/docs/pages/vision/fetcher.md +15 -0
  176. package/dist/docs/pages/vision/limits.md +79 -0
  177. package/dist/docs/pages/vision/profiles.md +111 -0
  178. package/dist/docs/pages/vision/proxy.md +131 -0
  179. package/dist/docs/pages/vision/scrape.md +356 -0
  180. package/dist/docs/pages/vision/sessions.md +311 -0
  181. package/dist/docs/pages/vision/settings.md +656 -0
  182. package/dist/docs/pages/vision.md +175 -0
  183. package/dist/errors.d.ts +129 -0
  184. package/dist/errors.js +326 -0
  185. package/dist/errors.js.map +1 -0
  186. package/dist/main.d.ts +1 -1
  187. package/dist/main.js +26 -13
  188. package/dist/main.js.map +1 -1
  189. package/dist/manifest/domains.d.ts +50 -0
  190. package/dist/manifest/domains.js +159 -0
  191. package/dist/manifest/domains.js.map +1 -0
  192. package/dist/manifest/link.d.ts +20 -0
  193. package/dist/manifest/link.js +24 -0
  194. package/dist/manifest/link.js.map +1 -0
  195. package/dist/manifest/record.d.ts +1 -1
  196. package/dist/tool/archive.d.ts +33 -0
  197. package/dist/tool/archive.js +174 -0
  198. package/dist/tool/archive.js.map +1 -0
  199. package/dist/tool/calls.d.ts +46 -0
  200. package/dist/tool/calls.js +274 -0
  201. package/dist/tool/calls.js.map +1 -0
  202. package/dist/tool/checks.d.ts +21 -0
  203. package/dist/tool/checks.js +145 -0
  204. package/dist/tool/checks.js.map +1 -0
  205. package/dist/tool/elf.d.ts +19 -0
  206. package/dist/tool/elf.js +107 -0
  207. package/dist/tool/elf.js.map +1 -0
  208. package/dist/tool/predict.d.ts +8 -0
  209. package/dist/tool/predict.js +38 -0
  210. package/dist/tool/predict.js.map +1 -0
  211. package/dist/tool/ustar.d.ts +5 -0
  212. package/dist/tool/ustar.js +220 -0
  213. package/dist/tool/ustar.js.map +1 -0
  214. package/package.json +6 -5
@@ -0,0 +1,117 @@
1
+ # Routine limits and FAQ
2
+
3
+ > Step quotas, definition sizes and retention for routines in the beta, and answers to common questions about durability, retries and triggers.
4
+
5
+ Source: https://docs.beta.b3os.org/routines/limits.md
6
+
7
+ ## Limits
8
+
9
+ | Limit | Value |
10
+ |---|---|
11
+ | Steps per day per organization (`routines.steps.daily`) | 50,000 |
12
+ | Steps per routine | 500, map bodies included |
13
+ | Triggers per routine | 20 |
14
+ | Map elements | 10,000 per map |
15
+ | Map concurrency | 256, 8 by default |
16
+ | Map nesting | 3 levels |
17
+ | Steps in one map body | 100 |
18
+ | Signals buffered per name per run | 16 |
19
+ | Retry attempts | 20, the first included |
20
+ | Step timeout | Up to 24 hours; by default a product step's operation timeout (65 seconds for most sync steps, one hour for a job), a map's body time per round of items (at least 30 seconds), 30 seconds for other steps |
21
+ | Definition size | 1 MiB |
22
+ | Cron catch-up window | Up to 30 days, a day by default |
23
+ | Webhook timestamp tolerance | 30 to 300 seconds |
24
+ | Webhook dedupe window | 24 hours |
25
+ | Missed occurrences a catch-up runs | 1,000 at most |
26
+ | One expression evaluation | 8 MiB of memory and 50 ms of wall time, plus a cost budget on the work it does |
27
+ | A run's step data (`max_run_bytes`) | 64 MiB |
28
+ | One step's output (`max_step_output_bytes`) | 1 MiB |
29
+
30
+ Going over the daily step quota returns [`429 quota_exceeded`](https://docs.beta.b3os.org/errors#quota_exceeded) until the window resets. An expression that passes its memory, time or cost bound fails its step with [`expression_error`](https://docs.beta.b3os.org/errors#expression_error) at once, so one run cannot hold up the others on its shard. A step whose data would take the run's step data past `max_run_bytes` fails with [`422 limit_exceeded`](https://docs.beta.b3os.org/errors#limit_exceeded). A `core/http` response body over 1 MiB, or a bigger output of a step in a `standard` or `strict` run, fails the step with [`502 upstream_too_large`](https://docs.beta.b3os.org/errors#upstream_too_large).
31
+
32
+ Recorded from production: `POST /v1/routines/validate` reports maps nested four deep, one more than the limit, with a pointer to the innermost one.
33
+
34
+ **Response 200**
35
+
36
+ ```json
37
+ {
38
+ "diagnostics": [
39
+ {
40
+ "code": "routine_invalid",
41
+ "detail": "map bodies nest at most 3 deep",
42
+ "pointer": "/steps/0/map/steps/0/map/steps/0/map/steps/0/map",
43
+ "severity": "error"
44
+ }
45
+ ],
46
+ "object": "routine_validation",
47
+ "valid": false
48
+ }
49
+ ```
50
+
51
+ **Request**
52
+
53
+ ```bash
54
+ curl -s -X POST 'https://beta-api.b3os.org/v1/routines/validate' \
55
+ -H "Authorization: Bearer $B3OS_API_KEY" \
56
+ -H 'content-type: application/json' \
57
+ -d '{"name":"nested-maps","inputs":{"type":"object","properties":{"grid":{"type":"array"}}},"steps":[{"id":"level1","map":{"over":"${{ inputs.grid }}","steps":[{"id":"level2","map":{"over":"${{ item }}","steps":[{"id":"level3","map":{"over":"${{ item }}","steps":[{"id":"level4","map":{"over":"${{ item }}","steps":[{"id":"leaf","uses":"core/transform@1","with":{"value":"${{ item }}"}}]}}]}}]}}]}}]}'
58
+ ```
59
+
60
+ **Server-Timing**
61
+
62
+ ```http
63
+ server-timing: edge_auth;dur=29.000, edge_upstream;dur=23.000, total;dur=0.500
64
+ x-request-id: req_01m6q46z53b6h702zfjeb6v5d5
65
+ ```
66
+
67
+ <sub>Captured 2026-11-06 from commit `ea0fe0c5` on the host the node runs on, one call, label `live-recorded` (recorded from production). Case `routines/validate-limit`.</sub>
68
+
69
+ ## Retention
70
+
71
+ Run history, steps and events: 30 days. An `ephemeral` run keeps only its summary (status, timing, input, output, error) once it ends. Versions stay as long as the routine.
72
+
73
+ ## Fixed in the beta
74
+
75
+ No request field changes these in the beta.
76
+
77
+ - [**When sandboxes pause**](https://docs.beta.b3os.org/routines/settings#when-sandboxes-pause): After 30 seconds of waiting. With `pause_sandboxes`, a run's sandboxes pause once it waits at least 30 seconds (a wait, a sleep, or a signal wait with no deadline).
78
+ - [**Lookahead**](https://docs.beta.b3os.org/routines/settings#lookahead): On. While a step that waits on I/O runs, the node creates the sandbox the next `sandboxes/exec@1` step needs. A pre-warmed sandbox whose step does not run is deleted after 30 seconds, and that time bills.
79
+ - [**Run history**](https://docs.beta.b3os.org/routines/settings#run-history): Kept 30 days. Runs, their steps and their events are kept 30 days.
80
+
81
+ ## FAQ
82
+
83
+ **Which durability tier should I use?**
84
+
85
+ `standard` for most work: effects are durable before the steps after them run, and a crashed run resumes from the journal. `ephemeral` for short routines an agent calls like a tool and waits on, where losing a run to a crash is acceptable and the answer is all you need later: once it ends, only its summary is kept. `strict` when a step's effect must never repeat, at the cost of two disk commits per effect step.
86
+ **Can a routine survive the node going down?**
87
+
88
+ Durable runs survive process crashes and restarts. They do not survive the loss of the node itself; the beta runs on one node. While the node is down, webhook deliveries queue at the edge and replay in order, and schedules apply their catch-up policy when it returns.
89
+ **What happens to a run whose version stops compiling after an update?**
90
+
91
+ A run resumes after a restart by compiling its version again. If the node's new release no longer compiles that version (a callable it uses was removed or changed), the run cannot resume: it fails with [`500 internal_recovery_failed`](https://docs.beta.b3os.org/errors#internal_recovery_failed) and its webhook gets `job.failed`. A routine that calls it as a sub-routine pins its version, so a calling run stops compiling too and fails the same way; sub-routine runs a failed run was waiting on are canceled. A run that had already finished keeps its status. Publish the routine again and start a new run. Before each release that changes the compiler, the operators compile every stored version with it and hold the release if one fails.
92
+ **Can a step's effect happen twice after a crash?**
93
+
94
+ A step's result counts only if its attempt is still the live one and the run has not been canceled. After a crash, recovery starts a new attempt for every step that was in flight, and a late result from the old attempt (a sandbox command that kept running, for example) is discarded. Canceling a run also cancels its child routine runs and its sandbox commands and JavaScript actions in flight. Whether the effect itself ran twice depends on the step: `standard` re-issues in-flight steps, so give write steps an idempotency key; `strict` records the intent first and fails an irreversible step instead of repeating it.
95
+ **Do product steps send an idempotency key?**
96
+
97
+ Yes. Every `vision/*`, `render/*`, `sandboxes/*` and `infer/*` step sends `Idempotency-Key: <run id>:<step id>`, with `:<item index>` added inside a map, on every attempt: retries and the new attempt after a crash send the same key. A job step's create is the exception on a retry: it sends `<key>~<try>`, so a retry after a failed job starts a new job, while the attempt after a crash rejoins the job the first create made.
98
+
99
+ The key only helps where the operation dedupes on it, returning the stored response to a repeat instead of running again. Today these do: `vision/crawl@1`, `vision/batch@1`, `vision/extract@1`, `render/screenshot@1`, `render/video@1`, `render/restyle@1`, `sandboxes/create@1`, `sandboxes/snapshot@1` and `sandboxes/fork@1`. The others do not yet: `vision/scrape@1`, `vision/map@1`, `vision/act@1`, `sandboxes/exec@1`, `sandboxes/run_code@1`, `sandboxes/read_file@1`, `sandboxes/write_file@1`, `sandboxes/delete@1`, `infer/chat@1`, `infer/speech@1` and `vision/search@1`. Of those, the write steps (`vision/act@1` and the sandbox steps other than `read_file`) can run again if the node restarts while they run, under `standard` and `strict` alike (`strict` refuses to repeat only `irreversible` steps), so make what they do safe to repeat.
100
+ **Can code in a sandbox publish a routine?**
101
+
102
+ No. A routine version runs with the authority of the key that published it, and a sandbox's grant ends with the sandbox, so a publish from inside a sandbox answers `403 forbidden` with reason `scope_escalation`. Publish from your own code or CI.
103
+ **Why did my step not retry?**
104
+
105
+ Only failures the callee marks retryable are retried, and only `pure` and `read` steps take `defaults.retry`. A `write` step needs its own `retry`; an `irreversible` step never retries.
106
+ **Why did my run fail with expression_error?**
107
+
108
+ A CEL expression hit a missing field or mixed types at run time. Guard optional data with `has()` and convert numbers explicitly. `POST /v1/routines/validate` catches syntax and name errors before you publish.
109
+ **Whose permissions does a routine run with?**
110
+
111
+ The key that published its active version, with that key's scopes copied at publish time. Revoking the key pauses the routine's triggers.
112
+ **Can a routine run shell commands?**
113
+
114
+ Not directly: there is no shell step. Use `sandboxes/exec@1` with a `template` for a fresh sandbox or `sandbox` for an existing one.
115
+ **How do I keep a credential out of a routine definition?**
116
+
117
+ Store it in the [vault](https://docs.beta.b3os.org/vault) and bind it to a pack action step with `connections`. It is injected at the egress proxy and never appears in the definition, the run or its logs.
@@ -0,0 +1,328 @@
1
+ # Runs
2
+
3
+ > Start a routine run, wait for it or follow its steps live, send signals to waiting steps, cancel it, replay it, and read its steps and history.
4
+
5
+ Source: https://docs.beta.b3os.org/routines/runs.md
6
+
7
+ A run is one execution of a routine version. Runs are [jobs](https://docs.beta.b3os.org/concepts/jobs), so you can wait on them, stream them or get a webhook.
8
+
9
+ ## Start a run
10
+
11
+ **curl**
12
+
13
+ ```bash
14
+ curl -s "https://beta-api.b3os.org/v1/routines/nightly-digest/runs?wait=30" \
15
+ -H "Authorization: Bearer $B3OS_API_KEY" \
16
+ -H "Content-Type: application/json" \
17
+ -d '{"input": {"topic": "pricing"}, "durability": "ephemeral"}'
18
+ ```
19
+ **TypeScript**
20
+
21
+ ```ts
22
+ import { B3OS } from "@b3os/sdk";
23
+
24
+ const b3os = new B3OS();
25
+ // .wait() sends ?wait on the create, then follows the run's events until it ends
26
+ const done = await b3os.routines
27
+ .createRun("nightly-digest", { input: { topic: "pricing" }, durability: "ephemeral" })
28
+ .wait();
29
+ console.log(done.status, done.result, done.timing);
30
+ ```
31
+ **Python**
32
+
33
+ ```python
34
+ from b3os import B3OS
35
+
36
+ b3os = B3OS()
37
+ done = b3os.routines.create_run(
38
+ "nightly-digest",
39
+ {"input": {"topic": "pricing"}, "durability": "ephemeral"},
40
+ wait=True, # sends ?wait on the create, then follows the run's events until it ends
41
+ )
42
+ print(done["status"], done.get("result"), done.get("timing"))
43
+ ```
44
+ **MCP**
45
+
46
+ ```text
47
+ Run the nightly digest about pricing and give me the result.
48
+ ```
49
+
50
+ The agent calls `routine_run` with `routine: "nightly-digest"` and `input: {"topic": "pricing"}`. On the remote MCP server the tool also takes `durability`, `version` and `wait`; on the local one it waits up to `wait_s` seconds and returns the output, or the run ID to pass back as `job_id`.
51
+
52
+ | Field | Meaning |
53
+ |---|---|
54
+ | `input` | Validated against the routine's `inputs` schema; its defaults are applied |
55
+ | `version` | Run this version (`ver_` ID or number) instead of the active one |
56
+ | `durability` | Override the routine's default: `ephemeral`, `standard` or `strict` |
57
+ | `webhook` | Where to post the run's events: `{"url": "https://…", "events": [...]}`, an absolute `https://` URL of at most 2,048 characters and the event types to send (the terminal events when left out, `["*"]` for every event). Deliveries are signed and retried for 24 hours, as for every [job webhook](https://docs.beta.b3os.org/concepts/jobs#webhooks). A bare URL string is refused with `400 invalid_request` pointing at `/webhook` |
58
+
59
+ A run whose `input` does not match the routine's `inputs` schema is refused with `422` [`run_input_invalid`](https://docs.beta.b3os.org/errors#run_input_invalid), with `errors` pointing at each field. Send `Idempotency-Key` to make a start safe to retry: a retry returns the run the first request started, and the same key with a different request, or from a different key, answers `409` [`idempotency_key_conflict`](https://docs.beta.b3os.org/errors#idempotency_key_conflict).
60
+
61
+ Send a W3C `traceparent` and the run joins your trace: every `core/http@1` attempt sends `traceparent` with a span of its own, and sub-routines join the caller's trace. Without one, the run gets a trace ID derived from its run ID.
62
+
63
+ With `?wait=` the response is the finished run if it ends in time. An `ephemeral` run that finishes within the wait answers before anything about it is written, since it keeps no journal. That suits a routine an agent calls like a tool. Send `Accept: text/event-stream` to follow it live instead.
64
+
65
+ Once an `ephemeral` run ends, only its summary is stored: its status, timing, input, output (`result`), error and IDs, not its steps or events. The `?wait=` answer, the event stream and the run's webhook carry its steps as it ends. Every read after that gets the summary: `GET /v1/routines/runs/{run_id}` returns the run with `steps: []` and `"steps_kept": false`, `GET .../steps` and a replay answer `410` [`run_steps_not_kept`](https://docs.beta.b3os.org/errors#run_steps_not_kept), and `GET .../events` sends its terminal event alone. Use `standard` when you want to read a run's steps later or replay it.
66
+
67
+ While a step that waits on the network runs, the engine looks ahead: a `sandboxes/exec@1` step that depends on it and names a literal `template` gets its sandbox created early, as the run's principal, so the command starts on a sandbox that is already running. If that step never runs, the sandbox is deleted after at most 30 seconds unclaimed. It counts toward your sandbox concurrency while it waits, and a create refused for a limit is dropped: the step then creates its own.
68
+
69
+ <a href="https://beta.b3os.org/gallery/docs-site/shot-routine-run/f89ac140accc7431.webp"><img src="https://beta.b3os.org/gallery/docs-site/shot-routine-run/f89ac140accc7431.webp" srcset="https://beta.b3os.org/gallery/docs-site/shot-routine-run/595c3a77b094f1e0.webp 640w, https://beta.b3os.org/gallery/docs-site/shot-routine-run/70be603a8a946fef.webp 1080w, https://beta.b3os.org/gallery/docs-site/shot-routine-run/f89ac140accc7431.webp 2910w" sizes="(max-width: 640px) calc(100vw - 60px), 760px" alt="A routine run in the dashboard: image from the capture docs-site/shot-routine-run" width="2910" height="2214" loading="lazy" /></a>
70
+
71
+ <sub>Captured 2026-11-15 from commit `2aac696d` on a GitHub Actions runner (colo MSP), one call, label `mock` (the dashboard in mock mode). Case `docs-site/shot-routine-run`.</sub>
72
+
73
+ ## The run
74
+
75
+ A run of `docs-digest`, recorded from production: a routine with the same two callables as the `nightly-digest` example (a scrape of `https://demo.b3os.io/`, then a one-sentence summary from the node's model), in a `standard` run started with `?wait=30`.
76
+
77
+ **Response 200**
78
+
79
+ ```json
80
+ {
81
+ "created_at": "2026-11-06T00:20:42.777Z",
82
+ "durability": "standard",
83
+ "expires_at": "2026-12-06T00:20:43.139Z",
84
+ "finished_at": "2026-11-06T00:20:43.139Z",
85
+ "id": "run_01m6q3nams236ynkq846m3r19g",
86
+ "input": {},
87
+ "metadata": {},
88
+ "object": "routine_run",
89
+ "progress": {
90
+ "completed": 2,
91
+ "total": 2,
92
+ "unit": "steps"
93
+ },
94
+ "result": {
95
+ "summary": "This page outlines a website relaunch plan organized into \"To do,\" \"In progress,\" and \"Done\" sections, detailing specific tasks for copywriting, design, engineering, and review while emphasizing accessibility and data privacy within a fictional demo environment."
96
+ },
97
+ "routine_id": "rtn_01m6q3nagt9xe5fkhjcrjd9ywa",
98
+ "started_at": "2026-11-06T00:20:42.783Z",
99
+ "status": "succeeded",
100
+ "steps": [
101
+ {
102
+ "attempt": 1,
103
+ "duration_ms": 87.615,
104
+ "finished_at": "2026-11-06T00:20:42.871Z",
105
+ "id": "page",
106
+ "started_at": "2026-11-06T00:20:42.783Z",
107
+ "status": "succeeded",
108
+ "uses": "vision/scrape@1"
109
+ },
110
+ {
111
+ "attempt": 1,
112
+ "duration_ms": 268.215,
113
+ "finished_at": "2026-11-06T00:20:43.139Z",
114
+ "id": "summary",
115
+ "started_at": "2026-11-06T00:20:42.871Z",
116
+ "status": "succeeded",
117
+ "uses": "infer/chat@1"
118
+ }
119
+ ],
120
+ "summary": "This page outlines a website relaunch plan organized into \"To do,\" \"In progress,\" and \"Done\" sections, detailing specific tasks for copywri…",
121
+ "timing": {
122
+ "dispatch_ms": 6.76,
123
+ "steps_ms": 355.854,
124
+ "total_ms": 362.615
125
+ },
126
+ "trigger": {
127
+ "type": "api"
128
+ },
129
+ "updated_at": "2026-11-06T00:20:43.139Z",
130
+ "version_id": "ver_01m6q3nagt39gfp0p62re9xkvh",
131
+ "version_number": 1
132
+ }
133
+ ```
134
+
135
+ **Request**
136
+
137
+ ```bash
138
+ curl -s -X POST 'https://beta-api.b3os.org/v1/routines/docs-digest/runs?wait=30' \
139
+ -H "Authorization: Bearer $B3OS_API_KEY" \
140
+ -H 'content-type: application/json' \
141
+ -d '{"input":{}}'
142
+ ```
143
+
144
+ **Server-Timing**
145
+
146
+ ```http
147
+ server-timing: edge_auth;dur=0.000, edge_upstream;dur=385.000, total;dur=373.498
148
+ x-request-id: req_01m6q3namj10agec2kq6fkjavk
149
+ ```
150
+
151
+ <sub>Captured 2026-11-06 from commit `92bb000d` on the host the node runs on, one call, label `live-recorded` (recorded from production). Case `routines/run-digest`.</sub>
152
+
153
+ [`GET /v1/routines/runs/{run_id}`](https://docs.beta.b3os.org/api/get-v1-routines-runs-run-id-) lists every field a run has. `trigger` says how the run started: `api`, `cron`, `interval`, `webhook`, `action`, `routine` for a run started by another routine, or `replay` for a [replay](#replay). `steps` covers the top-level steps; `GET /v1/routines/runs/{run_id}/steps` lists every step execution in start order, with each map item (`item_index`), each retry (`attempt`), and their outputs and errors.
154
+
155
+ `summary` is the run's outcome line. When the routine's `output` is an object with a non-empty `summary` string, the run carries that string on one line, cut to 140 characters. Run lists, the dashboard's run table and run header, and the `job.succeeded` webhook event show it, so a list of runs says what each one did. A routine whose output has no `summary` gets no field.
156
+
157
+ ## Follow it live
158
+
159
+ `GET /v1/routines/runs/{run_id}/events` streams the lifecycle events plus:
160
+
161
+ | Event | When |
162
+ |---|---|
163
+ | `step.started` | A step begins |
164
+ | `step.retrying` | A step failed and will try again |
165
+ | `step.waiting` | A `wait` step is waiting for a signal or a time |
166
+ | `step.succeeded`, `step.failed`, `step.skipped` | A step ends |
167
+ | `run.log` | A `core/log@1` step wrote a line |
168
+
169
+ Events are kept with the run's history, so you can reconnect with `Last-Event-ID` and pick up where you left off. An `ephemeral` run keeps only its terminal event once it ends.
170
+
171
+ ## Signals
172
+
173
+ A `wait` step with a `signal` name waits for you to send that signal:
174
+
175
+ ```bash
176
+ curl -s "https://beta-api.b3os.org/v1/routines/runs/$RUN_ID/signal" \
177
+ -H "Authorization: Bearer $B3OS_API_KEY" \
178
+ -H "Content-Type: application/json" \
179
+ -d '{"name": "approval", "payload": {"approved": true, "by": "ops@example.com"}}'
180
+ ```
181
+
182
+ The waiting step completes with the `payload` as its outputs. A signal sent before its step starts waiting is buffered, up to 16 per name, and consumed in order. Signaling a run that already finished, or whose buffer for that name is full, fails with [`run_not_waiting`](https://docs.beta.b3os.org/errors#run_not_waiting).
183
+
184
+ When the answer should come from a person who has no API key, give the wait `token: true` and send them `run.wait_urls.<step id>`: a signed link to a page that shows what they are approving and takes Approve or Reject. See [Ask a person](https://docs.beta.b3os.org/routines/definitions#ask-a-person). To resume runs whose IDs the sender does not know, wait for an event instead: see [Wait for an event](https://docs.beta.b3os.org/routines/definitions#wait-for-an-event).
185
+
186
+ ## Cancel
187
+
188
+ `POST /v1/routines/runs/{run_id}/cancel` tells in-flight steps to stop. Steps whose effects already happened are not undone. The run ends `canceled`, and steps that have not started are skipped unless their `if` calls `always()`, which is how a cleanup step still runs.
189
+
190
+ ## Replay
191
+
192
+ `POST /v1/routines/runs/{run_id}/replay` starts a new run that reuses what a finished run already did. Each top-level step that succeeded is copied: it succeeds at once with the outputs it recorded and shows `"replayed": true`, and its callable does not run again, so no request is sent, no sandbox is made and nothing is charged for it. Everything else runs:
193
+
194
+ - `from_step` and every step downstream of it;
195
+ - steps that failed, were skipped or were canceled, and every step downstream of them;
196
+ - on another version, steps it adds or changes, and every step downstream of them. A step is compared with the source version's step of the same ID: the step as written (`uses`, `with`, `if`, `connections`, `subject`, a map's body and the rest), the pack and routine versions it pinned at publish, the steps it depends on, and the `vars` and `env` it reads;
197
+ - with a new `input`, steps that read the input, directly or through `env`, and every step downstream of them;
198
+ - steps that wait for a signal (a `wait` with `signal`, also inside a map or a called routine), unless the replay keeps the source run's version and input: the signal answered that run, not another definition or input.
199
+
200
+ A step is copied only when the outputs of every step it depends on are copied too. `trigger` and `run` are not compared, since every replay has its own.
201
+
202
+ Without `from_step`, a replay of a failed run picks up where it failed. The new run uses the source run's version and input unless you send `version` or `input`, so you can publish a fix and replay the failed run on the new version:
203
+
204
+ **curl**
205
+
206
+ ```bash
207
+ curl -s "https://beta-api.b3os.org/v1/routines/runs/$RUN_ID/replay?wait=30" \
208
+ -H "Authorization: Bearer $B3OS_API_KEY" \
209
+ -H "Content-Type: application/json" \
210
+ -d '{"version": 3}'
211
+ ```
212
+ **TypeScript**
213
+
214
+ ```ts
215
+ const again = await b3os.routines.replayRun(runId, { from_step: "summary" }).wait();
216
+ console.log(again.steps.map((s) => `${s.id} ${s.replayed ? "copied" : s.status}`));
217
+ ```
218
+ **Python**
219
+
220
+ ```python
221
+ again = b3os.routines.replay_run(run_id, {"from_step": "summary"}, wait=True)
222
+ print([(s["id"], s.get("replayed", False)) for s in again["steps"]])
223
+ ```
224
+ **CLI**
225
+
226
+ ```bash
227
+ b3os routine replay "$RUN_ID" --from-step summary
228
+ ```
229
+
230
+ Recorded from production: the run above replayed with `from_step` `summary`. `page` is copied (`replayed: true`) and `summary` runs again, so the model writes a new sentence.
231
+
232
+ **Response 200**
233
+
234
+ ```json
235
+ {
236
+ "created_at": "2026-11-06T00:20:49.997Z",
237
+ "durability": "standard",
238
+ "expires_at": "2026-12-06T00:20:50.239Z",
239
+ "finished_at": "2026-11-06T00:20:50.239Z",
240
+ "id": "run_01m6q3nhpdxres3zgsmbq4ahd1",
241
+ "input": {},
242
+ "metadata": {},
243
+ "object": "routine_run",
244
+ "progress": {
245
+ "completed": 2,
246
+ "total": 2,
247
+ "unit": "steps"
248
+ },
249
+ "result": {
250
+ "summary": "This page outlines a comprehensive website relaunch plan featuring completed foundational steps like site auditing and typography selection, ongoing work on navigation, forms, and redirects, and upcoming tasks for copywriting, design, and launch communications."
251
+ },
252
+ "routine_id": "rtn_01m6q3nagt9xe5fkhjcrjd9ywa",
253
+ "started_at": "2026-11-06T00:20:49.997Z",
254
+ "status": "succeeded",
255
+ "steps": [
256
+ {
257
+ "attempt": 1,
258
+ "duration_ms": 0.001,
259
+ "finished_at": "2026-11-06T00:20:49.997Z",
260
+ "id": "page",
261
+ "replayed": true,
262
+ "started_at": "2026-11-06T00:20:49.997Z",
263
+ "status": "succeeded",
264
+ "uses": "vision/scrape@1"
265
+ },
266
+ {
267
+ "attempt": 1,
268
+ "duration_ms": 242.53,
269
+ "finished_at": "2026-11-06T00:20:50.239Z",
270
+ "id": "summary",
271
+ "started_at": "2026-11-06T00:20:49.997Z",
272
+ "status": "succeeded",
273
+ "uses": "infer/chat@1"
274
+ }
275
+ ],
276
+ "summary": "This page outlines a comprehensive website relaunch plan featuring completed foundational steps like site auditing and typography selection…",
277
+ "timing": {
278
+ "dispatch_ms": 1.762,
279
+ "steps_ms": 242.55,
280
+ "total_ms": 244.311
281
+ },
282
+ "trigger": {
283
+ "from_step": "summary",
284
+ "parent_run_id": "run_01m6q3nams236ynkq846m3r19g",
285
+ "type": "replay"
286
+ },
287
+ "updated_at": "2026-11-06T00:20:50.239Z",
288
+ "version_id": "ver_01m6q3nagt39gfp0p62re9xkvh",
289
+ "version_number": 1
290
+ }
291
+ ```
292
+
293
+ **Request**
294
+
295
+ ```bash
296
+ curl -s -X POST 'https://beta-api.b3os.org/v1/routines/runs/run_01m6q3nams236ynkq846m3r19g/replay?wait=30' \
297
+ -H "Authorization: Bearer $B3OS_API_KEY" \
298
+ -H 'content-type: application/json' \
299
+ -d '{"from_step":"summary"}'
300
+ ```
301
+
302
+ **Server-Timing**
303
+
304
+ ```http
305
+ server-timing: edge_auth;dur=0.000, edge_upstream;dur=258.000, total;dur=245.281
306
+ x-request-id: req_01m6q3nhp4x40dss6h08apw4pn
307
+ ```
308
+
309
+ <sub>Captured 2026-11-06 from commit `92bb000d` on the host the node runs on, one call, label `live-recorded` (recorded from production). Case `routines/replay-digest`.</sub>
310
+
311
+ The new run's trigger is `{"type": "replay", "parent_run_id": "run_…", "from_step": "summary"}`, so a step that runs again and reads `trigger` sees the replay; what the source run got from its own trigger (a webhook body, an event) reached it through its input, which the replay keeps. The run page in the dashboard has **Replay** and **Replay from this step**, and marks copied steps.
312
+
313
+ | Field | Meaning |
314
+ |---|---|
315
+ | `from_step` | A top-level step ID: it and everything downstream of it run again. Unknown: `400 invalid_request` pointing at `/from_step` |
316
+ | `version` | Replay on this version (`ver_` ID or number) instead of the source run's. The steps it changes and the steps that wait for a signal run again |
317
+ | `input` | The new run's input instead of the source run's. When it differs from the source's, the steps that read it and the steps that wait for a signal run again |
318
+ | `durability`, `webhook`, `metadata` | As for [starting a run](#start-a-run) |
319
+
320
+ A run that is still `queued` or `running` answers `409` [`run_not_finished`](https://docs.beta.b3os.org/errors#run_not_finished): cancel it or wait for it first. The copied outputs are written into the new run's start record, so a node restart copies the same steps again instead of repeating their effects; together with the input they are at most `routines.max_step_output_bytes` (1 MiB by default), or the replay answers `422` [`replay_too_large`](https://docs.beta.b3os.org/errors#replay_too_large) and an earlier `from_step` copies less. Copied steps do not count toward `routines.steps.daily`. Replays answer like run starts: `?wait=`, `Accept: text/event-stream` and `Idempotency-Key` work the same way.
321
+
322
+ ## History and versions
323
+
324
+ Runs are kept for 30 days (an `ephemeral` run as its summary). `GET /v1/routines/{routine}/runs` lists a routine's runs, newest first, filterable by status. Each run pins the version it started with, so publishing a new version or rolling back never changes a run in progress. `GET /v1/routines/{routine}/versions` lists the versions, and `GET .../versions/{version}` returns one with its full definition.
325
+
326
+ ## Pause a routine
327
+
328
+ `PATCH /v1/routines/{routine}` with `{"paused": true}` stops all of its triggers; runs you start through the API still work. `{"paused": false}` resumes them, except for a routine paused because its publishing key was revoked, which needs a new version published with a valid key.
@@ -0,0 +1,104 @@
1
+ # Routine settings
2
+
3
+ > Every routine setting: durability, step timeouts, retries, concurrency and paused sandboxes, with defaults, values and examples.
4
+
5
+ Source: https://docs.beta.b3os.org/routines/settings.md
6
+
7
+ Most routine settings live in the definition, under `defaults`, and a step can set its own `timeout_ms` and `retry`. A run can ask for another durability when it starts. [Definitions](https://docs.beta.b3os.org/routines/definitions) has the whole format.
8
+
9
+ | Setting | Default |
10
+ |---|---|
11
+ | [Durability](#durability): `defaults.durability` | `standard` ([per field](#durability)) |
12
+ | [Concurrency](#concurrency): `defaults.concurrency.limit` | none: every run starts ([per field](#concurrency)) |
13
+ | [Pause sandboxes while waiting](#pause-sandboxes-while-waiting): `defaults.pause_sandboxes` | `false` |
14
+ | [Step timeout](#step-timeout): `defaults.timeout_ms` | 30,000 ms ([per field](#step-timeout)) |
15
+ | [Retries](#retries): `defaults.retry` | none: a step runs once |
16
+
17
+ ## Runs
18
+
19
+ ### Durability
20
+
21
+ What a crash may lose. `ephemeral` runs in memory and journals nothing: the fastest, and a crash loses the run. `standard` commits the journal in groups, so an effect is durable before the steps that need it run. `strict` commits the intent and the result of every effect step.
22
+
23
+ - **Field:** `defaults.durability` and `durability` on [definition](https://docs.beta.b3os.org/api/put-v1-routines-routine-) and [run](https://docs.beta.b3os.org/api/post-v1-routines-routine-runs)
24
+ - **Default:** `standard` (`defaults.durability`, definition), the routine's `defaults.durability` (`durability`, run)
25
+ - **Values:** `ephemeral`, `standard` or `strict`
26
+ - **Invalid value:** [`422 routine_invalid`](https://docs.beta.b3os.org/errors#routine_invalid), [`400 invalid_request`](https://docs.beta.b3os.org/errors#invalid_request)
27
+ - **Guide:** [Durability](https://docs.beta.b3os.org/routines#durability)
28
+
29
+ ```json
30
+ {"defaults": {"durability": "strict"}}
31
+ ```
32
+
33
+ ### Concurrency
34
+
35
+ At most `limit` runs active per `group`. A new run in a full group waits (`queue`), ends canceled (`skip`), or cancels the oldest active run first (`cancel_running`).
36
+
37
+ - **Field:** `defaults.concurrency.limit` and `defaults.concurrency.on_limit` on [definition](https://docs.beta.b3os.org/api/put-v1-routines-routine-)
38
+ - **Default:** none: every run starts (`defaults.concurrency.limit`), `queue` (`defaults.concurrency.on_limit`)
39
+ - **Values:** 1 to 1,000 (`defaults.concurrency.limit`); `queue`, `skip` or `cancel_running` (`defaults.concurrency.on_limit`)
40
+ - **Invalid value:** [`422 routine_invalid`](https://docs.beta.b3os.org/errors#routine_invalid)
41
+ - **Guide:** [Concurrency](https://docs.beta.b3os.org/routines/definitions#concurrency)
42
+
43
+ ```json
44
+ {"defaults": {"concurrency": {"limit": 1, "group": "${{ inputs.customer_id }}", "on_limit": "queue"}}}
45
+ ```
46
+
47
+ ### Pause sandboxes while waiting
48
+
49
+ Pauses the sandboxes a run execs in while it waits long and nothing else of it runs, so they bill no CPU; the next exec or the end of the run resumes them. Only an exec resumes one, so after a long wait run an exec in it before its other sandbox steps: a `write_file` on a paused sandbox fails with `409 sandbox_not_running`. Anything else using those sandboxes freezes meanwhile, so set it only for sandboxes the routine's runs have to themselves. Needs `sandboxes:write` on the publishing key.
50
+
51
+ - **Field:** `defaults.pause_sandboxes` on [definition](https://docs.beta.b3os.org/api/put-v1-routines-routine-)
52
+ - **Default:** `false`
53
+ - **Values:** `true` or `false`
54
+ - **Invalid value:** [`422 routine_invalid`](https://docs.beta.b3os.org/errors#routine_invalid)
55
+
56
+ ```json
57
+ {"defaults": {"pause_sandboxes": true}}
58
+ ```
59
+
60
+ ## Steps
61
+
62
+ ### Step timeout
63
+
64
+ How long one attempt of a `uses` step may take, or a whole `map` step. A step's own `timeout_ms` wins over `defaults.timeout_ms`. A product step that sets neither waits as long as its operation allows: its operation's timeout, such as 65 seconds for `vision/search@1` and `vision/scrape@1`, 600 seconds for `infer/chat@1` and one hour for a job step such as `render/video@1`, and 65 seconds for `sandboxes/exec@1`. `core/http@1`, pack and routine steps get 30 seconds. A `map` step that sets neither waits what one item's steps may take in a row (each step's own timeout, added along the steps it waits for), once per round of `concurrency` items, and at least 30 seconds; with `timeout_ms` written, that is the whole map's time. Wait and sleep steps are not affected.
65
+
66
+ - **Field:** `defaults.timeout_ms` and `steps[].timeout_ms` on [definition](https://docs.beta.b3os.org/api/put-v1-routines-routine-)
67
+ - **Default:** 30,000 ms (`defaults.timeout_ms`), `defaults.timeout_ms` (`steps[].timeout_ms`)
68
+ - **Values:** 1 to 86,400,000 ms
69
+ - **Invalid value:** [`422 routine_invalid`](https://docs.beta.b3os.org/errors#routine_invalid)
70
+ - **Guide:** [Steps](https://docs.beta.b3os.org/routines/definitions#steps)
71
+
72
+ ```json
73
+ {"defaults": {"timeout_ms": 120000}}
74
+ ```
75
+
76
+ ### Retries
77
+
78
+ How often a failed step runs again, and how long it waits between attempts. `defaults.retry` applies only to `pure` and `read` steps; a `write` step retries only with its own `retry`, and an `irreversible` one never. Only failures the callee marks retryable are retried, and every attempt carries the same idempotency key.
79
+
80
+ - **Field:** `defaults.retry` on [definition](https://docs.beta.b3os.org/api/put-v1-routines-routine-)
81
+ - **Default:** none: a step runs once
82
+ - **Values:** `max_attempts`: 1 to 20; `initial_ms`: 1 to 3,600,000 (default 200); `factor`: 1 to 10 (default 2); `max_ms`: 1 to 86,400,000 (default 30,000); `jitter`: `true` or `false` (default `true`)
83
+ - **Invalid value:** [`422 routine_invalid`](https://docs.beta.b3os.org/errors#routine_invalid)
84
+ - **Guide:** [Retries](https://docs.beta.b3os.org/routines/definitions#retries)
85
+
86
+ ```json
87
+ {"defaults": {"retry": {"max_attempts": 3, "initial_ms": 500}}}
88
+ ```
89
+
90
+ ## Fixed in the beta
91
+
92
+ These work one way in the beta, and no request field changes them.
93
+
94
+ ### When sandboxes pause
95
+
96
+ **After 30 seconds of waiting.** With `pause_sandboxes`, a run's sandboxes pause once it waits at least 30 seconds (a wait, a sleep, or a signal wait with no deadline).
97
+
98
+ ### Lookahead
99
+
100
+ **On.** While a step that waits on I/O runs, the node creates the sandbox the next `sandboxes/exec@1` step needs. A pre-warmed sandbox whose step does not run is deleted after 30 seconds, and that time bills.
101
+
102
+ ### Run history
103
+
104
+ **Kept 30 days.** Runs, their steps and their events are kept 30 days.