Save Session State • AI Agent SDK

save_session_state: Persist team session state for deterministic resume (Issue #3635).

save_session_state

Method

</div>

This is a method of the AgentTeam class in the agents module.

Persist team session state for deterministic resume (Issue #3635).

Writes the shared team `_state (plus run bookkeeping) to the durable, project-scoped SessionStore — the same store single Agent resume uses — keyed deterministically by session_id. This gives multi-agent runs the same locked, atomic, memory-independent continuity as a single agent: it works even with memory=False`.

`shared_memory` is kept as an optional enrichment (not a gate) so legacy semantic-recall lookups still find the state when memory is on.

Returns `True when the durable write succeeded, False` otherwise, so callers can tell whether a resumable state actually reached disk.

Signature

python
def save_session_state(session_id: str, include_memory: bool) -> bool

Parameters

ParamField str

No description available.

ParamField bool

No description available.

Returns

ResponseField bool

The result of the operation.

Uses

  • update_session_metadata
  • get_default_session_store
  • logger.warning
  • store_short_term
  • logger.debug

Source

View on GitHub

praisonaiagents/agents/agents.py at line 3358


Related Documentation