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

Method clear_session

examples/memory/file_session.py:71–84  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

69 return popped
70
71 async def clear_session(self) -> None:
72 if not self.session_id:
73 return
74 file_path = self._items_path(self.session_id)
75 state_path = self._state_path(self.session_id)
76 try:
77 await asyncio.to_thread(file_path.unlink)
78 except FileNotFoundError:
79 pass
80 try:
81 await asyncio.to_thread(state_path.unlink)
82 except FileNotFoundError:
83 pass
84 self.session_id = ""
85
86 def _items_path(self, session_id: str) -> Path:
87 return self._dir / f"{session_id}.json"

Callers 4

mainFunction · 0.45
demonstrate_multi_storeFunction · 0.45
mainFunction · 0.45

Calls 2

_items_pathMethod · 0.95
_state_pathMethod · 0.95

Tested by

no test coverage detected