__init__.py 931 B

123456789101112131415161718192021222324252627282930313233
  1. from openhands.core.logger import openhands_logger as logger
  2. from openhands.runtime.impl.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.impl.eventstream.eventstream_runtime import (
  7. EventStreamRuntime,
  8. )
  9. return EventStreamRuntime
  10. elif name == 'e2b':
  11. from openhands.runtime.impl.e2b.e2b_runtime import E2BRuntime
  12. return E2BRuntime
  13. elif name == 'remote':
  14. from openhands.runtime.impl.remote.remote_runtime import RemoteRuntime
  15. return RemoteRuntime
  16. elif name == 'modal':
  17. logger.debug('Using ModalRuntime')
  18. from openhands.runtime.impl.modal.modal_runtime import ModalRuntime
  19. return ModalRuntime
  20. else:
  21. raise ValueError(f'Runtime {name} not supported')
  22. __all__ = [
  23. 'E2BBox',
  24. 'get_runtime_cls',
  25. ]