@b3os/cli 0.2.0 → 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.
- package/README.md +87 -7
- package/assets/b3os-run.py +137 -0
- package/assets/skill/b3os/SKILL.md +111 -0
- package/dist/commands/_agents.d.ts +14 -0
- package/dist/commands/_agents.js +33 -0
- package/dist/commands/_agents.js.map +1 -0
- package/dist/commands/_common.js +6 -2
- package/dist/commands/_common.js.map +1 -1
- package/dist/commands/_context.d.ts +49 -0
- package/dist/commands/_context.js +260 -0
- package/dist/commands/_context.js.map +1 -0
- package/dist/commands/_next.d.ts +39 -0
- package/dist/commands/_next.js +77 -0
- package/dist/commands/_next.js.map +1 -0
- package/dist/commands/agent.d.ts +42 -0
- package/dist/commands/agent.js +218 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/app.d.ts +2 -0
- package/dist/commands/app.js +559 -54
- package/dist/commands/app.js.map +1 -1
- package/dist/commands/auth.d.ts +88 -2
- package/dist/commands/auth.js +354 -44
- package/dist/commands/auth.js.map +1 -1
- package/dist/commands/docs.d.ts +54 -0
- package/dist/commands/docs.js +202 -0
- package/dist/commands/docs.js.map +1 -0
- package/dist/commands/doctor.d.ts +23 -0
- package/dist/commands/doctor.js +313 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/init.d.ts +38 -1
- package/dist/commands/init.js +259 -60
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/listen.d.ts +30 -0
- package/dist/commands/listen.js +194 -0
- package/dist/commands/listen.js.map +1 -0
- package/dist/commands/manifest.d.ts +13 -1
- package/dist/commands/manifest.js +81 -18
- package/dist/commands/manifest.js.map +1 -1
- package/dist/commands/mcp.d.ts +25 -2
- package/dist/commands/mcp.js +120 -11
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/sandbox.d.ts +35 -6
- package/dist/commands/sandbox.js +208 -9
- package/dist/commands/sandbox.js.map +1 -1
- package/dist/commands/setup.d.ts +39 -0
- package/dist/commands/setup.js +203 -0
- package/dist/commands/setup.js.map +1 -0
- package/dist/commands/tool.d.ts +154 -0
- package/dist/commands/tool.js +785 -0
- package/dist/commands/tool.js.map +1 -0
- package/dist/config.d.ts +30 -6
- package/dist/config.js +39 -8
- package/dist/config.js.map +1 -1
- package/dist/ctx.d.ts +5 -45
- package/dist/ctx.js +25 -160
- package/dist/ctx.js.map +1 -1
- package/dist/docs/index.json +1 -0
- package/dist/docs/pages/actions/call.md +300 -0
- package/dist/docs/pages/actions/catalog/airtable.md +737 -0
- package/dist/docs/pages/actions/catalog/arxiv.md +166 -0
- package/dist/docs/pages/actions/catalog/chainalysis-sanctions.md +125 -0
- package/dist/docs/pages/actions/catalog/coingecko.md +1558 -0
- package/dist/docs/pages/actions/catalog/deps-dev.md +465 -0
- package/dist/docs/pages/actions/catalog/dexscreener.md +568 -0
- package/dist/docs/pages/actions/catalog/discord.md +784 -0
- package/dist/docs/pages/actions/catalog/finnhub.md +776 -0
- package/dist/docs/pages/actions/catalog/frankfurter.md +438 -0
- package/dist/docs/pages/actions/catalog/github.md +1853 -0
- package/dist/docs/pages/actions/catalog/gmail.md +575 -0
- package/dist/docs/pages/actions/catalog/google-calendar.md +654 -0
- package/dist/docs/pages/actions/catalog/google-drive.md +502 -0
- package/dist/docs/pages/actions/catalog/google-sheets.md +700 -0
- package/dist/docs/pages/actions/catalog/hacker-news.md +542 -0
- package/dist/docs/pages/actions/catalog/http.md +824 -0
- package/dist/docs/pages/actions/catalog/hyperliquid.md +942 -0
- package/dist/docs/pages/actions/catalog/jira.md +920 -0
- package/dist/docs/pages/actions/catalog/kalshi.md +917 -0
- package/dist/docs/pages/actions/catalog/linear.md +1030 -0
- package/dist/docs/pages/actions/catalog/markets.md +21 -0
- package/dist/docs/pages/actions/catalog/morpho.md +247 -0
- package/dist/docs/pages/actions/catalog/notion.md +1077 -0
- package/dist/docs/pages/actions/catalog/nws.md +485 -0
- package/dist/docs/pages/actions/catalog/open-meteo.md +559 -0
- package/dist/docs/pages/actions/catalog/polymarket.md +1523 -0
- package/dist/docs/pages/actions/catalog/pushbullet.md +220 -0
- package/dist/docs/pages/actions/catalog/resend.md +307 -0
- package/dist/docs/pages/actions/catalog/s3.md +513 -0
- package/dist/docs/pages/actions/catalog/sec-edgar.md +487 -0
- package/dist/docs/pages/actions/catalog/slack.md +2629 -0
- package/dist/docs/pages/actions/catalog/stripe.md +1405 -0
- package/dist/docs/pages/actions/catalog/wikipedia.md +379 -0
- package/dist/docs/pages/actions/catalog.md +46 -0
- package/dist/docs/pages/actions/limits.md +50 -0
- package/dist/docs/pages/actions/model-tools.md +225 -0
- package/dist/docs/pages/actions/packs.md +148 -0
- package/dist/docs/pages/actions/settings.md +69 -0
- package/dist/docs/pages/actions/tools.md +244 -0
- package/dist/docs/pages/actions/triggers.md +149 -0
- package/dist/docs/pages/actions.md +88 -0
- package/dist/docs/pages/compat/anthropic.md +168 -0
- package/dist/docs/pages/compat/e2b.md +194 -0
- package/dist/docs/pages/compat/firecrawl.md +138 -0
- package/dist/docs/pages/compat/openai.md +168 -0
- package/dist/docs/pages/concepts/auth.md +151 -0
- package/dist/docs/pages/concepts/beta.md +55 -0
- package/dist/docs/pages/concepts/glossary.md +71 -0
- package/dist/docs/pages/concepts/ids.md +98 -0
- package/dist/docs/pages/concepts/jobs.md +229 -0
- package/dist/docs/pages/concepts/latency.md +138 -0
- package/dist/docs/pages/concepts/limits.md +191 -0
- package/dist/docs/pages/concepts/stack.md +59 -0
- package/dist/docs/pages/concepts/timing.md +86 -0
- package/dist/docs/pages/concepts/usage.md +110 -0
- package/dist/docs/pages/design/b3os-yaml.md +370 -0
- package/dist/docs/pages/design/deploy-from-github.md +122 -0
- package/dist/docs/pages/design/observability.md +134 -0
- package/dist/docs/pages/errors.md +1824 -0
- package/dist/docs/pages/infer/chat.md +570 -0
- package/dist/docs/pages/infer/limits.md +55 -0
- package/dist/docs/pages/infer/messages.md +185 -0
- package/dist/docs/pages/infer/responses.md +173 -0
- package/dist/docs/pages/infer/settings.md +154 -0
- package/dist/docs/pages/infer/speech.md +323 -0
- package/dist/docs/pages/infer.md +154 -0
- package/dist/docs/pages/introduction.md +162 -0
- package/dist/docs/pages/platform/addresses.md +174 -0
- package/dist/docs/pages/platform/call-log.md +99 -0
- package/dist/docs/pages/platform/custom-domains.md +104 -0
- package/dist/docs/pages/platform/keys.md +79 -0
- package/dist/docs/pages/platform/limits.md +57 -0
- package/dist/docs/pages/platform/members.md +101 -0
- package/dist/docs/pages/platform/requests.md +116 -0
- package/dist/docs/pages/platform/settings.md +129 -0
- package/dist/docs/pages/platform/webhooks.md +68 -0
- package/dist/docs/pages/platform.md +67 -0
- package/dist/docs/pages/quickstart/mcp.md +94 -0
- package/dist/docs/pages/quickstart/sandbox-agent.md +205 -0
- package/dist/docs/pages/quickstart/scrape.md +134 -0
- package/dist/docs/pages/quickstart.md +45 -0
- package/dist/docs/pages/render/inspections.md +162 -0
- package/dist/docs/pages/render/limits.md +72 -0
- package/dist/docs/pages/render/screenshots.md +179 -0
- package/dist/docs/pages/render/settings.md +431 -0
- package/dist/docs/pages/render/styles.md +342 -0
- package/dist/docs/pages/render/videos.md +272 -0
- package/dist/docs/pages/render.md +118 -0
- package/dist/docs/pages/routines/callables.md +174 -0
- package/dist/docs/pages/routines/definitions.md +361 -0
- package/dist/docs/pages/routines/limits.md +117 -0
- package/dist/docs/pages/routines/runs.md +328 -0
- package/dist/docs/pages/routines/settings.md +104 -0
- package/dist/docs/pages/routines/triggers.md +339 -0
- package/dist/docs/pages/routines.md +216 -0
- package/dist/docs/pages/sandboxes/agents.md +217 -0
- package/dist/docs/pages/sandboxes/commands.md +272 -0
- package/dist/docs/pages/sandboxes/images.md +166 -0
- package/dist/docs/pages/sandboxes/limits.md +143 -0
- package/dist/docs/pages/sandboxes/ports.md +260 -0
- package/dist/docs/pages/sandboxes/settings.md +358 -0
- package/dist/docs/pages/sandboxes/snapshots.md +423 -0
- package/dist/docs/pages/sandboxes/swarms.md +146 -0
- package/dist/docs/pages/sandboxes/volumes.md +131 -0
- package/dist/docs/pages/sandboxes.md +231 -0
- package/dist/docs/pages/sdks/cli.md +121 -0
- package/dist/docs/pages/sdks/mcp.md +169 -0
- package/dist/docs/pages/sdks/python.md +146 -0
- package/dist/docs/pages/sdks/typescript.md +202 -0
- package/dist/docs/pages/sdks.md +282 -0
- package/dist/docs/pages/settings.md +33 -0
- package/dist/docs/pages/vault/limits.md +46 -0
- package/dist/docs/pages/vault.md +133 -0
- package/dist/docs/pages/vision/agent-browser.md +115 -0
- package/dist/docs/pages/vision/crawl.md +333 -0
- package/dist/docs/pages/vision/extract.md +152 -0
- package/dist/docs/pages/vision/fetcher.md +15 -0
- package/dist/docs/pages/vision/limits.md +79 -0
- package/dist/docs/pages/vision/profiles.md +111 -0
- package/dist/docs/pages/vision/proxy.md +131 -0
- package/dist/docs/pages/vision/scrape.md +356 -0
- package/dist/docs/pages/vision/sessions.md +311 -0
- package/dist/docs/pages/vision/settings.md +656 -0
- package/dist/docs/pages/vision.md +175 -0
- package/dist/errors.d.ts +129 -0
- package/dist/errors.js +326 -0
- package/dist/errors.js.map +1 -0
- package/dist/main.d.ts +1 -1
- package/dist/main.js +26 -13
- package/dist/main.js.map +1 -1
- package/dist/manifest/apply.d.ts +4 -0
- package/dist/manifest/apply.js +2 -0
- package/dist/manifest/apply.js.map +1 -1
- package/dist/manifest/domains.d.ts +50 -0
- package/dist/manifest/domains.js +159 -0
- package/dist/manifest/domains.js.map +1 -0
- package/dist/manifest/link.d.ts +20 -0
- package/dist/manifest/link.js +24 -0
- package/dist/manifest/link.js.map +1 -0
- package/dist/manifest/record.d.ts +1 -1
- package/dist/tool/archive.d.ts +33 -0
- package/dist/tool/archive.js +174 -0
- package/dist/tool/archive.js.map +1 -0
- package/dist/tool/calls.d.ts +46 -0
- package/dist/tool/calls.js +274 -0
- package/dist/tool/calls.js.map +1 -0
- package/dist/tool/checks.d.ts +21 -0
- package/dist/tool/checks.js +145 -0
- package/dist/tool/checks.js.map +1 -0
- package/dist/tool/elf.d.ts +19 -0
- package/dist/tool/elf.js +107 -0
- package/dist/tool/elf.js.map +1 -0
- package/dist/tool/predict.d.ts +8 -0
- package/dist/tool/predict.js +38 -0
- package/dist/tool/predict.js.map +1 -0
- package/dist/tool/ustar.d.ts +5 -0
- package/dist/tool/ustar.js +220 -0
- package/dist/tool/ustar.js.map +1 -0
- package/package.json +6 -5
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Jobs, streams and webhooks
|
|
2
|
+
|
|
3
|
+
> The one contract every long-running B3OS operation follows, how to wait, stream or get a webhook, and how to retry writes safely.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/concepts/jobs.md
|
|
6
|
+
|
|
7
|
+
Crawls, batch scrapes, videos, routine runs and extractions take longer than a request should. They are **jobs**, and every job works the same way.
|
|
8
|
+
|
|
9
|
+
## The job object
|
|
10
|
+
|
|
11
|
+
```json
|
|
12
|
+
{
|
|
13
|
+
"id": "crawl_01m5t4gh4qhgs70zwajezbe5p0",
|
|
14
|
+
"object": "crawl",
|
|
15
|
+
"status": "running",
|
|
16
|
+
"created_at": "2026-10-25T18:10:02.114Z",
|
|
17
|
+
"updated_at": "2026-10-25T18:10:20.402Z",
|
|
18
|
+
"started_at": "2026-10-25T18:10:02.120Z",
|
|
19
|
+
"finished_at": null,
|
|
20
|
+
"progress": { "completed": 12, "failed": 0, "total": 37, "unit": "pages" },
|
|
21
|
+
"expires_at": null,
|
|
22
|
+
"metadata": {}
|
|
23
|
+
}
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
`status` moves from `queued` to `running` to one of `succeeded`, `failed` or `canceled`, and never leaves a terminal status. `progress` counts in the job's own unit (pages, phases, steps). Once the job ends, `result` holds the output on success, `error` holds a [problem](https://docs.beta.b3os.org/errors) on failure or cancel, `timing` has the final phase durations, and `expires_at` says when the results are deleted.
|
|
27
|
+
|
|
28
|
+
## Three ways to get the result
|
|
29
|
+
|
|
30
|
+
**Wait in the request.** Add `?wait=<seconds>` (up to 60) to the `POST` that creates the job. If it finishes in time you get `200` with the finished job. If not, you get `202` with the job as it is, a `Location` header to poll and a `Retry-After` header.
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
curl -s "https://beta-api.b3os.org/v1/vision/crawls?wait=30" \
|
|
34
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
35
|
+
-H "Content-Type: application/json" \
|
|
36
|
+
-d '{"url": "https://docs.example.com", "limit": 20}'
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Stream its events.** Send `Accept: text/event-stream` on the creating `POST`, or open `GET .../{id}/events` later.
|
|
40
|
+
|
|
41
|
+
**Get a webhook.** Pass `webhook: {url, events}` when you create the job and B3OS posts the events to your URL. See [webhooks](#webhooks) below.
|
|
42
|
+
|
|
43
|
+
You can also poll `GET` on the job with its ID. To stop a job, `POST .../{id}/cancel`: it ends `canceled` with the code [`job_canceled`](https://docs.beta.b3os.org/errors#job_canceled), and work already done stays done and billed.
|
|
44
|
+
|
|
45
|
+
Note:
|
|
46
|
+
A request that does not stream gets its response within 65 seconds: no handler works on one request for more than 60 seconds, `?wait` included, and the rest covers queueing and the edge. Anything longer is a job. Streams stay open longer, up to each operation's own limit: an hour for job event streams, streamed commands and sandbox terminals, 30 minutes for a browser session's CDP socket, 10 minutes for a streamed chat completion. Reconnect an event stream with `Last-Event-ID` to continue past it.
|
|
47
|
+
|
|
48
|
+
## Event streams
|
|
49
|
+
|
|
50
|
+
Every stream in B3OS (job events, command output, sandbox logs) uses the same server-sent events framing:
|
|
51
|
+
|
|
52
|
+
```text
|
|
53
|
+
id: 14
|
|
54
|
+
event: page.succeeded
|
|
55
|
+
data: {"type":"page.succeeded","ts":"2026-10-25T18:10:20.402Z","job_id":"crawl_01m5t4gh4qhgs70zwajezbe5p0","seq":14,"page":{"object":"page_result","url":"https://docs.example.com/guides/keys","status":"succeeded","depth":2}}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
- `seq` goes up by one per event and equals the SSE `id`. If the connection drops, reconnect with `Last-Event-ID: <seq>` and the stream resumes after that event.
|
|
59
|
+
- A `: ping` comment arrives every 15 seconds, so idle proxies keep the connection open.
|
|
60
|
+
- Lifecycle events are `job.queued`, `job.running`, `job.progress` and the terminal `job.succeeded`, `job.failed` and `job.canceled`. The terminal event carries the final job, timing included, and ends the stream.
|
|
61
|
+
- Products add their own events, such as `page.succeeded` for crawls, `step.waiting` for routine runs and `video.artifact` for videos. Each operation in the [API reference](https://docs.beta.b3os.org/api/overview) lists the events it sends.
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
curl -N -s "https://beta-api.b3os.org/v1/vision/crawls/$CRAWL_ID/events" \
|
|
65
|
+
-H "Authorization: Bearer $B3OS_API_KEY"
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Webhooks
|
|
69
|
+
|
|
70
|
+
Pass a webhook when you create a job:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{ "url": "https://docs.example.com", "webhook": { "url": "https://example.com/hooks/b3os", "events": ["job.succeeded", "job.failed"] } }
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`events` defaults to the terminal events; `["*"]` sends every event. B3OS posts each one as a JSON event (the job is abridged here):
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"id": "evt_01m5t4p5ycda35cq27epnbfqhe",
|
|
81
|
+
"object": "event",
|
|
82
|
+
"type": "job.succeeded",
|
|
83
|
+
"created_at": "2026-10-25T18:10:41.030Z",
|
|
84
|
+
"job_id": "crawl_01m5t4gh4qhgs70zwajezbe5p0",
|
|
85
|
+
"data": { "job": { "id": "crawl_01m5t4gh4qhgs70zwajezbe5p0", "object": "crawl", "status": "succeeded" } }
|
|
86
|
+
}
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
The event `id` stays the same across retries of one delivery, so use it to drop duplicates. Failed deliveries are retried with backoff for 24 hours. Deliveries leave from the node through the egress guard, so URLs on private or loopback addresses are refused.
|
|
90
|
+
|
|
91
|
+
Note:
|
|
92
|
+
Vision crawls and batches, render videos and routine runs deliver their webhooks. Crawls and batches started through the [Firecrawl-compatible API](https://docs.beta.b3os.org/compat/firecrawl) accept and validate `webhook` but do not deliver it yet in this beta; follow those jobs' status or poll them.
|
|
93
|
+
|
|
94
|
+
### Verify the signature
|
|
95
|
+
|
|
96
|
+
Every delivery carries `B3OS-Signature: t=<unix seconds>,v1=<hex>`. The signature is HMAC-SHA256 over `<t>.<raw body>`, keyed with the signing secret of your URL: the UTF-8 bytes of the whole `whsec_...` string, prefix included, never decoded. Each attempt is signed when it is sent, so a retry hours later carries a fresh `t` and still passes a five-minute check. Get the secret once, when you set up the receiver: the first answer for a URL holds it, later ones answer `secret: null` with a `secret_hint`, and a [rotation](https://docs.beta.b3os.org/platform/webhooks#rotate-the-secret) gives you a new one. The call needs a key with `platform:write`, which the first key you get with your invite does not have. Create one in the [dashboard](https://beta.b3os.org/app) first: the API cannot do it for you, because creating a key needs `platform:write` too and a key never gets scopes its creator lacks.
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
curl -s https://beta-api.b3os.org/v1/webhooks/secret \
|
|
100
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
101
|
+
-H "Content-Type: application/json" \
|
|
102
|
+
-d '{"url": "https://example.com/hooks/b3os"}'
|
|
103
|
+
# {"object": "webhook_secret", "url": "https://example.com/hooks/b3os", "secret": "whsec_...", ...}
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Then check every delivery against the raw body, before parsing it. The SDKs do it in one call and throw `WebhookVerificationError` for a delivery that fails; the versions without the SDK return `false` for anything malformed instead of throwing. Whichever you use, make a missing secret stop the receiver: a signature computed with an empty key is one anybody can compute.
|
|
107
|
+
|
|
108
|
+
**TypeScript**
|
|
109
|
+
|
|
110
|
+
```ts
|
|
111
|
+
import { verifyWebhook, WebhookVerificationError } from "@b3os/sdk/webhooks";
|
|
112
|
+
|
|
113
|
+
// An empty or missing secret must stop the receiver: never verify with "" as the key.
|
|
114
|
+
const secret = process.env.B3OS_WEBHOOK_SECRET;
|
|
115
|
+
if (!secret) throw new Error("B3OS_WEBHOOK_SECRET is not set");
|
|
116
|
+
|
|
117
|
+
// rawBody is the request body exactly as received, before any JSON parsing
|
|
118
|
+
try {
|
|
119
|
+
const event = await verifyWebhook(rawBody, request.headers.get("b3os-signature"), secret);
|
|
120
|
+
console.log(event.type, event.id);
|
|
121
|
+
} catch (error) {
|
|
122
|
+
if (!(error instanceof WebhookVerificationError)) throw error;
|
|
123
|
+
// answer 400 and drop the delivery; error.reason says why
|
|
124
|
+
}
|
|
125
|
+
```
|
|
126
|
+
**Python**
|
|
127
|
+
|
|
128
|
+
```python
|
|
129
|
+
import os
|
|
130
|
+
from b3os import WebhookVerificationError, verify_webhook
|
|
131
|
+
|
|
132
|
+
# An empty or missing secret must stop the receiver: never verify with "" as the key.
|
|
133
|
+
secret = os.environ.get("B3OS_WEBHOOK_SECRET")
|
|
134
|
+
if not secret:
|
|
135
|
+
raise RuntimeError("B3OS_WEBHOOK_SECRET is not set")
|
|
136
|
+
|
|
137
|
+
# raw_body is the request body exactly as received, before any JSON parsing
|
|
138
|
+
try:
|
|
139
|
+
event = verify_webhook(raw_body, headers.get("b3os-signature"), secret)
|
|
140
|
+
print(event["type"], event["id"])
|
|
141
|
+
except WebhookVerificationError as error:
|
|
142
|
+
print("rejected:", error.reason) # answer 400 and drop the delivery
|
|
143
|
+
```
|
|
144
|
+
**Node, no SDK**
|
|
145
|
+
|
|
146
|
+
```ts
|
|
147
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
148
|
+
|
|
149
|
+
// True only for a delivery signed with `secret` less than five minutes ago. Never throws, and an empty or
|
|
150
|
+
// missing secret is never accepted (an HMAC with an empty key is one anybody can compute).
|
|
151
|
+
export function verifyB3osSignature(
|
|
152
|
+
rawBody: string | Buffer,
|
|
153
|
+
header: string | null | undefined,
|
|
154
|
+
secret: string | null | undefined,
|
|
155
|
+
): boolean {
|
|
156
|
+
if (typeof header !== "string" || typeof secret !== "string" || secret === "") return false;
|
|
157
|
+
if (typeof rawBody !== "string" && !Buffer.isBuffer(rawBody)) return false;
|
|
158
|
+
let t: number | undefined;
|
|
159
|
+
const signatures: Buffer[] = [];
|
|
160
|
+
for (const part of header.split(",")) {
|
|
161
|
+
const eq = part.indexOf("=");
|
|
162
|
+
if (eq < 0) continue;
|
|
163
|
+
const key = part.slice(0, eq).trim();
|
|
164
|
+
const value = part.slice(eq + 1).trim();
|
|
165
|
+
if (key === "t" && /^[0-9]{1,12}$/.test(value)) t = Number(value);
|
|
166
|
+
else if (key === "v1" && /^[0-9a-fA-F]{64}$/.test(value)) signatures.push(Buffer.from(value, "hex"));
|
|
167
|
+
}
|
|
168
|
+
if (t === undefined || Math.abs(Date.now() / 1000 - t) > 300) return false;
|
|
169
|
+
const expected = createHmac("sha256", secret).update(`${t}.`).update(rawBody).digest();
|
|
170
|
+
return signatures.some((signature) => timingSafeEqual(signature, expected));
|
|
171
|
+
}
|
|
172
|
+
```
|
|
173
|
+
**Python, no SDK**
|
|
174
|
+
|
|
175
|
+
```python
|
|
176
|
+
import hashlib
|
|
177
|
+
import hmac
|
|
178
|
+
import re
|
|
179
|
+
import time
|
|
180
|
+
|
|
181
|
+
def verify_b3os_signature(raw_body: bytes, header: str | None, secret: str | None) -> bool:
|
|
182
|
+
"""True only for a delivery signed with `secret` less than five minutes ago.
|
|
183
|
+
|
|
184
|
+
Never raises, and never accepts an empty or missing secret (an HMAC with an empty key is one anybody can
|
|
185
|
+
compute), so os.environ.get() returning None or "" fails closed.
|
|
186
|
+
"""
|
|
187
|
+
if not isinstance(header, str) or not isinstance(raw_body, bytes):
|
|
188
|
+
return False
|
|
189
|
+
if not isinstance(secret, str) or not secret:
|
|
190
|
+
return False
|
|
191
|
+
t = None
|
|
192
|
+
signatures = []
|
|
193
|
+
for part in header.split(","):
|
|
194
|
+
key, sep, value = part.partition("=")
|
|
195
|
+
key, value = key.strip(), value.strip()
|
|
196
|
+
if not sep:
|
|
197
|
+
continue
|
|
198
|
+
if key == "t" and re.fullmatch(r"[0-9]{1,12}", value):
|
|
199
|
+
t = int(value)
|
|
200
|
+
elif key == "v1" and re.fullmatch(r"[0-9a-fA-F]{64}", value):
|
|
201
|
+
signatures.append(value.lower())
|
|
202
|
+
if t is None or abs(time.time() - t) > 300:
|
|
203
|
+
return False
|
|
204
|
+
expected = hmac.new(secret.encode(), f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
|
|
205
|
+
return any(hmac.compare_digest(signature, expected) for signature in signatures)
|
|
206
|
+
```
|
|
207
|
+
|
|
208
|
+
All four reject a timestamp more than five minutes from your clock, which limits replays (the SDKs take a tolerance option). All four accept a delivery when any `v1` value matches: while you rotate a secret with `POST /v1/webhooks/secret/rotate`, deliveries carry two, one per secret, for the grace period you choose (a day by default). `POST /v1/webhooks/test` sends a signed `webhook.test` event so you can check the receiver, and `GET /v1/webhooks/deliveries` lists recent deliveries with their attempts and last status. [Webhooks](https://docs.beta.b3os.org/platform/webhooks) covers both.
|
|
209
|
+
|
|
210
|
+
## Retry writes safely
|
|
211
|
+
|
|
212
|
+
Operations that change something accept an `Idempotency-Key` header. Send a unique value, such as a UUID, and retry with the same key after a timeout or a dropped connection:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
curl -s https://beta-api.b3os.org/v1/sandboxes \
|
|
216
|
+
-H "Authorization: Bearer $B3OS_API_KEY" \
|
|
217
|
+
-H "Idempotency-Key: 6f1c2a0e-4b7d-4e55-9a51-0d8f2c8e7b21" \
|
|
218
|
+
-H "Content-Type: application/json" \
|
|
219
|
+
-d '{"template": "base"}'
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
- A retry with the same key, method, path and body within 24 hours returns the stored response with `Idempotent-Replayed: true`, and only to the same principal: the same API key, or the same sandbox for calls from inside one.
|
|
223
|
+
- The same key with a different request, or from another principal, fails with `409` [`idempotency_key_conflict`](https://docs.beta.b3os.org/errors#idempotency_key_conflict); a retry while the first request is still running gets `409` [`idempotency_request_in_progress`](https://docs.beta.b3os.org/errors#idempotency_request_in_progress) and should wait `Retry-After`. A key that is not a usable value fails with `400` [`idempotency_key_invalid`](https://docs.beta.b3os.org/errors#idempotency_key_invalid).
|
|
224
|
+
- Keys are scoped to your project. Responses of operations with external effects are stored durably. For creates without external effects, the stored response lives in memory and a node restart forgets it.
|
|
225
|
+
- What is stored: answers with a body of known size, up to 256 KiB, except `408`, `429` and the `409`s above, which a retry should run again. `5xx` answers and streams are not stored, and their key is released, so a retry runs the operation again. A command run in a sandbox is the exception: once it was handed to the sandbox its key is kept, and a retry gets `409` [`idempotency_outcome_unknown`](https://docs.beta.b3os.org/errors#idempotency_outcome_unknown) instead of a second run ([commands](https://docs.beta.b3os.org/sandboxes/commands#retry-a-command-without-running-it-twice)).
|
|
226
|
+
- If the client goes away before the response, the request still runs to the end and its answer is stored, so a retry with the key gets that answer, a sandbox create included ([sandboxes](https://docs.beta.b3os.org/sandboxes#if-the-connection-drops)). Job creates are the exception: a client that leaves while one waits (`?wait`) releases its key, and a retry may start a second job.
|
|
227
|
+
- B3OS remembers a bounded number of keys per organization and per node. Past a bound, a request with a new key is refused, never run without its key: `429` [`quota_exceeded`](https://docs.beta.b3os.org/errors#quota_exceeded) for your organization's bound, `503` [`capacity_unavailable`](https://docs.beta.b3os.org/errors#capacity_unavailable) for the node's. Both are retryable.
|
|
228
|
+
|
|
229
|
+
The API reference shows which operations take the header.
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
# Same-host latency
|
|
2
|
+
|
|
3
|
+
> A whole agent loop measured on one B3OS node, where a turn's time goes, and which setups keep the model, the tools and the agent on one machine.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/concepts/latency.md
|
|
6
|
+
|
|
7
|
+
Every turn of an agent is a model call followed by tool calls. When the model, the tools and the agent sit in different places, every hop between them crosses a network. B3OS runs the tools on the node that serves its model, which removes those hops for an agent that runs on that node too and uses that model.
|
|
8
|
+
|
|
9
|
+
## The whole loop, measured
|
|
10
|
+
|
|
11
|
+
An agent harness in a B3OS sandbox on the node runs tasks of streamed model calls and tool calls against the node's own model and tools, under the benchmark lock. [The loop](https://docs.beta.b3os.org/benchmarks#the-loop) on the benchmarks page describes the task and its three configurations.
|
|
12
|
+
|
|
13
|
+
**Under 350 ms per agent turn, under 4,500 ms per 12-turn task (450 of 450 real-page scrapes in the fetch tier)**, with the model and the tools on one machine: configuration A, the harness in a B3OS sandbox on the node calling the node's model (`b3os/qwen3.5-9b`) and B3OS tools over vsock. 30 tasks of 12 turns in each of 5 runs, back to back; 150 of 150 tasks and 1,800 of 1,800 turns completed, 0 errors. Timed by the client on the same host under the benchmark lock, 2026-11-17, release 534714df, the newest release on which configuration B also has a counted run. [Raw data](https://beta.b3os.org/raw/bench/loop/results/20261117T083830Z-loop-a-prod-1111-v12/loop-a/loop-a/loop.A.result.json)
|
|
14
|
+
|
|
15
|
+
| Part of the loop | p50, median of run medians | Best run: p50 / p95 / p99 | n | Timed by | Board entry |
|
|
16
|
+
|---|---|---|---|---|---|
|
|
17
|
+
| A task of 12 turns (450 of 450 real-page scrapes in the fetch tier) | 4,040 ms | 3,720 / 3,880 / 3,930 ms | 150 | client | `loop/b2b-c1/2026-11-17T08:55:59.415Z#task_ms` |
|
|
18
|
+
| One turn: a model call, a tool call and the harness between them | 335 ms | 305 / 384 / 417 ms | 1,800 | client | `loop/b2b-c1/2026-11-17T08:55:59.415Z#turn_ms` |
|
|
19
|
+
| The model call, streamed: 428 tokens in, up to 64 out | 314 ms | 282 / 323 / 326 ms | 1,800 | client | `loop/b2b-c1/2026-11-17T08:55:59.415Z#think_ms` |
|
|
20
|
+
| The model call, as the node's request log times it | 313 ms | 282 / 322 / 325 ms | 1,800 | server | `loop/b2b-c1/2026-11-17T08:55:59.415Z#think_server_ms` |
|
|
21
|
+
| First token of the model call | 50.5 ms | 50 / 58.4 / 60.6 ms | 1,800 | client | `loop/b2b-c1/2026-11-17T08:55:59.415Z#ttft_ms` |
|
|
22
|
+
| The tool call | 21.5 ms | 20.8 / 97.5 / 112 ms | 1,800 | client | `loop/b2b-c1/2026-11-17T08:55:59.415Z#act_ms` |
|
|
23
|
+
| The tool call, as the node times it | 21 ms | 20.3 / 97.1 / 112 ms | 1,800 | server | `loop/b2b-c1/2026-11-17T08:55:59.415Z#act_server_ms` |
|
|
24
|
+
| Transport in a turn: the client's time less the node's | 0.814 ms | 0.806 / 1.12 / 1.31 ms | 1,800 | client | `loop/b2b-c1/2026-11-17T08:55:59.415Z#turn_transport_ms` |
|
|
25
|
+
|
|
26
|
+
Where a turn's time goes, as shares of its p50 of 335 ms (each part's own p50, so they do not add up exactly): the model call 314 ms (94%), the tool call 21.5 ms (6%), and transport between the sandbox and the node's services 0.814 ms (0.2%); over all 1,800 turns, transport is 0.3% of the loop's time.
|
|
27
|
+
|
|
28
|
+
The tool call rotates through 4 tools, one per turn. Each tool's figures pool its calls over the 5 runs, from the raw result's `loop.per_tool`:
|
|
29
|
+
|
|
30
|
+
| Tool | Calls | p50 | p95 | p99 | p50 as the node times it |
|
|
31
|
+
|---|---|---|---|---|---|
|
|
32
|
+
| A command in a B3OS sandbox (`sandboxes.exec`, a one-line Python sum) | 450 | 21.5 ms | 22.7 ms | 23.3 ms | 21.1 ms |
|
|
33
|
+
| A scrape of a 100 KB fixture page (`vision.scrape`) | 450 | 21.2 ms | 27.3 ms | 65 ms | 20.6 ms |
|
|
34
|
+
| A browser action in a live session on that page (`vision.session.act`) | 450 | 69.2 ms | 112 ms | 132 ms | 68.8 ms |
|
|
35
|
+
| A scrape of https://semver.org/spec/v2.0.0.html, the same page every time (`vision.scrape`) | 450 | 7.82 ms | 8.77 ms | 10.3 ms | 7.36 ms |
|
|
36
|
+
|
|
37
|
+
Once per task the same sandbox also moves data over the network (n 150 each, median of run medians): shallow clone of a fixed public GitHub repo at a fixed tag, 459 ms; npm install of a fixed package version from the public registry into an empty prefix, no cache, 2,350 ms; fetch of a fixed-size 10 MiB object over HTTPS from B3OS's own site, 134 ms.
|
|
38
|
+
|
|
39
|
+
## Where the loop runs
|
|
40
|
+
|
|
41
|
+
There are three ways to use B3OS, and they differ in how much of the loop stays on one machine:
|
|
42
|
+
|
|
43
|
+
| Your setup | Model call | Tool calls |
|
|
44
|
+
|---|---|---|
|
|
45
|
+
| Agent in a [B3OS sandbox](https://docs.beta.b3os.org/quickstart/sandbox-agent), model from [infer](https://docs.beta.b3os.org/infer) | On the node | On the node, over vsock |
|
|
46
|
+
| Agent elsewhere, model from infer | Over the internet to the edge | Over the internet to the edge |
|
|
47
|
+
| Agent elsewhere, a frontier model from another provider | At that provider | Over the internet to the edge |
|
|
48
|
+
|
|
49
|
+
Only the first keeps the whole think-act-observe loop on one machine. The second still gets the warm pools (browsers already running, microVMs already restored) but pays a network round trip per call. The third gets co-located acting and observing only; the model call happens wherever that model runs.
|
|
50
|
+
|
|
51
|
+
Tools that reach outside still cross the internet for that part: a scrape of a public site fetches it from the site, and an action that calls GitHub calls GitHub. What stays local is the hop between your agent, the model and B3OS.
|
|
52
|
+
|
|
53
|
+
## What a local call costs
|
|
54
|
+
|
|
55
|
+
The numbers below are **dev baselines**: measured on the beta node before any product code existed, to decide how to build the products. They are floors under the products, not product results. Each was a dev run without the benchmark lock, server side, on the node, between 2026-10-25 and 2026-10-26. [Dev baselines](https://docs.beta.b3os.org/benchmarks#dev-baselines) on the benchmarks page lists the source of each area's numbers.
|
|
56
|
+
|
|
57
|
+
| What | p50 | n | Design consequence |
|
|
58
|
+
|---|---|---|---|
|
|
59
|
+
| Unix socket round trip, 64 B, C, within one CPU complex (CCD) / across sockets | 3.5 µs / 12.1 µs | 3 runs of 100,000 | Products on the node talk over local sockets, not the network |
|
|
60
|
+
| HTTP/1.1 over a Unix socket, Go client and server pinned to one CCD | 12.0 µs | 3 runs of 20,000 | HTTP/1.1 keep-alive is the default local transport; HTTP/2 without TLS measured slower |
|
|
61
|
+
| The same Go round trip with threads left unpinned | 50.1 µs | 3 runs of 20,000 | Latency-critical threads are pinned to one CCD per NUMA node |
|
|
62
|
+
| Host to microVM over vsock, ping | 17.6 µs | 10,000 | Sandbox exec and the in-sandbox API ride vsock |
|
|
63
|
+
| Run `/bin/true` in a microVM over vsock | 162 µs | 2,000 | |
|
|
64
|
+
| Restore a microVM from a warm snapshot to first reply | 3.26 ms | 100 | Sandboxes are claimed from restored slots, never booted on request (cold boot: 58.1 ms, n=100) |
|
|
65
|
+
| Usable browser tab on a warm Chrome headless shell | 8.9 ms | 100 | Scrape contexts and tabs are created ahead of time and claimed from a pool |
|
|
66
|
+
| HTML to Markdown in Rust, readability plus htmd, per page | 2.7 ms | 33 pages | Extraction runs in Rust inside the daemon; the Node and jsdom pipeline was 64x slower |
|
|
67
|
+
| 4 KiB durable write with FUA | 213 µs | 240,000 | A durable routine step is designed to cost about one such commit |
|
|
68
|
+
|
|
69
|
+
n is the number of samples behind each p50; for the "3 runs of" rows the p50 is the median of the three runs' p50s. The rows come from the platform, sandboxes and vision baselines under [Dev baselines](https://docs.beta.b3os.org/benchmarks#dev-baselines), which record every row's conditions and say where its raw data is published.
|
|
70
|
+
|
|
71
|
+
## What B3OS commits to
|
|
72
|
+
|
|
73
|
+
These are **targets** from the build contract, server side and p50 unless noted. Each will be published only with a measured result next to it.
|
|
74
|
+
|
|
75
|
+
| Operation | Target |
|
|
76
|
+
|---|---|
|
|
77
|
+
| Claim a sandbox and run its first command | 5 ms, at idle and under 100-claim bursts |
|
|
78
|
+
| Claim a browser context from the scrape pool | 5 ms (p99 15 ms) |
|
|
79
|
+
| Overhead per browser action in a session | 1 ms |
|
|
80
|
+
| Pause or resume a sandbox | 0.5 ms |
|
|
81
|
+
| Dispatch a pure routine step, 1 KB | 20 µs |
|
|
82
|
+
| Call an action from a routine on the same node, 1 KB | 60 µs |
|
|
83
|
+
| Declarative HTTP action overhead, excluding the upstream | 150 µs |
|
|
84
|
+
| Styled screenshot at 1600x900, quiet window included | 150 ms |
|
|
85
|
+
|
|
86
|
+
[Benchmarks](https://docs.beta.b3os.org/benchmarks) lists every target and how it will be measured.
|
|
87
|
+
|
|
88
|
+
## Measured on the node
|
|
89
|
+
|
|
90
|
+
The newest published result for each headline operation, from the benchmark board. These ran under the benchmark lock on the beta node, timed by the server or by a client on the same host; calls from outside the node add network time.
|
|
91
|
+
|
|
92
|
+
| Product | Operation | p50, median of run medians | Measured under | Side, vantage | n | Date | Raw data |
|
|
93
|
+
|---|---|---|---|---|---|---|---|
|
|
94
|
+
| Sandboxes | Sandbox claimed, first command run | 2.81 ms (best run 2.75 ms, 5 runs) | Warm pool of 8, one claim every 100 ms beside a light background mix of other products' calls. UDS, same NUMA | client, same-host | 200 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T092119Z-w4q-mixed/sandboxes-claim-exec-mixed/sandboxes.claim_first_exec.gap-100ms+bg.result.json) |
|
|
95
|
+
| Sandboxes | POST /v1/sandboxes, timed by the server | 1.15 ms (best run 1.09 ms, 5 runs) | Warm slot in the pool, one create every 100 ms beside a light background mix. UDS, same NUMA | server, same-host | 200 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T092119Z-w4q-mixed/sandboxes-claim-exec-mixed/sandboxes.claim_first_exec.gap-100ms+bg.result.json) |
|
|
96
|
+
| Sandboxes | A command in a running sandbox | 0.306 ms (best run 0.304 ms, 5 runs) | /bin/true, back to back, exit status returned. UDS, same NUMA | server, same-host | 10000 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/sandboxes-exec-rtt/sandboxes.exec_rtt.b2b-c1.result.json) |
|
|
97
|
+
| Sandboxes | Fork of a running sandbox, timed by the server | 31.8 ms (best run 29.6 ms, 5 runs) | 128 MiB sandbox with no memory written since boot, on production, back to back; memory written before the fork adds to it (the board lists the 16 MiB case). HTTPS, same NUMA | server, same-host | 100 | 2026-11-21 | [result](https://beta.b3os.org/raw/bench/sandboxes/results/20261121T080844Z-w3-prod-fork-overlay/fork-128mib-dirty0mib.result.json) |
|
|
98
|
+
| Sandboxes | 5 forks in one call, timed by the server | 53.1 ms (best run 50.8 ms, 5 runs) | One POST …/fork with count 5 of a 128 MiB sandbox with no memory written since boot, on production node n2, back to back; memory written before the fork adds to it (the board lists the 16 MiB case). HTTPS, same NUMA | server, same-host | 100 | 2026-11-24 | [result](https://beta.b3os.org/raw/bench/sandboxes/results/20261124T231112Z-w3-n2-fanout/fanout-128mib-dirty0mib-x5.result.json) |
|
|
99
|
+
| Infer | First token from a 1,000-token prompt | 46.8 ms (best run 44.4 ms, 5 runs) | b3os/qwen3.5-9b, one stream at a time, unique prompts, B3OS idle. UDS, same NUMA | client, same-host | 80 | 2026-11-03 | [result](https://beta.b3os.org/raw/bench/infer/results/20261103T090624Z-w5-b2b-q/infer.chat_stream.c1.result.json) |
|
|
100
|
+
| Infer | First token when a 1,000-token prompt repeats | 41.1 ms (best run 39.5 ms, 5 runs) | b3os/qwen3.5-9b, one stream at a time, the same prompt again with its prefix cache warm, B3OS idle. UDS, same NUMA | client, same-host | 60 | 2026-11-01 | [result](https://beta.b3os.org/raw/bench/infer/results/20261101T083902Z-w3-prefix-q/infer.chat_stream.same1k.result.json) |
|
|
101
|
+
| Infer | Each output token after the first, one stream | 4.7 ms (best run 4.7 ms, 5 runs) | b3os/qwen3.5-9b, one stream at a time, unique 1,000-token prompts, 256 tokens out, B3OS idle. UDS, same NUMA | client, same-host | 80 | 2026-11-03 | [result](https://beta.b3os.org/raw/bench/infer/results/20261103T090624Z-w5-b2b-q/infer.chat_stream.c1.result.json) |
|
|
102
|
+
| Infer | Output tokens a second across 32 streams | 2,270 tokens/s (best run 2,270 tokens/s, 5 runs) | b3os/qwen3.5-9b, 1,000-token prompts, 256 tokens out per stream, B3OS idle. UDS, same NUMA | client, same-host | 5 | 2026-11-03 | [result](https://beta.b3os.org/raw/bench/infer/results/20261103T090624Z-w5-b2b-q/infer.chat_stream.c32.result.json) |
|
|
103
|
+
| Infer | Sooner first token when a 4,000-token prompt repeats | 2.5x: 53.9 ms repeated, 137 ms unique (5 runs each) | b3os/qwen3.5-9b, one request at a time, a repeated prompt against a unique one, B3OS idle. UDS, same NUMA | client, same-host | 60 | 2026-11-01 | [repeated](https://beta.b3os.org/raw/bench/infer/results/20261101T083902Z-w3-prefix-q/infer.chat_stream.same4k.result.json), [unique](https://beta.b3os.org/raw/bench/infer/results/20261101T083902Z-w3-prefix-q/infer.chat_stream.unique4k.result.json) |
|
|
104
|
+
| Infer | A 5-second speech clip, complete | 27.5 ms, 168x real time for 4.64 s of audio (best run 27.5 ms, 5 runs) | kokoro-82m on the GPU, the whole clip returned, back to back. UDS, same NUMA | server, server-side | 1000 | 2026-11-05 | [result](https://beta.b3os.org/raw/bench/infer/results/20261105T084352Z-w6-voice-q/infer.speech_ttfa.short-c1.result.json) |
|
|
105
|
+
| Infer | Speech made faster than real time | 313x real time: 22.5 s of audio in 71.9 ms (best run 71.8 ms, 5 runs) | kokoro-82m on the GPU, a 352-character text, the whole clip returned, back to back. UDS, same NUMA | server, server-side | 1000 | 2026-11-05 | [result](https://beta.b3os.org/raw/bench/infer/results/20261105T084352Z-w6-voice-q/infer.speech_ttfa.medium-c1.result.json) |
|
|
106
|
+
| Infer | First audio of a streamed speech answer | 25.6 ms (best run 25.5 ms, 5 runs) | kokoro-82m on the GPU, a 352-character text streamed through b3osd, time to the first audio chunk, back to back. UDS, same NUMA | server, server-side | 1000 | 2026-11-05 | [result](https://beta.b3os.org/raw/bench/infer/results/20261105T084352Z-w6-voice-q/infer.speech_ttfa.medium-stream-c1.result.json) |
|
|
107
|
+
| Infer | First sound of a streamed speech answer | 43.1 ms (best run 43.1 ms, 5 runs) | kokoro-82m on the GPU, an 80-character text streamed through b3osd, time to the first audible sample, back to back. UDS, same NUMA | server, same-host | 1000 | 2026-11-05 | [result](https://beta.b3os.org/raw/bench/infer/results/20261105T084352Z-w6-voice-q/infer.speech_first_sound.short-stream-c1.result.json) |
|
|
108
|
+
| Vision | Cached page, returned as markdown | 0.109 ms (best run 0.106 ms, 5 runs); 0.237 ms timed by the client | 100 KB page, one request every 100 ms. UDS, same NUMA | server, same-host | 250 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/vision-cache-hit/vision.cache_hit.gap-100ms.result.json) |
|
|
109
|
+
| Vision | Added to the origin's own response by a fetch-tier scrape, markdown included | 3.06 ms (best run 2.92 ms, 5 runs) | 100 KB HTML page, main content only, back to back. UDS, same NUMA | server, same-host | 2500 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/vision-t1-fetch/vision.t1_fetch.b2b-c1.result.json) |
|
|
110
|
+
| Vision | Live browser session from the warm pool | 1.89 ms (best run 1.8 ms, 5 runs); 2.36 ms timed by the client | Session pool of 2, one request every 100 ms. UDS, cross NUMA | server, same-host | 100 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/vision-session-claim/vision.session_claim.gap-100ms.result.json) |
|
|
111
|
+
| Vision | Warm browser claimed for a scrape, 8 at once | 0.001 ms (best run 0.001 ms, 5 runs) | Bursts of 8 browser-tier scrapes against a pool of 8. UDS, cross NUMA | server, same-host | 400 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/vision-pool-claim/vision.pool_claim.burst-8.result.json) |
|
|
112
|
+
| Vision | Added per action in a live browser session | 0.009 ms (best run 0.0087 ms, 5 runs) | Full Chrome session, click actions on a loaded page, the action's own run time excluded, one act every 100 ms. UDS, same NUMA | server, same-host | 200 | 2026-11-03 | [result](https://beta.b3os.org/raw/bench/vision/results/20261103T085241Z-act-lock/act-click-gap100-chrome.json) |
|
|
113
|
+
| Render | Styled 1600x900 screenshot, no background load | 113 ms (best run 111 ms, 5 runs) | JPEG at DPR 1, browser frame and background style included, back to back. UDS, cross NUMA | server, same-host | 100 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/render-screenshot/render.screenshot.b2b-c1.result.json) |
|
|
114
|
+
| Render | Each extra format of a screenshot | 14.8 ms (best run 14.4 ms, 5 runs) | Three variants (WebP, PNG, JPEG at 800 px) from one capture, back to back. UDS, cross NUMA | server, same-host | 100 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T082836Z-w4q-idle/render-variants/render.screenshot_variants.b2b-c1.result.json) |
|
|
115
|
+
| Routines | Durable workflow step, committed to disk | 195 µs (best run 194 µs, 5 runs) | Standard durability, on local NVMe, back to back. UDS, cross NUMA | server, same-host | 4500 | 2026-11-01 | [result](https://beta.b3os.org/raw/bench/bench/results/20261101T081324Z-w3q-idle/routines-durable-cross/routines.durable_step.b2b-c1.result.json) |
|
|
116
|
+
| Routines | Webhook in, signature checked, first durable step done | 0.349 ms (best run 0.338 ms, 5 runs) | Signed delivery with edge attestation, one every 100 ms. TCP, signed delivery, same NUMA | server, same-host | 600 | 2026-11-03 | [result](https://beta.b3os.org/raw/bench/routines/results/20261103T080118Z-w3/w4-b3osd-gap100.result.json) |
|
|
117
|
+
| Routines | Pure step dispatch | 1 µs (best run 1 µs, 5 runs) | 50-step routine, 1 KB payloads, ephemeral durability, beside a light background mix. UDS, same NUMA | server, same-host | 625000 | 2026-10-27 | [result](https://beta.b3os.org/raw/bench/bench/results/20261027T174857Z-w2d-mixed/routines-pure-mixed/routines.pure_dispatch.b2b-c1+bg.result.json) |
|
|
118
|
+
| Routines | Calling an action from a routine step | 32.4 µs (best run 30 µs, 5 runs) | Typed HTTP action, 1 KB response, 20 calls per run, upstream time subtracted as the run's mean, one run every 100 ms. TCP, node token, same NUMA | server, same-host | 600 | 2026-11-03 | [result](https://beta.b3os.org/raw/bench/routines/results/20261103T080118Z-w3/w6-b3osd-typed-gap100.result.json) |
|
|
119
|
+
| Routines | Pure workflow steps a second | 1,500,000 steps/s (best run 1,500,000 steps/s, 5 runs) | 100-step pure routines, 2 shards with a core each, open loop at 15,000 runs a second, ephemeral durability, B3OS idle. in process, same NUMA | server, same-host | 5 | 2026-11-03 | [result](https://beta.b3os.org/raw/bench/routines/results/20261103T084012Z-w3-placement/pure-2shards-open15k-core.result.json) |
|
|
120
|
+
| Actions | Platform overhead per action call | 54 µs (best run 54 µs, 5 runs) | Declarative HTTP action, 1 KB response, upstream time excluded, one call every 100 ms beside a light background mix of other products' calls. UDS, same NUMA | server, same-host | 250 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T092119Z-w4q-mixed/actions-t0-mixed/actions.call_overhead.gap-100ms+bg.result.json) |
|
|
121
|
+
| Actions | Platform overhead per action call, 16 KB response | 133 µs (best run 130 µs, 5 runs) | Declarative HTTP action, 16 KB response, upstream time excluded, one call every 3 seconds. UDS, same NUMA | server, same-host | 30 | 2026-11-08 | [result](https://beta.b3os.org/raw/bench/bench/results/20261108T083515Z-w3-actions/actions-t0-16k-gap3/actions.call_overhead.gap-3000ms.result.json) |
|
|
122
|
+
| Actions | Input validation, JSON Schema | 4 µs (best run 3 µs, 5 runs) | Validation phase only, of declarative HTTP action calls with a 1 KB response, one call every 100 ms beside a light background mix of other products' calls. UDS, same NUMA | server, same-host | 250 | 2026-11-02 | [result](https://beta.b3os.org/raw/bench/bench/results/20261102T092119Z-w4q-mixed/actions-t0-mixed/actions.call_overhead.gap-100ms+bg.result.json) |
|
|
123
|
+
| Vault | Connection secret out of the vault | 9.9 µs (best run 9.68 µs, 5 runs) | 40-byte secret read in process, as a product reads it during a call, one read every 100 ms. in process, cross NUMA | server, same-host | 300 | 2026-10-27 | [result](https://beta.b3os.org/raw/bench/vault/results/20261027T142627Z-w2-xnuma/gaps/vault.connection_secret.gap-100ms.40B.result.json) |
|
|
124
|
+
| Agent loop | One agent turn: a model call and a tool call | 335 ms (best run 305 ms, 5 runs) | Qwen 3.5 9B served on the node, tools in a B3OS sandbox on the same machine, 30 tasks of 12 turns, 5 runs. VSOCK (IN-SANDBOX PROXY), same NUMA | client, same-host | 1800 | 2026-11-17 | [result](https://beta.b3os.org/raw/bench/loop/results/20261117T083830Z-loop-a-prod-1111-v12/loop-a/loop-a/loop.A.result.json) |
|
|
125
|
+
| Agent loop | One agent task: 12 turns of a model call and a tool call | 4,040 ms (best run 3,720 ms, 5 runs) | Qwen 3.5 9B served on the node, tools in a B3OS sandbox on the same machine, 30 tasks of 12 turns, 5 runs; 450 of 450 real-page scrapes in the fetch tier. VSOCK (IN-SANDBOX PROXY), same NUMA | client, same-host | 150 | 2026-11-17 | [result](https://beta.b3os.org/raw/bench/loop/results/20261117T083830Z-loop-a-prod-1111-v12/loop-a/loop-a/loop.A.result.json) |
|
|
126
|
+
|
|
127
|
+
Each row is the newest published result of one configuration, chosen by `bench/board/headlines.json` and taken from the benchmark board when these pages are generated. The [published results](https://docs.beta.b3os.org/benchmarks#published-results) list every other configuration of the same measurement, each with its target.
|
|
128
|
+
|
|
129
|
+
## See it in your own requests
|
|
130
|
+
|
|
131
|
+
Every response carries `Server-Timing` with the node's phases, plus `edge_auth` and `edge_upstream` when it came through the edge. The request log records the connection each request arrived on:
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
curl -s "https://beta-api.b3os.org/v1/requests?limit=20" \
|
|
135
|
+
-H "Authorization: Bearer $B3OS_API_KEY" | jq '.data[] | {path, connection, duration_ms}'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Compare `connection: sandbox` calls with `connection: edge` calls for the same operation to see the transport difference on your own workload. [Timing](https://docs.beta.b3os.org/concepts/timing) explains each field.
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
# Limits
|
|
2
|
+
|
|
3
|
+
> The beta's default limits per organization, how to read your current usage against them, and what the API returns when you hit one.
|
|
4
|
+
|
|
5
|
+
Source: https://docs.beta.b3os.org/concepts/limits.md
|
|
6
|
+
|
|
7
|
+
Limits keep one organization from crowding out the others on a shared node. Each limit has an ID, and the same ID appears wherever that limit shows up: in `GET /v1/limits`, in the `limit` member of an error and in the `RateLimit-Policy` header.
|
|
8
|
+
|
|
9
|
+
## Beta defaults
|
|
10
|
+
|
|
11
|
+
These apply per organization unless your account says otherwise:
|
|
12
|
+
|
|
13
|
+
| What it limits | Beta default | Limit ID |
|
|
14
|
+
|---|---|---|
|
|
15
|
+
| Sandboxes in use at once | 10 | `sandboxes.concurrent` |
|
|
16
|
+
| vCPUs per sandbox | 2 vCPU | `sandboxes.vcpu_max` |
|
|
17
|
+
| Memory per sandbox | 4 GiB | `sandboxes.memory_max` |
|
|
18
|
+
| Disk per sandbox | 16 GiB | `sandboxes.disk_max` |
|
|
19
|
+
| Sandbox lifetime | 1 h | `sandboxes.timeout_max` |
|
|
20
|
+
| Sandboxes kept up by B3OS | 5 | `sandboxes.leases_max` |
|
|
21
|
+
| Kept-up sandbox renewal | 15 min | `sandboxes.lease_term` |
|
|
22
|
+
| Snapshots kept | 20 | `sandboxes.snapshots_max` |
|
|
23
|
+
| Snapshot storage | 40 GiB | `sandboxes.snapshot_storage_max` |
|
|
24
|
+
| Disk across your sandboxes | 160 GiB | `sandboxes.disk_total_max` |
|
|
25
|
+
| Largest volume | 16 GiB | `sandboxes.volume_max` |
|
|
26
|
+
| Volumes kept | 10 | `sandboxes.volumes_max` |
|
|
27
|
+
| Volume storage | 32 GiB | `sandboxes.volume_storage_max` |
|
|
28
|
+
| Children per swarm | 32 | `sandboxes.swarm_children_max` |
|
|
29
|
+
| Swarms at once | 4 | `sandboxes.swarms_running` |
|
|
30
|
+
| Custom-size image builds per hour | 4 | `sandboxes.offclass_builds` |
|
|
31
|
+
| E2B SDK calls per minute, per address | 600 | `sandboxes.envd.address.rpm` |
|
|
32
|
+
| Refused E2B SDK calls per minute, per address | 30 | `sandboxes.envd.address.refused` |
|
|
33
|
+
| E2B SDK lockout after too many refusals | 10 min | `sandboxes.envd.address.hold` |
|
|
34
|
+
| E2B SDK calls per minute, per sandbox | 1,200 | `sandboxes.envd.sandbox.rpm` |
|
|
35
|
+
| Imported image size | 16 GiB | `images.rootfs_max` |
|
|
36
|
+
| Image imports at once | 1 | `images.imports.concurrent` |
|
|
37
|
+
| Layers per imported image | 128 | `images.layers_max` |
|
|
38
|
+
| Agents | 20 | `agents.agents_max` |
|
|
39
|
+
| Agent instances, asleep ones included | 200 | `agents.instances_max` |
|
|
40
|
+
| Agent instances running at once | 8 | `agents.running_max` |
|
|
41
|
+
| Memory held by paused agent instances | 8 GiB | `agents.ram_max` |
|
|
42
|
+
| Disk held by sleeping agent instances | 64 GiB | `agents.storage_max` |
|
|
43
|
+
| Messages waiting per agent instance | 16 | `agents.queue_max` |
|
|
44
|
+
| Browser sessions at once | 5 | `vision.sessions.concurrent` |
|
|
45
|
+
| Browser session lifetime | 30 min | `vision.session.timeout_max` |
|
|
46
|
+
| Scrapes per minute | 60 | `vision.scrape.rpm` |
|
|
47
|
+
| Scrapes in flight | 5 | `vision.scrape.concurrent` |
|
|
48
|
+
| Pages per crawl | 500 | `vision.crawl.pages_max` |
|
|
49
|
+
| Pages read per PDF | 500 | `vision.pdf.pages_max` |
|
|
50
|
+
| PDF file size | 52,428,800 | `vision.pdf.bytes_max` |
|
|
51
|
+
| Crawls at once | 1 | `vision.crawl.concurrent` |
|
|
52
|
+
| URLs per extract | 10 | `vision.extract.urls_max` |
|
|
53
|
+
| Pages scraped per month | 100,000 | `vision.pages.monthly` |
|
|
54
|
+
| Searches per minute | 60 | `vision.search.rpm` |
|
|
55
|
+
| Searches per month | 1,000 | `vision.search.monthly` |
|
|
56
|
+
| Bytes read from a residential address per month | 1,073,741,824 | `vision.proxy.bytes.monthly` |
|
|
57
|
+
| Screenshots at once | 2 | `render.screenshots.concurrent` |
|
|
58
|
+
| Videos at once | 2 | `render.videos.concurrent` |
|
|
59
|
+
| Inspections at once | 2 | `render.inspections.concurrent` |
|
|
60
|
+
| Background library reads per minute, per render node | 1,200 | `render.library.node.rpm` |
|
|
61
|
+
| Video aliases | 50 | `render.aliases.max` |
|
|
62
|
+
| Storage for videos aliases keep | 2,147,483,648 | `render.kept.bytes` |
|
|
63
|
+
| Share page requests per minute, per address | 600 | `render.share.address.rpm` |
|
|
64
|
+
| Requests per minute to one share | 6,000 | `render.share.rpm` |
|
|
65
|
+
| oEmbed requests per minute, per address | 60 | `render.oembed.address.rpm` |
|
|
66
|
+
| Planning a video from a goal | 1.5 min | `render.goal.plan_s` |
|
|
67
|
+
| Renders at once (deprecated ID) | 2 | `render.concurrent` |
|
|
68
|
+
| Routine steps per day | 50,000 | `routines.steps.daily` |
|
|
69
|
+
| Listeners | 50 | `listeners.active.max` |
|
|
70
|
+
| Listener events kept per day | 100,000 | `listeners.events.daily` |
|
|
71
|
+
| Largest listener event | 262,144 | `listeners.event_bytes_max` |
|
|
72
|
+
| Shortest poll interval | 1,000 | `listeners.poll_interval_min` |
|
|
73
|
+
| Undelivered events per listener | 10,000 | `listeners.backlog_max` |
|
|
74
|
+
| Listener event history | 7 | `listeners.history_days` |
|
|
75
|
+
| Model filter calls per listener | 600 | `listeners.model_filter.rpm` |
|
|
76
|
+
| Model filter tokens per listener per day | 200,000 | `listeners.model_tokens.default` |
|
|
77
|
+
| Action calls per minute | 300 | `actions.rpm` |
|
|
78
|
+
| Hosted tool calls at once | 4 | `actions.tool_concurrent` |
|
|
79
|
+
| Hosted tool calls started per minute | 120 | `actions.tool_starts` |
|
|
80
|
+
| Hosted tool prices per month | 20,000,000 | `actions.publisher_spend.monthly` |
|
|
81
|
+
| Org-private hosted tools | 10 | `actions.tools.private_tools` |
|
|
82
|
+
| Versions per org-private tool | 50 | `actions.tools.versions_per_tool` |
|
|
83
|
+
| Bytes of org-private tool archives | 1,073,741,824 | `actions.tools.archive_bytes` |
|
|
84
|
+
| Bytes of hosted tool files kept, per node | 2,147,483,648 | `actions.files_bytes` |
|
|
85
|
+
| Tokens per minute | 200,000 per model | `infer.tpm.<model>` |
|
|
86
|
+
| Requests per minute | 600 per model, 300 for speech | `infer.rpm.<model>` |
|
|
87
|
+
| Images fetched for you | 128 MiB a minute | `infer.image_bytes` |
|
|
88
|
+
| Model requests in flight | 64 | `infer.concurrent` |
|
|
89
|
+
| Embedding and rerank requests in flight. Planned: not served on the beta node yet. | 8 | `infer.pool.concurrent` |
|
|
90
|
+
| Egress per day | No cap | `egress.bytes.daily` |
|
|
91
|
+
| Public calls per minute, per address | 300 | `platform.public.rpm` |
|
|
92
|
+
| App addresses on b3os.io, stopped ones included | 20 | `apps.hosts.max` |
|
|
93
|
+
| Public app addresses | 5 | `apps.hosts.public_max` |
|
|
94
|
+
| Custom domains (not turned on for customers yet), ones still waiting for their DNS record included | 3 | `apps.domains.max` |
|
|
95
|
+
| Open b3os.yaml changes per application | 20 | `apps.changes.open_max` |
|
|
96
|
+
| Open b3os.yaml changes per organization | 200 | `apps.changes.org_open_max` |
|
|
97
|
+
| Members per organization, pending invites included | 25 | `platform.members.max` |
|
|
98
|
+
| Active API keys per organization | 1,000 | `platform.keys.max` |
|
|
99
|
+
| Runs per hour from the site and console, per user | 30 | `platform.playground.hourly` |
|
|
100
|
+
| Runs per day from the site and console, per user | 150 | `platform.playground.daily` |
|
|
101
|
+
| Runs per day from the site and console, all users together | 5,000 | `platform.playground.global_daily` |
|
|
102
|
+
| Connections per project | 1,000 | `vault.connections` |
|
|
103
|
+
|
|
104
|
+
`GET /v1/limits` also lists `infer.tpm.gateway` and `infer.rpm.gateway`, the allowances of the B3IQ gateway route (`"route": "gateway"`). The beta node has no gateway route configured, so they limit nothing yet.
|
|
105
|
+
|
|
106
|
+
A paused sandbox counts toward `sandboxes.concurrent` as a running one does, until it is deleted or times out. Model limits differ per model; `GET /v1/infer/models` lists each model's tokens per minute and requests per minute for you. Vision also has a monthly page allowance, `vision.pages.monthly`, 100,000 pages per organization to start, which `GET /v1/limits` lists with the pages used this month. Once it is used up, scrapes answer `429 quota_exceeded` until the next UTC month; failed scrapes and walls do not count. `egress.bytes.daily` counts the traffic you steer out of the node (browsers, sandboxes, actions, webhooks) per UTC day and has no cap in the beta. Each product's limits page lists the size limits of single requests, such as the most URLs in one batch. `render.concurrent` is deprecated: render counts screenshots and videos apart, and keeps that ID in `GET /v1/limits` and in its `429` until 2026-11-16 ([render limits](https://docs.beta.b3os.org/render/limits)).
|
|
107
|
+
|
|
108
|
+
`platform.public.rpm` and the `sandboxes.envd.*` limits count per client address (an IPv4 address or an IPv6 /64) or per sandbox, not per organization. The `sandboxes.envd.*` ones apply to E2B envd calls (`/compat/e2b/envd/*`): 600 calls a minute from one address, and 1,200 calls a minute with an accepted envd access token for one sandbox. After 30 calls with a refused token in a minute, every envd call from that address answers `429` [`rate_limited`](https://docs.beta.b3os.org/errors#rate_limited) for 10 minutes, with `Retry-After`.
|
|
109
|
+
|
|
110
|
+
The beta is free: the rate, concurrency and daily limits above, not credits, are what bounds your usage. See [pricing](https://docs.beta.b3os.org/concepts/usage#pricing).
|
|
111
|
+
|
|
112
|
+
## Read your limits
|
|
113
|
+
|
|
114
|
+
Any valid credential can read the limits that apply to it, with current usage:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
curl -s https://beta-api.b3os.org/v1/limits -H "Authorization: Bearer $B3OS_API_KEY"
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"object": "limits",
|
|
123
|
+
"spend": { "cap_usd": 50, "used_usd": 1.42, "period_start": "2026-10-01T00:00:00.000Z", "period_end": "2026-11-01T00:00:00.000Z" },
|
|
124
|
+
"items": [
|
|
125
|
+
{ "id": "sandboxes.concurrent", "product": "sandboxes", "kind": "concurrency", "limit": 10, "unit": "sandboxes", "current": 2 },
|
|
126
|
+
{ "id": "vision.scrape.rpm", "product": "vision", "kind": "rate", "limit": 60, "unit": "requests", "window_s": 60, "current": 14, "reset_s": 38 }
|
|
127
|
+
]
|
|
128
|
+
}
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
This example is abridged. `spend` shows the calling key's spend cap and what it has used this period.
|
|
132
|
+
|
|
133
|
+
## When you hit a limit
|
|
134
|
+
|
|
135
|
+
| Status and code | When | What to do |
|
|
136
|
+
|---|---|---|
|
|
137
|
+
| `429` [`rate_limited`](https://docs.beta.b3os.org/errors#rate_limited) | Too many requests in the current window | Wait `Retry-After` seconds |
|
|
138
|
+
| `429` [`concurrency_limited`](https://docs.beta.b3os.org/errors#concurrency_limited) | Too many operations of one kind running at once | Wait for one to finish, or stop one |
|
|
139
|
+
| `429` [`quota_exceeded`](https://docs.beta.b3os.org/errors#quota_exceeded) | A daily quota is used up, such as `routines.steps.daily` | Wait for the window to reset |
|
|
140
|
+
| `429` [`playground_limited`](https://docs.beta.b3os.org/errors#playground_limited) | Too many runs made with the dashboard session ([below](#runs-from-the-site-and-console)) | Wait `Retry-After` seconds, or use an API key |
|
|
141
|
+
| `422` [`limit_exceeded`](https://docs.beta.b3os.org/errors#limit_exceeded) | One request asks for more than a limit allows, such as `vcpu: 4` | Ask for less |
|
|
142
|
+
| `402` [`spend_cap_exceeded`](https://docs.beta.b3os.org/errors#spend_cap_exceeded) | The key reached its spend cap | Raise the cap or use another key |
|
|
143
|
+
| `402` [`credits_exhausted`](https://docs.beta.b3os.org/errors#credits_exhausted) | The organization has no credits left | Add credits in the dashboard |
|
|
144
|
+
|
|
145
|
+
With every price at zero in the beta, spend stays at 0 and organizations have no credit balance, so `credits_exhausted` does not come up. `spend_cap_exceeded` does, for a key or sandbox grant with a cap of `0`: a cap is reached when the spend is at or above it, so a zero cap refuses every metered call. Leave the cap `null` when you want none.
|
|
146
|
+
|
|
147
|
+
The edge counts rate-limited calls in batches: when one client sends calls in quick succession, the edge reserves a few permits at once (at most 1/20 of the limit, and at most 50) and admits the next calls without a round trip to the counter. The edge is designed to return permits it reserved and did not use after 5 seconds; until then they count as used, in `GET /v1/limits` and in `RateLimit-Remaining` for other clients, so near the limit a call can be refused a few calls early. Limits under 40 per window are counted one call at a time.
|
|
148
|
+
|
|
149
|
+
For `vision.scrape.rpm` and `actions.rpm` limits of 40 or more per window, the edge does not make your first call of a window wait for the counter. It lets the call through and counts it right after. The edge runs in many copies across Cloudflare's locations. Each copy does this at most once per window, so your organization can go over such a limit by at most one call for each copy that serves it in that window. If that count finds the limit already used up, the copy's next calls wait for the counter until the window ends and are refused as usual.
|
|
150
|
+
|
|
151
|
+
Responses of rate-limited operations carry `RateLimit-Limit` (requests allowed in the window), `RateLimit-Remaining`, `RateLimit-Reset` (seconds until the window resets) and `RateLimit-Policy`, such as `60;w=60;name="vision.scrape.rpm"`, on successes as well as refusals, so a client can slow down before it is refused. The one exception is a call let through before it was counted: there is no count to report yet, so it carries none of them. A `429` adds `Retry-After`. The problem body repeats the wait as `retry_after_s` and names the limit in `limit`:
|
|
152
|
+
|
|
153
|
+
```json
|
|
154
|
+
{
|
|
155
|
+
"type": "https://docs.beta.b3os.org/errors#rate_limited",
|
|
156
|
+
"title": "Rate limited",
|
|
157
|
+
"status": 429,
|
|
158
|
+
"code": "rate_limited",
|
|
159
|
+
"detail": "60 scrapes per minute allowed; retry in 12 seconds",
|
|
160
|
+
"instance": "req_01m5t4yg394wegr3j4y01qb363",
|
|
161
|
+
"retry_after_s": 12,
|
|
162
|
+
"limit": { "id": "vision.scrape.rpm", "limit": 60, "unit": "requests", "window_s": 60, "current": 60 }
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
The SDKs retry rate and concurrency refusals after `Retry-After`, and `5xx` answers only for calls that are safe to repeat; see [retries](https://docs.beta.b3os.org/sdks/typescript#retries-and-idempotency). Your own clients should wait at least `Retry-After` seconds before trying again.
|
|
167
|
+
|
|
168
|
+
## Runs from the site and console
|
|
169
|
+
|
|
170
|
+
Calls you make while signed in to the dashboard, from the console's playground and pages and from Try it on the site's product pages, count against a playground limit for your user: 30 runs an hour (`platform.playground.hourly`) and 150 a day (`platform.playground.daily`), across products and organizations. Only calls that bill usage count, such as a scrape, a screenshot, a model call or a new sandbox; reads such as `GET /v1/sandboxes` or a job's status never do. Every signed-in user together also shares a day budget of runs (`platform.playground.global_daily`). Calls with an API key or a CLI token are not counted, and your organization's limits above apply to every call either way.
|
|
171
|
+
|
|
172
|
+
A counted answer carries `RateLimit-Limit`, `RateLimit-Remaining`, `RateLimit-Reset` (seconds until the window ends) and `RateLimit-Policy` for the playground window closest to its limit, such as `30;w=3600;name="platform.playground.hourly"`, in place of the organization's. `GET /v1/limits` with the session shows each window's `current` and `reset_s`. Past the limit the answer is `429` [`playground_limited`](https://docs.beta.b3os.org/errors#playground_limited) with `Retry-After`, and `RateLimit-Reset` says the same number. Nothing ran and nothing was billed:
|
|
173
|
+
|
|
174
|
+
```json
|
|
175
|
+
{
|
|
176
|
+
"type": "https://docs.beta.b3os.org/errors#playground_limited",
|
|
177
|
+
"title": "Playground limit reached",
|
|
178
|
+
"status": 429,
|
|
179
|
+
"code": "playground_limited",
|
|
180
|
+
"detail": "You have used your 30 runs an hour from the site and console. Runs work again in 95 seconds (14:02 UTC). Calls with an API key are not limited this way: create one at https://beta.b3os.org/app/keys.",
|
|
181
|
+
"instance": "req_01m5t4yg394wegr3j4y01qb363",
|
|
182
|
+
"retry_after_s": 95,
|
|
183
|
+
"limit": { "id": "platform.playground.hourly", "limit": 30, "unit": "runs", "window_s": 3600, "current": 30 }
|
|
184
|
+
}
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
The windows slide: an hour after a burst its runs stop counting a little at a time, so `Retry-After` is often a few minutes, not the rest of the hour. To run more, create a key on the [Keys page](https://beta.b3os.org/app/keys) and send it as `Authorization: Bearer <key>`.
|
|
188
|
+
|
|
189
|
+
## Limits on the node
|
|
190
|
+
|
|
191
|
+
The node enforces the limits on sandboxes, inference tokens and egress itself, with counters it refreshes from the edge every few seconds. Calls from inside a sandbox never pass through the edge and are capped all the same. A sandbox limit set for your organization applies on node n2 from its 2026-11-25 release, and on node n1 from its next; until then n1 holds every organization to the sandbox defaults ([sandbox limits](https://docs.beta.b3os.org/sandboxes/limits)).
|