# `@passband/sdk` examples

Runnable, end-to-end scripts for driving Passband with the SDK. Each is a
standalone ESM TypeScript file you run with [`tsx`](https://github.com/privatenumber/tsx).

## Setup

You need a Passband API token. Mint one in **Settings → API Tokens** (it starts
with `sf_` and is shown only once).

```sh
export PASSBAND_TOKEN=sf_...
# Optional — defaults to https://passband.ai:
export PASSBAND_BASE_URL=https://passband.ai
```

From a project that depends on `@passband/sdk`:

```sh
npx tsx examples/run-pipeline.ts
```

Inside this monorepo (the SDK is a workspace package), run them from
`packages/sdk`:

```sh
pnpm --filter @passband/sdk exec tsx examples/run-pipeline.ts
```

## Scripts

| File              | What it does                                                                       |
| ----------------- | ---------------------------------------------------------------------------------- |
| `run-pipeline.ts` | Queue a pipeline run and poll until it completes.                                  |
| `review-feed.ts`  | Fetch the ranked feed and approve high-confidence drafts (`DRY_RUN=1` to preview). |
| `add-sources.ts`  | Add a source, test it, and list all sources (`CLEANUP=1` to delete after).         |
| `agent-flow.ts`   | The full canonical loop: ensure sources → run → ranked feed → approve top drafts.  |

All scripts honor `DRY_RUN=1` where mutating, so you can safely see what they
would do first.

## Notes

- These call a **live** Passband instance and may queue real pipeline runs and
  change draft state. Use `DRY_RUN=1` (where supported) or a non-production
  instance / token while experimenting.
- Every script uses only documented SDK methods — see `../SKILL.md` and
  `../README.md` for the full surface.
