__init__.py 846 B

12345678910111213141516171819202122232425262728293031
  1. from openhands.core.logger import openhands_logger as logger
  2. from openhands.runtime.e2b.sandbox import E2BBox
  3. def get_runtime_cls(name: str):
  4. # Local imports to avoid circular imports
  5. if name == 'eventstream':
  6. from openhands.runtime.client.runtime import EventStreamRuntime
  7. return EventStreamRuntime
  8. elif name == 'e2b':
  9. from openhands.runtime.e2b.runtime import E2BRuntime
  10. return E2BRuntime
  11. elif name == 'remote':
  12. from openhands.runtime.remote.runtime import RemoteRuntime
  13. return RemoteRuntime
  14. elif name == 'modal':
  15. logger.info('Using ModalRuntime')
  16. from openhands.runtime.modal.runtime import ModalRuntime
  17. return ModalRuntime
  18. else:
  19. raise ValueError(f'Runtime {name} not supported')
  20. __all__ = [
  21. 'E2BBox',
  22. 'get_runtime_cls',
  23. ]