Save State • AI Agent SDK
save_state: Save session state data to memory.
save_state
Method
</div>
This is a method of the Session class in the session module.
Save session state data to memory.
Calling save_state() repeatedly is safe and idempotent — it does not duplicate chat history. Requires the session store to implement set_chat_history; built-in stores do.
Signature
def save_state(state_data: Dict[str, Any]) -> NoneParameters
ParamField
DictDictionary of state data to save
Exceptions
ValueError
If this is a remote session
Uses
ValueErrorstore_short_term
Used By
Source
View on GitHubpraisonaiagents/session.py at line 204