Skip to main content

append_to_state

Method
This is a method of the Agents class in the agents module.
Append a value to a list state. Creates the list if it doesn’t exist.

Signature

def append_to_state(key: str, value: Any, max_length: Optional[int]) -> List[Any]

Parameters

key
str
required
State key
value
Any
required
Value to append
max_length
Optional
Optional maximum length for the list

Returns

Returns
List[Any]
The updated list

Exceptions

If the existing value is not a list and convert_to_list=False