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

Method _read_items

examples/memory/file_session.py:92–99  ·  view source on GitHub ↗
(self, session_id: str)

Source from the content-addressed store, hash-verified

90 return self._dir / f"{session_id}-state.json"
91
92 async def _read_items(self, session_id: str) -> list[Any]:
93 file_path = self._items_path(session_id)
94 try:
95 data = await asyncio.to_thread(file_path.read_text, "utf-8")
96 parsed = json.loads(data)
97 return parsed if isinstance(parsed, list) else []
98 except FileNotFoundError:
99 return []
100
101 async def _write_items(self, session_id: str, items: list[Any]) -> None:
102 file_path = self._items_path(session_id)

Callers 3

get_itemsMethod · 0.95
add_itemsMethod · 0.95
pop_itemMethod · 0.95

Calls 1

_items_pathMethod · 0.95

Tested by

no test coverage detected