MCPcopy Index your code
hub / github.com/openai/openai-agents-python / save_state_json

Method save_state_json

examples/memory/file_session.py:118–124  ·  view source on GitHub ↗

Persist the serialized RunState JSON payload alongside session items.

(self, state: dict[str, Any])

Source from the content-addressed store, hash-verified

116 return None
117
118 async def save_state_json(self, state: dict[str, Any]) -> None:
119 """Persist the serialized RunState JSON payload alongside session items."""
120 session_id = await self._ensure_session_id()
121 state_path = self._state_path(session_id)
122 payload = json.dumps(state, indent=2, ensure_ascii=False)
123 await asyncio.to_thread(self._dir.mkdir, parents=True, exist_ok=True)
124 await asyncio.to_thread(state_path.write_text, payload, encoding="utf-8")

Callers 1

mainFunction · 0.95

Calls 2

_ensure_session_idMethod · 0.95
_state_pathMethod · 0.95

Tested by

no test coverage detected