Kaizen

Workspace Variables

Store and retrieve values across workflows in the same workspace

Workspace Variables enable cross-workflow data sharing. Store a value in one workflow and retrieve it from another workflow in the same workspace.

Block Types

  • kaizen_set_workspace_var - Store a value
  • kaizen_get_workspace_var - Retrieve a value

Set Workspace Variable

Stores a key-value pair in workspace-scoped storage. Creates a new variable or updates an existing one.

Input Fields

FieldTypeRequiredDescription
keystringYesVariable name (alphanumeric, underscores, must start with letter or underscore)
valueanyYesValue to store, supports block references like <block.output>
valueTypedropdownNoType: string, number, boolean, json, array (default: string)
descriptionstringNoOptional description for the variable

Outputs

OutputTypeDescription
successbooleanWhether the operation succeeded
keystringThe variable key
valueanyThe stored value
valueTypestringThe value type
isNewbooleanTrue if created, false if updated existing
messagestringHuman-readable result message

Get Workspace Variable

Retrieves a value from workspace-scoped storage.

Input Fields

FieldTypeRequiredDescription
keystringYesVariable name to retrieve
defaultValueanyNoFallback value if variable doesn't exist

Outputs

OutputTypeDescription
successbooleanWhether the operation succeeded
existsbooleanWhether the variable exists
keystringThe variable key
valueanyRetrieved value (or defaultValue if not found)
valueTypestringType of the value (or null if not found)
messagestringHuman-readable result message

Cross-Workflow Example

Workflow A - Creates bucket and stores ID:

# Kaizen Create Buckets block creates a bucket
# Then Set Workspace Variable stores the ID

inputs:
  key: "active_bucket_id"
  value: "<kaizen_create_buckets.bucketIds[0]>"
  valueType: "string"
  description: "Bucket ID for filtering in other workflows"

Workflow B - Retrieves ID for filtering:

# Get Workspace Variable retrieves the stored ID
inputs:
  key: "active_bucket_id"

# Then use the value in downstream blocks
# Reference: <kaizen_get_workspace_var.value>

Common Use Cases

Share Bucket ID Between Workflows

# Workflow A: Store bucket after creation
Set Workspace Variable:
  key: "my_project_bucket"
  value: "<kaizen_create_buckets.bucketIds[0]>"

# Workflow B: Filter todos by that bucket
Get Workspace Variable:
  key: "my_project_bucket"
  defaultValue: ""

Kaizen Todos:
  bucketId: "<kaizen_get_workspace_var.value>"

Store Configuration Values

# Set multiple configuration values
Set Workspace Variable:
  key: "max_items_per_run"
  value: "50"
  valueType: "number"

Set Workspace Variable:
  key: "processing_enabled"
  value: "true"
  valueType: "boolean"

Store Complex Data

# Store a JSON object
Set Workspace Variable:
  key: "last_sync_state"
  value: '{"timestamp": "2024-01-15", "count": 42}'
  valueType: "json"

# Store an array
Set Workspace Variable:
  key: "processed_ids"
  value: "<some_block.resultIds>"
  valueType: "array"

Variables persist until explicitly deleted or overwritten. They are scoped to the workspace - all workflows in the workspace can access them.

Best Practices

  • Use descriptive keys: Choose clear names like active_bucket_id or last_processed_todo
  • Provide defaults: Use defaultValue in Get to handle missing variables gracefully
  • Check existence: Use the exists output when you need to know if a variable was found
  • Don't store secrets: Use environment variables for sensitive data instead
  • Consider workflow variables for internal state: Workspace Variables are for cross-workflow sharing; use the Variables block for workflow-internal state
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