Stores a value in the Agent’s state. Use to remember data across steps.Documentation Index
Fetch the complete documentation index at: https://dev.writer.com/llms.txt
Use this file to discover all available pages before exploring further.

Overview
The Set state block is a core building block that connects information between different parts of your blueprint, interface, and code. It acts as a bridge, allowing data to flow from one part of your workflow to another - whether that’s from blueprint to interface, between different blueprint blocks, from interface back to blueprint, or to and from custom Python code. You can specify the variable name, value, and value type (plain text or JSON). The value is then available in subsequent blocks via the state variable.Common use cases
- Storing user input or intermediate results
- Passing data between blocks in a workflow
- Saving API responses or generated content for later use
- Managing workflow state or flags
- Storing block results to display in interface components
- Persisting data between interface updates and refreshes
How it works
- Link Variable: Specify the name of the state variable to set.
- Value type: Choose whether the value is plain text or JSON. The default if not specified is plain text.
- Value: Enter the value to store.
@{state.variable_name}.
Examples
Text generation workflow
This example shows how to generate text and display it in the interface using state management. Blueprint Flow:- UI Trigger → User clicks “Generate” button
- Text generation → Creates content based on prompt
- Set state → Stores generated text
- Link Variable:
generated_text - Value type:
text. The default if not specified is plain text. - Value:
@{result}. This variable is the text generated by the text generation block that precedes the Set state block.

Form submission workflow with JSON value type
This example shows how to package multiple form field responses into a single state variable. It’s useful when collecting and storing related data from interface forms. Blueprint Flow:- UI Trigger → User submits a registration form. All the form fields have Link Variables set to the name of the field.
- Set state → Stores all form fields as JSON
- Link Variable:
form_data - Value type:
JSON - Value:

@{form_data.firstName} or @{form_data.address.city}.
Fields
| Name | Type | Control | Default | Description | Options | Validation |
|---|---|---|---|---|---|---|
| Link Variable | Binding | - | - | Set the variable here and use it across your agent. | - | - |
| Value type | Text | - | text | - |
| - |
| Value | Text | Textarea | - | - | - | - |
End states
Below are the possible end states of the block call.| Name | Field | Type | Description |
|---|---|---|---|
| Success | - | success | The state was updated successfully. |
| Error | - | error | There was an error updating the state. |
@{result}, or you can use the state syntax to access the value in the state variable, for example @{form_data}.