Files
deer-flow/backend/src/sandbox/local/local_sandbox_provider.py
T
2026-01-15 13:22:30 +08:00

23 lines
651 B
Python

from src.sandbox.local.local_sandbox import LocalSandbox
from src.sandbox.sandbox_provider import SandboxProvider
_singleton: LocalSandbox | None = None
class LocalSandboxProvider(SandboxProvider):
def acquire(self, thread_id: str | None = None) -> str:
global _singleton
if _singleton is None:
_singleton = LocalSandbox("local")
return _singleton.id
def get(self, sandbox_id: str) -> None:
if sandbox_id == "local":
if _singleton is None:
self.acquire()
return _singleton
return None
def release(self, sandbox_id: str) -> None:
pass