MCPcopy
hub / github.com/openai/openai-agents-python / cleanup

Method cleanup

src/agents/sandbox/runtime.py:258–270  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

256 )
257
258 async def cleanup(self) -> dict[str, object] | None:
259 should_trace_cleanup = self.current_session is not None or bool(self._prepared_sessions)
260 span_cm = (
261 custom_span("sandbox.cleanup", data={})
262 if should_trace_cleanup and _supports_trace_spans()
263 else nullcontext(None)
264 )
265 with span_cm:
266 try:
267 return await self._session_manager.cleanup()
268 finally:
269 self._prepared_agents.clear()
270 self._prepared_sessions.clear()
271
272
273def _get_memory_capability(agent: Agent[TContext]) -> Memory | None:

Callers 3

runMethod · 0.95
_cleanup_and_storeMethod · 0.95

Calls 3

custom_spanFunction · 0.85
clearMethod · 0.80
_supports_trace_spansFunction · 0.70