Documentation
Compute plans and streams
View .mdOpenAPI

Read a stream's backlog

GEThttps://weights.fyi/run/v1/streams/{stage_id}/packsscope: read
text
GET https://weights.fyi/run/v1/streams/{stage_id}/packs?lookahead_window=32
Authorization: Bearer <token>                    scope: read
Available since
2026-10-28: included in this build; see What is live for deployment status.
Answer time
synchronous database read; no source download or materialization.

Reads a stream's backlog and the next lazy registrations to prepare. This is a lookahead snapshot, not a paginated listing of every pack. Use the plan's stream_id as {stage_id}, or supply the authored stage identifier with ?plan_id=....

The deficit is the number of pending packs needed to fill the requested window, bounded by the stream's admission limit after live leases are counted. Expired leases do not consume that limit. The returned next_lazy_packs are ordered by ordinal and contain at most deficit entries; several readers can receive the same entries because this call reserves nothing.

Request

No body.

NameWhereRequiredMeaning
AuthorizationheaderyesBearer token with read.
stage_idpathyesQualified stream identifier or authored stage identifier.
plan_idquerynoDisambiguates an authored stage identifier. Must agree with a qualified identifier.
lookahead_windowquerynoInteger from 0 through 9223372036854775807; default 32. Zero returns no lazy candidates.

Return value

200 OK. Selected fields:

FieldMeaning
plan_id, stage_id, stream_idPlan identifier, authored stage identifier and qualified plan_id~stage_id.
plan_state, stage_state, pickup_statusCurrent progress; pickup can be completed, draining, ready_for_pickup, queued_waiting_flush or waiting_primary_or_price.
stream_sealedWhether new pack identifiers are refused; existing lazy registrations can still be promoted.
packs_total, packs_completedAll registered packs and successfully completed packs.
countsCounts by stored state, including lazy, pending, completed, expired_incomplete and, when present, dead_lettered; execution counts also have the dedicated fields below.
leased_live, leased_expiredLeases whose expiry is respectively after, or at/before, the current time.
active_packsPending plus live leased packs.
lookahead_windowThe requested window.
max_pending_packs, backpressuredConfigured limit, or null; true when active packs reach it. A per-registration override is not persisted here.
deficitWithout a limit: max(0, lookahead_window - pending). With a limit: max(0, min(lookahead_window, max_pending_packs - leased_live) - pending). Zero under backpressure.
next_lazy_packsNormalized registrations in ordinal order. May be shorter than deficit; no state field is added to each registration.
policy_signalAdvisory; pause_materialization means no deficit or backpressure, and materialize_next_lazy suggests preparing candidates now.
last_poll_at_msLatest execution poll in Unix milliseconds, or null; a service-wide observation.

Errors

StatusCodeAction
400invalid_compute_planUse a nonnegative integer window and a stage that accepts packs.
401unauthorized, invalid_token, token_revoked, token_expiredSupply a valid token.
403scope_required, account_suspendedRestore read scope or account access.
404compute_stage_not_foundCheck ownership and identifiers.
409ambiguous_compute_stageSupply plan_id or use stream_id.

Examples

sh
curl -s 'https://weights.fyi/run/v1/streams/STAGE_ID/packs?plan_id=PLAN_ID&lookahead_window=2' \
  -H "Authorization: Bearer $WEIGHTS_API_KEY"

Selected response fields for one pending pack and one lazy pointer:

json
{
  "plan_id": "PLAN_ID", "stage_id": "STAGE_ID", "stream_id": "PLAN_ID~STAGE_ID",
  "stream_sealed": false, "packs_total": 2, "packs_completed": 0,
  "lookahead_window": 2, "max_pending_packs": 4, "backpressured": false,
  "counts": {"lazy": 1, "pending": 1, "completed": 0, "expired_incomplete": 0},
  "leased_live": 0, "leased_expired": 0, "active_packs": 1, "deficit": 1,
  "next_lazy_packs": [{
    "plan_id": "PLAN_ID", "stage_id": "STAGE_ID", "pack_id": "p1", "ordinal": 1,
    "item_count": 100, "source_uri": "gs://corpus/part-1.jsonl", "source_shards": null,
    "r2_input_uri": null, "sha256": null, "prefix_hash": null,
    "compressed_bytes": null, "est_input_tokens": null, "est_output_tokens": null
  }]
}

Patterns

Prepare the suggested lazy packs, then repost each with its identifier, ordinal, digest, size and state: "pending". Registration may still return 429 stream_backpressure if other work filled the window after this read. Poll again after active work drains.

History

  • 2026-10-28: documented lookahead, lazy candidates, admission counts and sealed streams.

See also