Skip to main content

Python SDK for consuming the Kit's Deals river — real-time, structured, agent-friendly deal events

Project description

kitsdeals-river

Python SDK for consuming the Kit's Deals river — a real-time, structured stream of approved deals built for agent consumers.

The interaction model is agent-mediated. You're not expected to edit YAML by hand. You tell your Claude/Code agent something like "set up github.com/kitsdeals/kitsdeals-river for me — I'm looking for TVs and a laptop refresh", and the agent runs the onboarding skill (PR 37) to translate the conversation into a ~/.kitsdeals/profile.yaml plus a running watcher daemon. The CLI commands and library API exist so the agent has reliable surfaces to call; humans rarely use them directly.

Architecture

┌──────────────────────────────────────────────────────────────────┐
│  RiverWatcher                                                    │
│    SSE consumer (Kit's Deals river v2)                           │
│    ↓                                                             │
│    Reconnect with exponential backoff                            │
│    Cursor persistence (~/.kitsdeals/cursor.json)                 │
│    Two-step catch-up: REST for gaps, SSE for forward             │
│    ↓                                                             │
│  Handler  (your code or the spawn_claude_evaluator from PR 37)   │
│    ↓                                                             │
│  Profile           DecisionsLog        Notifier                  │
│  ~/.kitsdeals/     ~/.kitsdeals/       telegram / stdout / …     │
│   profile.yaml      decisions.jsonl                              │
└──────────────────────────────────────────────────────────────────┘

Status

Component Status
RiverWatcher — SSE + reconnect + cursor + filter + SIGHUP reload
Profile — Pydantic schema, YAML load/save, dedup helpers
DecisionsLog — JSONL append-only with size-based rotation
Notifier — protocol + 6 built-ins (stdout, telegram, slack, discord, http_post, subprocess)
spawn_evaluator — agent-agnostic wake-up with structured prompt
skills/onboarding.md — agent-facing setup interview
skills/update-profile.md — agent-facing ongoing refinement
CLI (setup, run, reload, status, profile show/update/validate)
Server-side GET /v1/quickstart agent funnel
examples/kit_dual_emit.py — reference dual-emit pattern (observability + agent action)

Install

pip install kitsdeals-river

(Pre-publish: pip install -e . from this directory.)

Agent-driven setup (the expected install flow)

Paste this repo URL to your Claude Code agent and say:

Set up Kit's Deals for me — I'm looking for X and Y.

The agent loads skills/onboarding.md, runs a short interview (4–6 questions max), translates your answers to a profile, and starts the watcher. You don't see the YAML.

For ongoing changes — "stop showing me TVs", "I bought one of those", "only show me clear wins" — your agent loads skills/update-profile.md and translates the natural-language request into a structured CLI edit. Live reload via SIGHUP, no restart required.

CLI

The CLI is the agent-facing API to the profile and the watcher daemon. Humans rarely run these directly; the skills tell the agent how to use them.

kitsdeals-river setup --json '<full profile JSON>'      # write profile + start
kitsdeals-river run                                     # foreground watcher
kitsdeals-river status                                  # daemon health snapshot
kitsdeals-river reload                                  # SIGHUP a running watcher
kitsdeals-river profile show [--json]                   # inspect current profile
kitsdeals-river profile update --remove-watch "TVs"     # programmatic edits
kitsdeals-river profile validate                        # well-formedness check

See skills/onboarding.md and skills/update-profile.md for the agent- facing recipes.

Minimal example (without an agent in the loop)

from kitsdeals_river import RiverWatcher, RiverEvent, StdoutNotifier
from kitsdeals_river.profile import WatchFilter
import asyncio

async def main():
    notifier = StdoutNotifier()
    watcher = RiverWatcher(
        filter=WatchFilter(
            category="tv",
            brand_in=["LG", "Sony"],
            min_discount_pct=25,
        ),
    )

    @watcher.on_event
    async def handle(event: RiverEvent):
        if event.is_deal:
            deal = event.data
            await notifier.send(
                f"{deal['brand']} — ${deal['current_price_cents']/100:.2f}",
                deal,
            )

    await watcher.run_async()

asyncio.run(main())

See examples/minimal.py for a runnable version.

Testing

pip install -e ".[dev]"
pytest

License

MIT — see LICENSE. Use freely, build on top, fork it for your own personal-event runtime.

Roadmap

This package is one channel of a broader pattern: decoupled summarization — a centralized service does expensive synthesis work once, emits a structured event stream, and agents do cheap per-event filtering against a user profile. Same architecture applies to news, jobs, regulatory filings, GitHub releases, real-estate listings. Kit's Deals is the first concrete implementation; the SDK's profile + watcher + decisions-log shapes are designed to translate.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kitsdeals_river-0.3.0.tar.gz (41.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kitsdeals_river-0.3.0-py3-none-any.whl (36.1 kB view details)

Uploaded Python 3

File details

Details for the file kitsdeals_river-0.3.0.tar.gz.

File metadata

  • Download URL: kitsdeals_river-0.3.0.tar.gz
  • Upload date:
  • Size: 41.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.15

File hashes

Hashes for kitsdeals_river-0.3.0.tar.gz
Algorithm Hash digest
SHA256 c733f986ed870aec301724b1a71921bb20f708987ab1ac57393d0ed8fdc57ce8
MD5 ecf57eeb74878ae52a60a4b96815d312
BLAKE2b-256 142de8471676b4c2d10e62baeec70e5ed087df6e7d2a9328ab00d70c2e7cd043

See more details on using hashes here.

File details

Details for the file kitsdeals_river-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for kitsdeals_river-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 751089f63ebcbabd72b6d0dd344118c9030a9941412b6d821fb5f74e3ca200d6
MD5 8b658325a6a14a58086eb9d0d9c09a56
BLAKE2b-256 9168ba47553c2d8fbf72377c4c6486869dd90eda1c70e7a2932f747840ebce12

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page