
Node Details
- Name: seqState
- Type: State
- Category: Sequential Agents
- Version: 2.0
Parameters
The State node has one main input parameter:Custom State
Users can define the structure of the state object using either a table-based UI or custom code.Option 1: Custom State (Table)
- Type: Data Grid
- Description: Allows users to define the state structure using a table interface.
-
Columns:
- Key: The name of the state variable
- Operation: The type of operation to perform (Replace or Append)
- Default Value: The initial value for the state variable
Option 2: Custom State (Code)
- Type: Code Input
- Description: Allows users to define the state structure using a JSON object
-
Default:
Functionality
- The node initializes a state object based on the user’s input.
-
For each key in the state:
- If the operation is “Replace”, it creates a function that replaces the existing value with a new one (or keeps the existing if the new is null).
- If the operation is “Append”, it creates a function that appends the new value to the existing array.
- The node can handle both UI-based input and code-based input, allowing for flexibility in defining the state structure.
Output
The node outputs anISeqAgentNode
object containing:
-
id
: The node’s unique identifier -
node
: The state object with defined keys and their corresponding update functions -
name
: ‘state’ -
label
: ‘state’ -
type
: ‘state’ -
output
: START (a constant from @langchain/langgraph)
Use Cases
- Maintaining conversation history in a chatbot
- Tracking progress through a multi-step process
- Aggregating information from multiple API calls or data sources
- Storing intermediate results in complex workflows
Notes
- The node uses a sandbox environment (NodeVM) to safely execute user-provided code when using the code-based input option.
- It supports both built-in and external dependencies, which can be configured through environment variables.
- The state object is highly flexible and can be customized to fit various use cases in sequential agent flows.