valve_

Examples

Recipes for common integrations, plus runnable examples in the repository.

Recipes

Each recipe is a complete pattern you can adapt. Rules and URLs are illustrative; set limits from your provider's documented quota.

Runnable examples

The repository includes small, self-checking programs under examples/. Each asserts its own result and needs no provider credentials.

ExampleShowsNeeds Redis
memorySpacing calls in one process with the default memory store.No
prioritiesInteractive work starting before background work.No
observeFeeding an axios-shaped response into shared feedback.No
shutdownRejecting queued work and finishing running work on close.No
sharedSix valve instances sharing one Redis budget.Yes
feedbackA 429 in one valve pausing another valve on the same budget.Yes

Build the workspace once, then run any example by name:

pnpm install
pnpm build
pnpm --filter @valve/example-memory start

For the Redis examples, start a server and set REDIS_URL:

docker compose -f compose.test.yml up -d
REDIS_URL=redis://127.0.0.1:6379 pnpm --filter @valve/example-feedback start

pnpm examples runs all six in sequence.

On this page