__init__.py 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. from openhands.core.logger import openhands_logger as logger
  2. from openhands.runtime.impl.e2b.sandbox import E2BBox
  3. from openhands.runtime.impl.eventstream.eventstream_runtime import (
  4. EventStreamRuntime,
  5. )
  6. from openhands.runtime.impl.modal.modal_runtime import ModalRuntime
  7. from openhands.runtime.impl.remote.remote_runtime import RemoteRuntime
  8. from openhands.runtime.impl.runloop.runloop_runtime import RunloopRuntime
  9. def get_runtime_cls(name: str):
  10. # Local imports to avoid circular imports
  11. if name == 'eventstream':
  12. return EventStreamRuntime
  13. elif name == 'e2b':
  14. return E2BBox
  15. elif name == 'remote':
  16. return RemoteRuntime
  17. elif name == 'modal':
  18. logger.debug('Using ModalRuntime')
  19. return ModalRuntime
  20. elif name == 'runloop':
  21. return RunloopRuntime
  22. else:
  23. raise ValueError(f'Runtime {name} not supported')
  24. __all__ = [
  25. 'E2BBox',
  26. 'RemoteRuntime',
  27. 'ModalRuntime',
  28. 'RunloopRuntime',
  29. 'EventStreamRuntime',
  30. 'get_runtime_cls',
  31. ]