Skip to content

Safer gambling ​

Watching a player's deposits for signs of harm: deposit and sign-up events, the net loss and verified age your platform keeps on the player, and a safer-gambling case when a rule warns. Pack: examples/policies/safer-gambling/.

A pattern for expressing a gaming & betting policy, not compliance guidance: the thresholds, lists and fields are placeholders chosen to make the example run; a real policy comes from the business's own rules. It calls no app, so it runs in an empty workspace as it is.

The decision it automates ​

Whether to take no action (approve), open a safer-gambling case, or block (reject), when your platform starts the run after a deposit.

Data expected ​

  • The player as a subject (kind user) with age, netLoss30d and deviceId, written by your platform.
  • deposit.made events with an amount, and account.created events with the promoted deviceId key, posted through POST /events.

Steps and rules ​

StepTypeWhy
rulesevaluate_rulesThe safer-gambling rule set under max_severity; nothing is collected.
routebranchrules.outcome == manual_review opens a case.
reviewcreate_casesafer_gambling, 4-hour SLA.
decideemit_decisionFrom the rules, or the reviewer's decision.

The rule set safer-gambling (useCase: monitoring) uses max_severity: a failed block rule rejects, a failed warn rule sends the run to review, and the weights add up to the score.

RuleTypeSeverity, weightFails when
play_age_verifiedcomparisonblock, 100age is under 18
play_deposit_velocityvelocitywarn, 30deposits sum to more than 1 000 in 24 hours
play_loss_thresholdscore thresholdwarn, 30netLoss30d is above 3 000
play_linked_accountsvelocitywarn, 20more than two account.created events on the device in 30 days

What a reviewer sees ​

A safer_gambling case with the rule results and the player's deposits on the timeline. What follows (a call, a deposit limit) is recorded as the decision's reasons; case.decided tells your platform.

How to adapt it ​

Set the ages and thresholds your market requires, add a call_app step to your messaging service that sends the player a safer-gambling message, and backtest new thresholds over past deposits before publishing.

Run it ​

bash
pnpm policy:import examples/policies/safer-gambling --publish

The fixture deposits 600 and 850 within two hours for a player with a net loss of 900: the deposit velocity rule fails, a safer_gambling case opens, the check closes it with no action (approve) and the run completes with a manual approve.

Released under the Apache-2.0 License.