Append To State • AI Agent SDK
append_to_state: Append a value to a list state. Creates the list if it doesn't exist.
append_to_state
Method
</div>
This is a method of the AgentTeam 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
ParamField
strState key
ParamField
AnyValue to append
ParamField
Optional[int]Optional maximum length for the list
Returns
ResponseField
List[Any]The updated list
Exceptions
TypeError
If the existing value is not a list and convert_to_list=False
Source
View on GitHubpraisonaiagents/agents/agents.py at line 3165