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

Method load_state_json

examples/memory/file_session.py:107–116  ·  view source on GitHub ↗

Load a previously saved RunState JSON payload, if present.

(self)

Source from the content-addressed store, hash-verified

105 await asyncio.to_thread(file_path.write_text, payload, encoding="utf-8")
106
107 async def load_state_json(self) -> dict[str, Any] | None:
108 """Load a previously saved RunState JSON payload, if present."""
109 session_id = await self._ensure_session_id()
110 state_path = self._state_path(session_id)
111 try:
112 data = await asyncio.to_thread(state_path.read_text, "utf-8")
113 parsed = json.loads(data)
114 return parsed if isinstance(parsed, dict) else None
115 except FileNotFoundError:
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."""

Callers 1

mainFunction · 0.95

Calls 2

_ensure_session_idMethod · 0.95
_state_pathMethod · 0.95

Tested by

no test coverage detected