> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Save State • AI Agent SDK

> save_state: Save session state data to memory.

# save\_state

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**Session**](../classes/Session) class in the [**session**](../modules/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

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def save_state(state_data: Dict[str, Any]) -> None
```

## Parameters

<ParamField query="state_data" type="Dict" required={true}>
  Dictionary of state data to save
</ParamField>

### Exceptions

<AccordionGroup>
  <Accordion title="ValueError">
    If this is a remote session
  </Accordion>
</AccordionGroup>

## Uses

* `ValueError`
* `store_short_term`

## Used By

* [`Session.set_state`](../functions/Session-set_state)

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/session.py#L204">
  `praisonaiagents/session.py` at line 204
</Card>
