Kaizen

Bucket Stats

Track per-user stats (e.g. completions, skips) in a bucket and use them in workflows

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 bucket
  • kaizen_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

FieldTypeRequiredDescription
keystringNoIf provided, the value output will contain this key's value. If omitted, returns all stats.

Outputs

OutputTypeDescription
successbooleanWhether the operation succeeded
statsobjectAll stats for the current user
statTypesobjectType of each stat
schemaarraySchema entries with metadata
valueanyWhen key was provided, the value for that key

Update Bucket Stat

Sets, increments, or decrements a stat for the current user.

Inputs

FieldTypeRequiredDescription
keystringYesStat key (e.g. completions, skips). Must exist in the bucket stats schema.
operationstringYesset, increment, or decrement (increment/decrement only for number type)
valueanyFor set: yesValue to set, or amount for increment/decrement
reasonstringNoOptional reason (recorded in history)

Outputs

OutputTypeDescription
successbooleanWhether the operation succeeded
keystringThe stat key
valueanyThe new value
previousValueanyThe previous value
typestringThe 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.

On this page

On this page

Start building today
Trusted by over 60,000 builders.
Build Agentic workflows visually on a drag-and-drop canvas or with natural language.
Get started