Bucket Stats let you track values per user in a bucket (e.g. completions, skips). Stats are defined in the bucket Bucket stats schema (in bucket overview) and read/updated by blocks. The user is always the run's user. Prefer bucket stats over workspace stats when your workflows run in a bucket context.
Block Types
kaizen_get_bucket_stats- Retrieve the current user's stats for the bucketkaizen_update_bucket_stat- Set, increment, or decrement a stat for the current user
Defining Stat Keys
In the bucket Overview page, open the Bucket stats schema section (admin only). Add rows for each stat key (e.g. completions, skips) with type (number, boolean, text, select), optional label and default. Save to apply. Use these keys in Update Bucket Stat and Get Bucket Stats blocks.
Get Bucket Stats
Retrieves the current user's stats for the bucket. bucketId comes from execution context.
Inputs
| Field | Type | Required | Description |
|---|---|---|---|
key | string | No | If provided, the value output will contain this key's value. If omitted, returns all stats. |
Outputs
| Output | Type | Description |
|---|---|---|
success | boolean | Whether the operation succeeded |
stats | object | All stats for the current user |
statTypes | object | Type of each stat |
schema | array | Schema entries with metadata |
value | any | When key was provided, the value for that key |
Update Bucket Stat
Sets, increments, or decrements a stat for the current user.
Inputs
| Field | Type | Required | Description |
|---|---|---|---|
key | string | Yes | Stat key (e.g. completions, skips). Must exist in the bucket stats schema. |
operation | string | Yes | set, increment, or decrement (increment/decrement only for number type) |
value | any | For set: yes | Value to set, or amount for increment/decrement |
reason | string | No | Optional reason (recorded in history) |
Outputs
| Output | Type | Description |
|---|---|---|
success | boolean | Whether the operation succeeded |
key | string | The stat key |
value | any | The new value |
previousValue | any | The previous value |
type | string | The stat type (number, boolean, text, select) |
Stats are stored per (bucket, user, statKey). Bucket ID is taken from the workflow run context. Use bucket stats when your workflow runs in a bucket; use workspace stats for workspace-scoped workflows.