Live streams
Updated 2026-11-14.
Status: on (beta). Live sources in work on every plan within its caps. Live streams out are part of Builder and Pro; Stripe Checkout is not open yet during the invite beta, so until it opens, streams out are enabled per workspace on request. If an operator turns the ASIPIPES_STREAMING flag off, the /v1/streams endpoints answer 404 not_found and the stream MCP tools are not listed.
Streaming has two halves:
- Live sources in: a pipe can read from a Server-Sent Events feed, a WebSocket, or a fast poll instead of running on a schedule. Items arrive continuously and run through the same pipe steps as any other run:
diff_since_last,filter, the optionaldecidestep,emit_webhook. - Live streams out (paid): your agent can hold one connection open and receive new items as they are produced, over SSE at
GET /v1/streams/{pipe}or over MCP. Webhooks (add_notification) and pollingpipe__<name>stay free and keep working.
Live sources in
Add a stream section to the pipe file and make the first step stream_items:
pipes: 0
name: release-stream
version: 0.1.0
permissions:
network:
- https://events.example.com
stream:
source: sse # sse | websocket | poll
url: https://events.example.com/feed
events: [release] # SSE only: event names to keep (default: all)
batch_max_items: 25 # run the pipe when this many items are waiting...
batch_max_ms: 2000 # ...or when the oldest has waited this long
buffer_max: 200 # items held while a batch runs
overflow: drop_oldest # drop_oldest | drop_newest | sample
steps:
- id: items
block: stream_items
- id: new
block: diff_since_last
in: ${steps.items}
with:
key: [id]
- id: hook
block: emit_webhook
in: ${steps.new}
with:
url: https://hooks.example.com/new
skip_if_empty: true
output: ${steps.new}
Then start it with POST /v1/streams ({"pipe": "release-stream"}) or the MCP tool start_stream. GET /v1/streams and list_streams show each stream's status, counters (items in and out, batches, dropped, reconnects), and your caps. DELETE /v1/streams/{pipe} or stop_stream stops it. Deleting the pipe stops its stream.
Sources:
sse: anhttp(s)URL that servestext/event-stream. Each event'sdatais parsed as JSON (an array becomes one item per element); anything else becomes{"data": "..."}. On reconnect Asipipes sends the lastLast-Event-IDit saw and honors the server'sretry.websocket: aws(s)URL. Text frames are items.subscribe_message(text up to 4 KB, or a mapping sent as JSON) is sent once after connecting.poll: anhttp(s)URL fetched everypoll_interval_sseconds (5 to 3600, default 10) withIf-None-Match, so an unchanged resource costs one 304. JSON and RSS/Atom bodies are split into items. Entries identical to ones already taken from an earlier poll are skipped before any cap is applied (a feed that re-serves its last 20 entries only spends items on the new ones), and each poll counts as one fetch toward your workspace'sfetches_per_day(listed inGET /v1/usage→fetches_by_pipewith modestream_poll). With no fetches left, polling pauses until the daily reset (UTC).
Other options: event_time_path (a dotted path to the item's own event time, used for metrics; by default meta.dt, timestamp, published, dt, time, created_at, or updated is used when present), headers (up to 20; use ${env.NAME} for secrets listed under permissions.env), item_path (a dotted path to the record inside each message), max_item_bytes (default 16384, up to 262144), and idle_timeout_s (reconnect when the source goes quiet; default 300).
What a batch is
Items are micro-batched by count and time, and each batch is one ordinary pipe run with mode stream:
- Seen state is per workspace and pipe, so a repeat item is not reported twice. In a stream, keys from earlier batches stay seen; the most recent 2000 keys are kept by default.
decidesees the whole batch: one provider call per new question, identical questions in a batch share one call, cached answers are reused, and every answer is recorded. Bring your own key as with anydecidestep.- Every batch that published, dropped, fetched, or failed is stored with a receipt; the most recent 50 stored batches per pipe are kept. A stored batch records the seen state only for its own items' keys (plus the total seen count), so its size follows the batch, not the seen set.
POST /v1/runs/{id}/replayre-runs it from its recordings and never reconnects to the source or calls the provider. - Webhooks fire as usual. Stream batches do not count toward daily runs (
runs_used); webhook deliveries anddecideprovider calls count as they do for any run.
Limits and overload
- Each upstream connection is checked like
fetch_http: the host must be inpermissions.network, private and internal addresses are refused, and the connection goes to the IP that was checked (DNS pinning). - A dropped connection reconnects with backoff (1 s doubling to 60 s, with jitter). After 20 failures in a row the stream stops with status
errorandlast_errorexplains why. - Buffers are bounded. When items arrive faster than the pipe can run, the
overflowpolicy drops the oldest, drops the newest, or keeps a sample, and the batch records how many were dropped and why (overflow,rate,oversize,memory). Drops are in the recorded batch, so they are covered by the receipt. - Caps come from your plan (see
GET /v1/streams→caps): concurrent streams per workspace, andstream_items_per_minper stream, so one busy stream can't starve your others. A workspace total (stream_workspace_items_per_min, by default the per-stream cap times the stream cap) also applies. Items over either cap are dropped and counted asrate; the metrics split out the workspace total asworkspace_rate. Poll entries already taken from an earlier poll are skipped before either cap. - When the server's memory is above its shedding threshold, new items are dropped and counted as
memoryuntil it recovers. - One server holds at most 100 upstream connections and 100 subscribers across all workspaces. Past that,
POST /v1/streamsandGET /v1/streams/{pipe}answer 503capacity.
Current caps (beta; GET /v1/billing → streaming.plans always has the live values):
| Plan | Concurrent streams | Items per minute, per stream | Workspace total per minute | Subscribers (streams out) |
|---|---|---|---|---|
| Free | 1 | 60 | 60 | 0 |
| Builder | 3 | 300 | 900 | 3 |
| Pro | 10 | 1,200 | 12,000 | 10 |
An operator can grant a workspace different stream caps; caps then reports the granted values.
Live streams out (paid)
GET /v1/streams/{pipe} with Authorization: Bearer pk_live_… and Accept: text/event-stream opens an SSE stream of the pipe's new output items:
retry: 3000
event: ready
data: {"access":"plan:builder","docs":"https://asipipes.com/docs/streaming","heartbeat_ms":15000,"max_seconds":3600,"pipe":"release-stream","resumed_from":null}
id: 1763139600123456
event: item
data: {"at":"2026-11-14T17:00:00Z","dropped":0,"id":"1763139600123456","item":{"_change":"added","id":42,"title":"v2.1.0"},"mode":"stream","pipe":"release-stream","receipt":"b3:…","run_id":"run_…"}
: ping
accessinreadysays why you may subscribe:plan:builder,plan:pro,override(an operator grant), orx402(a paid session).- Every item from a live or stream run of that pipe is published once. Items marked
unchangedare not.droppedis how many items that batch dropped. - A
: pingcomment is sent every 15 seconds when nothing else is. - Reconnect with
Last-Event-ID(or?last_event_id=) to resume from a buffer of the last 256 events per pipe. If the id is older than the buffer, anevent: gapis sent first so your agent knows to read the missed runs fromGET /v1/runs?pipe={pipe}. - The server ends a session with
event: endafter an hour or on deploy; reconnect with the last id. GET /v1/streams/{pipe}/events?last_event_id=…returns the same buffer as JSON (items,count,gap,access,hint), for clients that cannot hold a connection. It needs the same paid plan.
Who can subscribe: workspaces on Builder or Pro. Each plan has a cap on concurrent subscribers per workspace. A Free workspace gets HTTP 402 with JSON {"error":"payment_required","status":402,"message":"Live streams out are a paid feature. Upgrade to Builder or Pro …","docs":"https://asipipes.com/docs/streaming","billing":"https://asipipes.com/v1/billing"}, on both GET /v1/streams/{pipe} and /events. Over the subscriber cap the answer is 429 quota_exceeded with Retry-After. When x402 is on (Base Sepolia testnet only), the 402 also carries a PAYMENT-REQUIRED header, and a retry with PAYMENT-SIGNATURE buys one stream session; see /docs/x402.
Over MCP
/mcp stays JSON for every client. A paid caller that sends Accept: application/json, text/event-stream gets an SSE response for two calls:
watch_stream(pipe, optionallast_event_id,max_items,max_seconds): each item arrives as anotifications/message, then the final JSON-RPC result lists what was sent and why it ended.pipe__<name>: progress notifications while the run executes, then the normal result.
Without that Accept header, or for an unpaid workspace, the same calls return JSON exactly as before. watch_stream over JSON returns the buffered items since last_event_id.
Stream tools: start_stream, list_streams, stop_stream, watch_stream, stream_metrics.
Keys and errors
Every /v1/streams call and /mcp needs Authorization: Bearer pk_live_…. A missing or unknown key is 401 unauthorized. If the server briefly can't read the key store, the answer is 503 {"error":"unavailable","message":"…your key was not rejected."} with Retry-After: 2; retry, the key is fine. While streaming is off on the server, /v1/streams* answers 404 not_found. A key may make 60 API requests a minute (429 past that).
Metrics
GET /v1/streams/{pipe}/metrics?hours=24 (1 to 168, default 24) and the MCP tool stream_metrics return hours, one object per hour for your stream (the current hour live, earlier hours from storage; kept for 7 days by default):
- next to
hours:window_hours,memory_mb_now,subscribers_now, andstream(the live status) - per hour:
hour,items_in,items_out,batches,failed_batches,reconnects,polls,repeats_skipped(poll entries already taken, not counted against caps),subscribers_max,memory_mb_max dropped:overflow,sampled(thesamplepolicy),rate(this stream's cap),workspace_rate(the workspace total),oversize,memorydecide:calls(provider requests),cache_hits(including repeats inside one batch),cache_hit_ratedelivered: items written to SSE subscribers and webhook deliveries that got a 2xxbatch_size,batch_run_ms, andlatency_mswithn,p50,p95,p99,maxin milliseconds forsource_to_received(needs an event time on the item),received_to_batch_start,received_to_processed,received_to_decide_done(pipes withdecide),received_to_sse, andreceived_to_webhook
Percentiles are nearest-rank over a uniform sample of at most 512 values per hour. SSE and webhook latencies start at the earliest item of the batch, so they are an upper bound for the rest of that batch. A resumed backlog is not counted as SSE latency.
Numbers
Measured on the Asipipes test suite (Erlang/OTP 27): an idle SSE source costs about 6 KB for its process plus a 16 KB socket buffer. These are engineering measurements, not a service guarantee, and plan caps are listed in GET /v1/streams and GET /v1/billing. The 92% fewer tokens, 99.4% fewer when nothing is new, and exact replayable output figures are the measured checks on /benchmarks. This page does not invent other stats.