Skip to content

feat: adopt parallel-web 0.6.0 monitor + non-beta task group#100

Merged
NormallyGaussian merged 1 commit intomainfrom
feat/sdk-0.6.0-monitor-and-taskgroup
May 8, 2026
Merged

feat: adopt parallel-web 0.6.0 monitor + non-beta task group#100
NormallyGaussian merged 1 commit intomainfrom
feat/sdk-0.6.0-monitor-and-taskgroup

Conversation

@NormallyGaussian
Copy link
Copy Markdown
Contributor

Summary

  • Bumps the SDK floor from >=0.4.2 (which lagged behind reality — uv.lock was already on 0.5.1) to >=0.6.0 to take advantage of two new SDK changes: the Monitor API graduating from a hand-rolled /v1alpha shim to a first-class client.monitor resource, and Task Groups graduating out of beta into client.task_group.
  • Migrates core/monitor.py from direct httpx calls to thin wrappers over client.monitor.* while keeping the public function names so callers don't break. The SDK shape changes ripple out: cadencefrequency, deletecancel, simulate_eventtrigger, lookback_period → cursor pagination, new type/task_run_id/processor/include_backfill for event_stream vs. snapshot monitors. CLI subcommands updated to match.
  • Replaces client.beta.task_group.* with client.task_group.* in core/batch.py, integrations/spark/streaming.py, and the enrichment test mocks. Switches the typed input from BetaRunInputParam to the canonical RunInputParam.

Breaking changes for parallel-cli monitor users

  • monitor delete <id>monitor cancel <id> (cancellation is irreversible — no actual deletion in the new API)
  • monitor simulate <id>monitor trigger <id> (now a real one-off execution, not just a webhook ping)
  • monitor event-group <id> <group> removed → use monitor events <id> --event-group-id <group>
  • --cadence daily--frequency 1d (aliases like daily/hourly still accepted)
  • monitor update --query removed: query and task_run_id are immutable in the new SDK; create a new monitor to change them
  • monitor events --lookback 10d--cursor / --limit / --include-completions (the API moved to cursor-based pagination)

Test plan

  • uv run pytest tests/ — 651 passed
  • uv run ty check parallel_web_tools — all checks passed
  • uv run ruff check parallel_web_tools tests — all checks passed
  • Live CLI smoke tests against the API (no mocks):
    • monitor list --limit 5 --json — returns paginated monitors with next_cursor
    • monitor list --limit 3 — table renders with type/query/frequency/status columns
    • monitor create "test query" --frequency 1d --metadata '{"test":"sdk-0.6.0"}' --json — created monitor_a01adb52eb1a44c79d5c6ee554ae73d4
    • monitor get <id> — pretty-prints type, frequency, query, processor, last_run
    • monitor update <id> --frequency 6h — verified frequency field updated to 6h
    • monitor trigger <id> — succeeded, completion events appeared in events feed
    • monitor events <id> --include-completions --limit 5 — both JSON and table renders work
    • monitor cancel <id> — verified status flips to cancelled
    • monitor create --type snapshot (no --task-run-id) — fails with helpful error
    • monitor create (no query) — fails with helpful error
    • End-to-end enrich run --no-waitenrich statusenrich poll cycle on a 2-row CSV — exercises client.task_group.create / add_runs / retrieve / get_runs and produced correct CEO results for Anthropic/Stripe.

Upgrades the SDK floor from 0.4.2 (lagged) to 0.6.0 to take advantage of
two changes that ship in that release:

- Task Groups graduated out of beta. Replaces client.beta.task_group.*
  calls with client.task_group.* in core/batch.py, integrations/spark/
  streaming.py, and the test fixtures, and switches the typed input from
  BetaRunInputParam to RunInputParam.

- Monitor moved from a hand-rolled httpx client against /v1alpha to the
  SDK's client.monitor resource against /v1. The wrappers in
  core/monitor.py now thin-wrap the SDK and return dict payloads via
  model_dump(mode="json") so the CLI and existing callers continue to
  work. Surface changes mirror the SDK:

  - cadence (hourly/daily/...) -> frequency ("1h", "1d", "2w"; aliases
    preserved via MONITOR_FREQUENCY_PRESETS)
  - delete_monitor -> cancel_monitor (cancellation is irreversible)
  - simulate_monitor_event -> trigger_monitor (real one-off run)
  - get_monitor_event_group folded into list_monitor_events with
    event_group_id filter
  - new fields: type (event_stream/snapshot), task_run_id (snapshot),
    processor (lite/base), include_backfill
  - events listing is cursor-paginated with include_completions / limit

CLI subcommands updated accordingly: monitor cancel/trigger replace
delete/simulate; monitor event-group is removed; --frequency replaces
--cadence; new --type, --task-run-id, --processor, --include-backfill,
--cursor, --status, --event-group-id flags.

Note that query / task_run_id are immutable in the new update endpoint,
so monitor update --query is no longer offered (create a new monitor
to change the tracked target).

README and npm/README snippets refreshed; tests/test_monitor.py
rewritten against the SDK-mocked client; tests/test_enrichment.py mocks
moved off client.beta.task_group.
@NormallyGaussian NormallyGaussian merged commit 25be999 into main May 8, 2026
7 checks passed
@NormallyGaussian NormallyGaussian deleted the feat/sdk-0.6.0-monitor-and-taskgroup branch May 8, 2026 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant